Status
Not open for further replies.

tetr0n

Villager
Member
Joined
Jul 3, 2014
Messages
6
Reaction score
7
First Language
English
Primarily Uses
Edit: Mystery solved ! Look below for fixes. Post #11 may be the better fix.

---------------------------------------------------------------------------------------------------------------

Some of my posts were done tired so let me clarify what the problem was.

By default. The Game_Battler definition "on_turn_end" ended the turn then updated and removed states. So if you had a state that lasted 2 turns, the third turn is when it was marked as being removed.

When you used the add_state command the first thing it does is check if you are not allowed to add that state. One of the conditions stopping you from adding the state was the state_removed definition. The state_removed definition checked if the state had been removed on the "same action". So you couldn't apply a state after it had just expired, because it was still on the list of states that had been removed.

----------------------------------------------------------------------------------------------------------------

I have a skill that damages the enemy and adds a state to the user using a custom formula.

The problem is that I can't get the state to be added consecutively.

Try it yourself, load up a new project. Change the state hp regen to 1-1 turns. In your attack custom formula enter "a.add_state(14);30"

Go to battle test and only use your basic attack and see for yourself that it doesn't work, or I'm crazy.

I'm not savvy enough with the game's scripts to know what I could tweak to change this but I have some clues.

Clue A: The problem is unique to a.add_state. b.add_state in the same syntax will apply a state consecutively. Whether the skill damages or heals.

Clue B: You can apply a state consecutively using a.add_state or b.add_state if the scope of the skill is the user or allies. Damaging or healing.

Clue C: a.add_state works again the turn after it failed to apply the state.

Clue D: The number of turns doesn't matter. The turn after it expires it fails to apply the state.

Clue E: If you don't go first during the turn the state IS applied.

I'm not going to be using outside scripts for this. I'm only modifying the default rpgmaker scripts.

Edit: Video http://youtu.be/HO8NzYLyO8M
 
Last edited by a moderator:

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,655
Reaction score
438
First Language
Portuguese
Primarily Uses
RMMV
Answer: The state is still applied when you use the attack. So when you "reapply" the state, it doesn't because it is already there. Then the turn is over, and so goes the state.
 

tetr0n

Villager
Member
Joined
Jul 3, 2014
Messages
6
Reaction score
7
First Language
English
Primarily Uses
Yes. You use an attack, apply the state, the turn ends, and the state goes away. The turn after that you use the attack again, but it doesn't apply the state. You go through that turn without the state being applied, or at least without it having any effect. You can also see that the state icon doesn't show up.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,270
Reaction score
8,723
First Language
German
Primarily Uses
RMMV
please describe exactly what you want to say with "consecutivly"?


If you mean to say that one state should follow the other after the first one vanishes, then this is not possible and you'll need a script for this. There are already scripts for this available, but a state can only be added by a skill or a skill calling a common event - it cannot be added from another state.


Second tip: test if the state appears if you make it last longer than 1 turn - depending on when a state is added, the turn might be over faster than the next display is updated (which would cause the state be added and be vanished before you can see it).


Because it is also a fact that in unmodified damage formulas, a.add_state does work and has been used dozens of times before.
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,655
Reaction score
438
First Language
Portuguese
Primarily Uses
RMMV
Are you sure it goes away?
can you show us your skill and state?
 
Last edited by a moderator:

Eschaton

Hack Fraud
Veteran
Joined
Mar 4, 2013
Messages
2,029
Reaction score
533
First Language
English
Primarily Uses
N/A
Are you talking about stacking states? Because there's a script for that.
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,655
Reaction score
438
First Language
Portuguese
Primarily Uses
RMMV
Pretty sure he means reapplying the state at every turn he uses the technique
 

tetr0n

Villager
Member
Joined
Jul 3, 2014
Messages
6
Reaction score
7
First Language
English
Primarily Uses
I made a video to simplify things.

I created a new project in rpgmaker vx ace and changed the Guard skill to target an enemy and apply its guard state using a.add_state. You can see for yourself the effects.

http://youtu.be/HO8NzYLyO8M
 

tetr0n

Villager
Member
Joined
Jul 3, 2014
Messages
6
Reaction score
7
First Language
English
Primarily Uses
I got it.

On line 799 of Game_Battler you need to change the order of on_turn_end.

I've been playing around with this and haven't seen it screwing anything up. Please PM me if any problems arise. I can't help with troubleshooting if you're using outside scripts though.

I had one kink. I changed my scripts so that states you gave yourself that could be removed by damage were removed when you used a skill.  I had to remove that feature for this to work perfectly but I got the same effect with common events so I'm happy with this.

Originally.

def on_turn_end @result.clear regenerate_all update_state_turns update_buff_turns remove_states_auto(2) endFixed.

Code:
  def on_turn_end      update_state_turns    update_buff_turns    remove_states_auto(2)     @result.clear    regenerate_all      end
 

YoraeRasante

Veteran
Veteran
Joined
Jun 6, 2014
Messages
1,655
Reaction score
438
First Language
Portuguese
Primarily Uses
RMMV
I had a simpler idea just now: make the attack remove the state before adding it. This way the state will reset and probably work alright.
 

tetr0n

Villager
Member
Joined
Jul 3, 2014
Messages
6
Reaction score
7
First Language
English
Primarily Uses
That doesn't work. There's technically no state to remove, but the game removed the state after it updated using regenerate and such so when you try to reapply it it doesn't do it because it's not an addable state. Another fix is to change the state_addable definition and delete the !state_removed?(state_id) that tells the game the state isn't addable.

This one seems like it has more potential to be a problem though.

This did fix another problem I ran into with remove by damage. Enemies were getting rid of a remove by damage state but if I used a skill that gave me that state on the same turn that it was removed it wouldn't apply the state. So this may actually be the better fix.

Fixed

def state_addable?(state_id) alive? && $data_states[state_id] && !state_resist?(state_id) && !state_restrict?(state_id) endOriginal

Code:
  def state_addable?(state_id)    alive? && $data_states[state_id] && !state_resist?(state_id) &&      !state_removed?(state_id) && !state_restrict?(state_id)  end
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,089
Reaction score
15,502
First Language
English
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.


Next time, just report the thread, and ANY moderator will close it for you. If you PM someone, you are waiting for them to come on and read your message, AND hope they can action it straight away, and sometimes there is just so much going on, that PMs like that will just be forgotten.
 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

I'm listening to iiluminaughtii talking about the secrets behind shady businesses and scams. Meanwhile I'm writing a fanfic about Sephiroth from FF7, one specifically for my stepmom. I'll get to give it to her, too, because my boss said I could take the holidays off! Dec. 22-27 I will be in Orlando, and maybe Fort Myers too, visiting my dad and stepmom!
Of course, I bought a handful of games on the Steam Black Friday sale. Will I try them? Will I complete any? Who knows...
I don't really have any neat updates today about how I screwed up programming... But if you want to observe the intensenes of me programming, then you can check out my stream :)
New Weapons.gif
No more spam from me today, I promise! Just wanted to upload this, people have been giving me feedback that my weapon sprites (which were RTP) clashed badly with my battlers for ages, so today I finally took the plunge and updated them! Really happy with how they came out :D :D
So Facebook fraudulently took money from me. They even went through my PayPal accounts to find a card that had the money on it. Thinking about deleting my Facebook account because this doesn't happen on twitter, not even close.

Forum statistics

Threads
117,006
Messages
1,103,770
Members
152,902
Latest member
varghn
Top