Simple Question: How do you change the number of steps it takes for a state to heal you with HRG on?

Status
Not open for further replies.

Mahoken

Veteran
Veteran
Joined
Nov 24, 2013
Messages
41
Reaction score
3
First Language
English
Primarily Uses
I want a potion I made to heal you every 10 steps by a certain amount for another specified steps. It seems like the number a steps it takes is always random. Where can I change the amount of steps it takes to heal?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,006
First Language
Tagalog
Primarily Uses
RMVXA
You could make the item call a common event which saves the current step count, then activate a switch that is used by a parallel process common event which checks the step count (waiting every few frames or so), then compare it with the original step count and if the difference is 10, heal then disable the common event.


You would need to add some checks though to prevent bugs if you would use the items multiple times without each one finishing the effect before you use the next one
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,841
First Language
English
Primarily Uses
RMVXA
I just tested this and it is definitely not random.

Instead, it is ruled by the following two methods in Game_Actor:

#-------------------------------------------------------------------------- # * Number of Steps Regarded as One Turn in Battle #-------------------------------------------------------------------------- def steps_for_turn return 20 end #-------------------------------------------------------------------------- # * End of Turn Processing on Map Screen #-------------------------------------------------------------------------- def turn_end_on_map if $game_party.steps % steps_for_turn == 0 on_turn_end perform_map_damage_effect if @result.hp_damage > 0 end endSo, by default, every 20 steps it's treated like one "turn" in battle for the purposes of these States.

Now, the first trigger of this HP degen/regen effect will seem "random" because it's using your total step count.  So if this state is added to an actor while your total step count for the game is 98, it will trigger two steps later.  And if it's added while your total step count is 105, it will take 15 more steps before it triggers the first time.

If you want to ensure that it will take the full 20 (or whatever number you enter in the first method) steps before it triggers the first time, the best way would probably need to create a new property for RPG::State and use that to check the total steps variable against.  Or you can "cheat" by lowering the total steps variable to the last multiple of 20 ($game_party.steps = ($game_party.steps / 20).to_i * 20) when any state is applied to an ACTOR (you can do this in Game_Battler's add_state method), but like Engr. Adik's suggestion, this would also essentially reset the steps count for one state if a second state is added to someone.
 

Arthur França

Veteran
Veteran
Joined
Nov 3, 2017
Messages
40
Reaction score
27
First Language
Portuguese
Primarily Uses
RMMV
There is no way to change that counter? I mean, a plugin or script that make a number "X" of steps count as one turn in battle?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,512
Reaction score
12,002
First Language
English
Primarily Uses
RMVXA
[necro]Arthur Franca[/necro]
The query is over 3 years old. It is most unlikely that the OP is still waiting for an answer.
 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Ugh... 4:53AM over here and I can't sleep so why not just game make.
I just love the MV feature that allows you to create your own animations!
I typically ask this on my normal social media channels, but figured there may be good replies here. Anyone got any good horror movie recommendations? I've seen a lot, but I always love getting suggestions! Bonus points if you know which service it is streaming on (in the US) - bring on the spOoooOky!
 After a few distractions (and my annual rough second week of October), I’m getting back on track with my OMGC project.
 Am I overcomplicating it? Yes. Am I going to tone it down? Almost certainly not.
 At least the dialogue stuff is almost done. I need to do the map itself, and then all that’s left is combat.
 Getting there!

Forum statistics

Threads
115,911
Messages
1,093,902
Members
151,159
Latest member
rlawlsrjs3387
Top