Is it possible to extend/alter a state's duration in battle?

Theguysayshi

Villager
Member
Joined
Jul 18, 2018
Messages
27
Reaction score
2
First Language
English
Primarily Uses
RMVXA
Hi there,

Each state has a set turn duration, but I was wondering if it can be extended via a scripts so they can last longer or shorter depending on the battle.

Once such problem is when using a move that gives you many positive states for one turn, but the states stand alone last for longer. The script would be used to change the duration accordingly.

I was wondering if there is a script that exists such as "extendstate([actor],[stateno.],[turnduration])" that would be able to alter the length of a state on any actor at when called.

I've noticed the code in the "Game_Battler" section of the script but I'm not sure how to link to an actor nor alter anything contained in it.

#--------------------------------------------------------------------------
# * Update State Turn Count
#--------------------------------------------------------------------------
def update_state_turns
states.each do |state|
@state_turns[state.id] -= 1 if @state_turns[state.id] > 0
end
end
Is something like this possible? I'm not sure how to tackle it. Many thanks in advance if someone can help.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,594
Reaction score
6,527
First Language
Indonesian
Primarily Uses
RMVXA
You could make a new method to extend the duration of the states. Like
Code:
class Game_Battler
  def extend_state(state_id, dur)
    @state_turns[state_id] += dur if @state_turns[state_id]
  end
end
And what you do just use damage formula, like
Code:
a.extend_state(5, 1)
To extend state 5 for one more turn
 

Theguysayshi

Villager
Member
Joined
Jul 18, 2018
Messages
27
Reaction score
2
First Language
English
Primarily Uses
RMVXA
Thank you! I had no idea how to edit state values, so I wasn't sure how to get around it.

Thank you so much! Now I know.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

"You can thank my later", "But you haven't done anything", "Well, that's why ..."
Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

Forum statistics

Threads
105,884
Messages
1,017,243
Members
137,609
Latest member
shododdydoddy
Top