Jump to content


All recent changes seem to be working, if you see anything out of sorts please let us know.
In the meantime, join the discussion on what you would like to see in the community:

http://www.rpgmakercentral.com/topic/37923-opinions-needed/#entry265425

Photo

Ruby/RGSS3 questions that don't deserve their own thread


  • Please log in to reply
1937 replies to this topic

#1921 Shiggy

Shiggy

    Game design lover,Scripting addict and Polishing procrastinator.

  • Ace Member
  • 1,173 posts
  • LocationStrasbourg, France
  • RM Skill - Coder

Posted 17 June 2016 - 03:47 PM

In game_characterbase, there is a method called 

def distance_per_frame

You should try to alias it and multiply the result by 2


 

Currently working on:   Learning about Javascript and MV / Making a plugin for Rezanta
What I would like to do: (if I find time and/or motivation) 

Spoiler

Previous works:
Spoiler

Games I support:
Spoiler

If I helped you and you want to help me , I accept donations
will-code-for-food.png<=== contact me for commissions

#1922 Absurdiness

Absurdiness

    Advanced Member

  • Ace Member
  • 80 posts
  • LocationCatalonia
  • RM Skill - Jack of All Trades

Posted 18 June 2016 - 01:09 PM

Also any other sprites will, also scrolling will, also parallax will... you get the point. You are probably better off actually reducing the resolution and upstaging it with win32 api tricks or something, or going thorough the base graphic classes and adjust how their x and y locations are reported. Either way it's bound to be a lot of little finicky work to do right.

 

You have a point. Galv's Layer Graphics script is a good fix for the parallax problem, though; and I haven't needed scrolling yet, but when the time comes I will look into it. I prefer working with one problem at a time. Changing the resolution, on the other hand... Since Ace has a fixed grid size of 32x32 px and I require a grid of 16x16, I think that would be quite more difficult than what I'm doing now (small patches vs. total overhaul).

 

Also, my game doesn't have a battle system, so fixing all this isn't as troublesome as it'd seem. I basically need to tweak event movement and map scrolling, since I already fixed player/camera movement.

 

In game_characterbase, there is a method called 

def distance_per_frame

You should try to alias it and multiply the result by 2

 

Thanks again for the help!  :) But I'm afraid I had already tried that, and it only makes the characters move faster. The "smoothness" of the movement remains untouched. I've tried multiplying by 2 many things in many different methods and classes, such a Game_Event, but in the end the result is always the same.

 

I've been doing some tests and this only happens with events moving at x2 slower or even lower speeds: at normal and fast speeds the "half-pixel" problem isn't apparent. So it isn't as much of an issue as I thought at first, but being able to have visually consistent slower speeds would still be useful. Any idea where these movement calculations are handled? I can't find them. Could they be in one of the hidden classes? In that case, I may have to forget about it.



#1923 Rikifive

Rikifive

    Bringer of Happiness

  • Global Moderators
  • 5,215 posts
  • LocationEquestria First Language - Polish =======[ Skills ]======= Designing      ★★★★☆ Scripting         ★★★☆☆ Pixel Art          ★★☆☆☆ Silly Jokes     ★★★★★ =====[ RPG Maker ]===== Primarily Uses - RMVXAce Skill - Jackus Of All Trades
  • RM Skill - Game Developer

Posted 26 June 2016 - 06:46 AM

Silly question:
 
How to check if something equals to one of array's values?
 
For example I have a variable:
@var = 0
and an array:
@arr = [23,36,46,70]
 
Now I want to check if the @var equals to any of @arr's values.

 

@var will be increased by 1 each frame~ so the conditional will run on every single frame as well.
So... should I do something like this?

if @arr.include? @var

~Thanks!


hsd2B58.png PgyBVNj.gif
urfEvFe.pngDPJOL8N.pngA59LtIN.pngtFzNjpi.pngkJOd8Kt.pngkaGacUk.png4ccleCM.pngS0DDlW8.png4CSoj1R.png mSWmTjJ.gif

Spoiler

#1924 Shiggy

Shiggy

    Game design lover,Scripting addict and Polishing procrastinator.

  • Ace Member
  • 1,173 posts
  • LocationStrasbourg, France
  • RM Skill - Coder

Posted 26 June 2016 - 09:06 AM

@arr.include?(@var)

Yes this should work

 

and I will drop this here just in case

 

@arr.any? { |array_member| array_member == @var }

any? checks if the condition if true for any element of the array,it might giv eyou some ideas


 

Currently working on:   Learning about Javascript and MV / Making a plugin for Rezanta
What I would like to do: (if I find time and/or motivation) 

Spoiler

Previous works:
Spoiler

Games I support:
Spoiler

If I helped you and you want to help me , I accept donations
will-code-for-food.png<=== contact me for commissions

#1925 Rikifive

Rikifive

    Bringer of Happiness

  • Global Moderators
  • 5,215 posts
  • LocationEquestria First Language - Polish =======[ Skills ]======= Designing      ★★★★☆ Scripting         ★★★☆☆ Pixel Art          ★★☆☆☆ Silly Jokes     ★★★★★ =====[ RPG Maker ]===== Primarily Uses - RMVXAce Skill - Jackus Of All Trades
  • RM Skill - Game Developer

Posted 26 June 2016 - 09:11 AM

Ooooh .any? was also something I had in mind, though I was not sure how to use that properly.

 

Now everything is clear, thanks!


hsd2B58.png PgyBVNj.gif
urfEvFe.pngDPJOL8N.pngA59LtIN.pngtFzNjpi.pngkJOd8Kt.pngkaGacUk.png4ccleCM.pngS0DDlW8.png4CSoj1R.png mSWmTjJ.gif

Spoiler

#1926 WCouillard

WCouillard

    Sanubian Menace

  • Ace Member
  • 1,183 posts
  • RM Skill - Jack of All Trades

Posted 08 July 2016 - 09:35 AM

Haven't posted in a while, but I have a seemingly easy thing to code that is giving me a small migraine.

 

I've got an image showing during battle, that rest behind each character's information in Window_BattleStatus. However, I'd like it to actually show over that information. Trying to change to Z value of the image being shown is returning errors or simply not working, so I'm sure it's just a matter of me putting it in the wrong place. Been a few months since I've coded anything, so I'm a little rusty, but here's the method which creates the image in battle.

  def draw_actor_hud(x, y, enabled = true)
    bitmap = Cache.system("Actor_Battle_HUD")
    rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
  end

This is within Window_BattleStatus. This method is then called here.

  #--------------------------------------------------------------------------
  # * Overwrite method: draw_basic_area
  #--------------------------------------------------------------------------
  def draw_basic_area(rect, actor)
    width = $data_system.opt_display_tp ? 640 : 640
    draw_actor_name(actor, rect.x, rect.y - 5, 100)
    draw_actor_battle_icons(actor, rect.x + 328 , rect.y, 168)
    draw_actor_hud(rect.x, rect.y)
  end

Also in Window_BattleStatus.

 

Can anyone tell me the proper way to alter the Z value to make the image I'm calling show over the character's battle status information?


My Completed Scripts: http://pastebin.com/u/WCouillard

Final Fantasy Discovery: http://www.rpgmaker.net/games/4071/


#1927 Shiggy

Shiggy

    Game design lover,Scripting addict and Polishing procrastinator.

  • Ace Member
  • 1,173 posts
  • LocationStrasbourg, France
  • RM Skill - Coder

Posted 08 July 2016 - 10:05 AM

You are copying the content of a bitmap inside the bitmap of the window so you can't change the z value ,for that you would need to create a new sprite

def draw_actor_hud(x, y, enabled = true)
    bitmap = Cache.system("Actor_Battle_HUD")
    rect = Rect.new(0, 0, bitmap.width, bitmap.height)
    sprite = Sprite.new
    sprite.bitmap = bitmap
    sprite.x = @x 
    sprite.y = @y 
    sprite.z = @z + 1
  end

So something like this should do it , (It probably need some adjustments tho like adding padding values to your sprite coordinates) don't forget to alias the dispose method from your window to make it also dispose the sprite


 

Currently working on:   Learning about Javascript and MV / Making a plugin for Rezanta
What I would like to do: (if I find time and/or motivation) 

Spoiler

Previous works:
Spoiler

Games I support:
Spoiler

If I helped you and you want to help me , I accept donations
will-code-for-food.png<=== contact me for commissions

#1928 WCouillard

WCouillard

    Sanubian Menace

  • Ace Member
  • 1,183 posts
  • RM Skill - Jack of All Trades

Posted 08 July 2016 - 10:36 AM

Returning an error of "No implicit conversion from nil to integer," on the sprite.x line of that code.

 

I feel like I should also note that the reason I coded it the way I did, rather than just use a sprite.new, is because it has to load this image once for each party member, not just one image.


Edited by WCouillard, 08 July 2016 - 10:40 AM.

My Completed Scripts: http://pastebin.com/u/WCouillard

Final Fantasy Discovery: http://www.rpgmaker.net/games/4071/


#1929 Shiggy

Shiggy

    Game design lover,Scripting addict and Polishing procrastinator.

  • Ace Member
  • 1,173 posts
  • LocationStrasbourg, France
  • RM Skill - Coder

Posted 08 July 2016 - 11:30 AM

Yeah it should be 
this.x/y/z instead of @x/@y/@z
wiat I think it should appear above anyway because you are drawing on the bitmap after so I don't know sorry


 

Currently working on:   Learning about Javascript and MV / Making a plugin for Rezanta
What I would like to do: (if I find time and/or motivation) 

Spoiler

Previous works:
Spoiler

Games I support:
Spoiler

If I helped you and you want to help me , I accept donations
will-code-for-food.png<=== contact me for commissions

#1930 Rikifive

Rikifive

    Bringer of Happiness

  • Global Moderators
  • 5,215 posts
  • LocationEquestria First Language - Polish =======[ Skills ]======= Designing      ★★★★☆ Scripting         ★★★☆☆ Pixel Art          ★★☆☆☆ Silly Jokes     ★★★★★ =====[ RPG Maker ]===== Primarily Uses - RMVXAce Skill - Jackus Of All Trades
  • RM Skill - Game Developer

Posted 13 July 2016 - 06:34 AM

Silly question:

Can I clear a part of bitmap?

 

I've made sprites, where I'm drawing text and such on their bitmaps (not using window classes at all) - now because one sprite holds multiple draw_text methods (to change color and/or set the accurate position of various parts of text and such) it makes it harder to change something in the text, because I need to redraw the entire bitmap, which is kinda inconvenient and just unnecessary.

 

So, .clear method clears the entire bitmap ~ is there a way to clear just a part of it ~ something like .clear(100, 0, 50, 20)

Or... should/can I set rect's?

 

This will work as an example:

Let's say I have a setting like this:

 

-->   VOLUME:         < 100% >

 

Now, I'd like to redraw the right part, while not having to redraw the 'VOLUME'.

 

Thanks ~


hsd2B58.png PgyBVNj.gif
urfEvFe.pngDPJOL8N.pngA59LtIN.pngtFzNjpi.pngkJOd8Kt.pngkaGacUk.png4ccleCM.pngS0DDlW8.png4CSoj1R.png mSWmTjJ.gif

Spoiler

#1931 Shiggy

Shiggy

    Game design lover,Scripting addict and Polishing procrastinator.

  • Ace Member
  • 1,173 posts
  • LocationStrasbourg, France
  • RM Skill - Coder

Posted 13 July 2016 - 07:47 AM

From the VX ace help page about bitmap

clear_rect(x, y, width, height)
clear_rect(rect)
Clears this bitmap box (x, y, width, height) or rect (Rect).

Edited by Shiggy, 13 July 2016 - 07:47 AM.

 

Currently working on:   Learning about Javascript and MV / Making a plugin for Rezanta
What I would like to do: (if I find time and/or motivation) 

Spoiler

Previous works:
Spoiler

Games I support:
Spoiler

If I helped you and you want to help me , I accept donations
will-code-for-food.png<=== contact me for commissions

#1932 Rikifive

Rikifive

    Bringer of Happiness

  • Global Moderators
  • 5,215 posts
  • LocationEquestria First Language - Polish =======[ Skills ]======= Designing      ★★★★☆ Scripting         ★★★☆☆ Pixel Art          ★★☆☆☆ Silly Jokes     ★★★★★ =====[ RPG Maker ]===== Primarily Uses - RMVXAce Skill - Jackus Of All Trades
  • RM Skill - Game Developer

Posted 13 July 2016 - 08:06 AM

*facepalm that big, that it takes so much space*

Spoiler

I was searching through the libraries on the web, but there was so much stuff except these methods, so that's why the question appeared - I totally forgot about the HELP file in the Editor...

Yes it does exactly what I wanted, thanks for pointing that out.

That's good I've put the 'silliness' warning at the beginning.

Now excuse me, I'm going to the shame corner for some time.


hsd2B58.png PgyBVNj.gif
urfEvFe.pngDPJOL8N.pngA59LtIN.pngtFzNjpi.pngkJOd8Kt.pngkaGacUk.png4ccleCM.pngS0DDlW8.png4CSoj1R.png mSWmTjJ.gif

Spoiler

#1933 WCouillard

WCouillard

    Sanubian Menace

  • Ace Member
  • 1,183 posts
  • RM Skill - Jack of All Trades

Posted 24 July 2016 - 07:09 AM

This has probably been covered here before, but what would be the easiest way, using a script call, to grab a random value from an array and store it in a variable? For example, we have an array of integers, let's say something like..

random_id = [1, 2..22, 24..100]

Whenever I try to use different ways to pull one of the integers in the range above, it returns an error citing "cannot convert Array into Integer," which is understandable. What I want to know is, how do we take ONE integer from the range above at random, and then store it in the variable to be used further down in the script call?


My Completed Scripts: http://pastebin.com/u/WCouillard

Final Fantasy Discovery: http://www.rpgmaker.net/games/4071/


#1934 KilloZapit

KilloZapit

    FAIRY DUST! FAIRY DUST FOR EVERYONE! WHEE!

  • Ace Member
  • 2,314 posts
  • LocationFairyland!
  • RM Skill - Coder

Posted 25 July 2016 - 02:19 AM

Are you strictly asking to chose either 1 or a number between 2 and 22 or a number between 24 and 100, or do you want to pick a number from a array that contains 1, all numbers from 2 to 22, and all numbers from 24 to 100? Because those are two different things. The first you will get 1 one third of the of the time, and the other you will only get 1 one ninetyninth of the time.

 

Long story short, first would be like this:

ids = [1, 2..22, 24..100]
step_one = ids.sample
step_two = step_one.is_a?(Enumerable) ? step_one.to_a.sample : step_one

And the second would be like this:

ids = [1, 2..22, 24..100]
step_one = ids.collect_concat {|n| n.is_a?(Enumerable) ? n.to_a : [n]}
step_two = step_one.sample

Both are probably not the best way to do it.


Edited by KilloZapit, 25 July 2016 - 02:21 AM.


#1935 WCouillard

WCouillard

    Sanubian Menace

  • Ace Member
  • 1,183 posts
  • RM Skill - Jack of All Trades

Posted 25 July 2016 - 02:06 PM

Are you strictly asking to chose either 1 or a number between 2 and 22 or a number between 24 and 100, or do you want to pick a number from a array that contains 1, all numbers from 2 to 22, and all numbers from 24 to 100? Because those are two different things. The first you will get 1 one third of the of the time, and the other you will only get 1 one ninetyninth of the time.

 

Long story short, first would be like this:

ids = [1, 2..22, 24..100]
step_one = ids.sample
step_two = step_one.is_a?(Enumerable) ? step_one.to_a.sample : step_one

And the second would be like this:

ids = [1, 2..22, 24..100]
step_one = ids.collect_concat {|n| n.is_a?(Enumerable) ? n.to_a : [n]}
step_two = step_one.sample

Both are probably not the best way to do it.

Second option, to choose one integer out of every number included in all the ranges in the array. I'll give it a test!

 

EDIT: Works beautifully. Thank you.


Edited by WCouillard, 25 July 2016 - 02:11 PM.

My Completed Scripts: http://pastebin.com/u/WCouillard

Final Fantasy Discovery: http://www.rpgmaker.net/games/4071/


#1936 Kaneshon

Kaneshon

    Advanced Member

  • Ace Member
  • 39 posts

Posted 25 July 2016 - 08:43 PM

Hello,

 

I have a party of 15+ members, and one of them is wearing a specific weapon, how would I go about finding that actor's ID and position in the party? I need to get both because it will determine their move route and positioning in the map.

 

EDIT:

I finally got it to work with Tsukihime's Equip Check :D


Edited by Kaneshon, 27 July 2016 - 09:18 PM.


#1937 TheYungVxAce

TheYungVxAce

    Advanced Member

  • Ace Member
  • 106 posts
  • RM Skill - Pixel Artist

Posted 09 August 2016 - 05:31 PM

Is it possible to show a picture at the location of a specific event despite the event moves in different locations?



#1938 Jolt Android

Jolt Android

    Jolt Android

  • Ace Member
  • 242 posts
  • LocationCanadian living in Korea
  • RM Skill - Jack of All Trades

Posted 15 August 2016 - 01:31 AM

I'm trying to figure out how to properly check if the player is trying to choose himself as the subject of a skill.

I've made a new targeting scope inside Yanfly Target Manager called "not_for_user?" which requires you to choose an ally for the skill, but can't choose yourself.

    elsif item.not_for_user?
      array |= [friends_unit.smooth_target(@target_index)]
      array -= [subject] 

So far it does what I want it to except, if you purposely choose yourself the skill does nothing, you waste a turn, (at least you don't expend the cost of the skill though...).

 

I think I have to add code to item_test, something like

  return false if item.not_for_user? && item.target == user?

but it still allows me to select the user. I've tried a whole bunch of different things here that either crash or do nothing.


KOTPsmall_zps9dced9d0.png

Part I features 10 hours of gameplay goodness! Download Link





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users