(VX Ace) States that retain even in death!

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
Hello everyone! I am using Theo's Side View battle system: https://forums.rpgmakerweb.com/inde...m-in-game-editor-version-2-coming-soon.29231/

And I use the "Transform" feature in it, as they were meant to be states. Problem is that, I wish for my actors to still be in that transformed state after being KO'd. Because the transform acts as a state, when I revive the actor, it is no longer in its transformed state which is kind of a bummer. x( Since I wish for the transformed state to persist (like its permanent and will only be removed on command.)

So how do I make a state permanent and never leaves even in death? And it shall only be removed if I do that change state command via events? Thank you so much for any response!
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,374
Reaction score
1,550
First Language
English
Primarily Uses
RMMV
By default, when a battler dies, this method is called.

Code:
def die
    @hp = 0
    clear_states
    clear_buffs
  end
Which calls clear_states:

Code:
def clear_states
    super
    @result.clear_status_effects
  end
Which calls the parent clear_states (the one in Game_BattlerBase):

Code:
def clear_states
    @states = []
    @state_turns = {}
    @state_steps = {}
  end
Which just sets @states back to an empty array.

Basically what you need to do is override that so that it keeps the ID of your transform state in the @states array.
 
Last edited:

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
Oh my! Spare me, but I'm kinda newb at the VXace script things. Hmm, do you suggest I add that new code above main? Or should I edit the one in Game_Battlerbase entirely? :o I mean, I do prefer some states to stay cleared during death (Like poison, confusion etc.), but I only have one state type that I wish to be permanent even in death, which is the "Transformation" state. I hope it makes sense. x( Thanks so much for the response btw! <3
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,374
Reaction score
1,550
First Language
English
Primarily Uses
RMMV
I should be able to whip you up something if you give me a sec. What's the ID of the transformation state you want to keep?
 

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
Ohh thank you so much Trihan! I would really appreciate it! ^_^ :) Btw, umm, there are kinda multiple transformation states I made is it okay? >.< Ill go to my pc in a bit to get the ID's. :)
 

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
So the ID's of the transformation states that I wish kept even in death are ID numbers 76 - 93! Yep, all from 76 straight to 93 are transformation states that I wish to persist even in death. xD Its indeed a lot
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,374
Reaction score
1,550
First Language
English
Primarily Uses
RMMV
It's cool, I can explain that with a sample set. Edit: since you have such a range, do this instead.

Code:
Game_BattlerBase.class_eval do
  def clear_states
    first_state = 76
    last_state = 93
    if @states
      new_states = @states.select { |state| state >= first_state && state <= last_state }
      @states = new_states
    else
      @states = []
    end
    @state_turns = {}
    @state_steps = {}
  end
end
If you add that as a new script, it'll retain any states from first_state to last_state inclusive.
 

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
OMG!!! <3 Thank you so much Trihan! ^_^ I'll give this a try ASAP and see how it goes! :) I'll let you know what happens! :D
 

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
Okay, so I have a good news! The script works in that the state persists even in death, and it stays after revived! <3 ^_^ :)

Sadly, there's a bad news >.< After the actor goes through the process of being killed, and then revived, he will have the state still, yes, but everytime the newly revived transformed actor gets killed again or is healed by someone.. This error occurs :(



Im not sure if script position is a problem? Since I put the new script above main as I would any script. But its at the most bottom compared to other scripts, so I hope that didnt cause some issues too. x(

Thanks so much for any help! ^_^
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,374
Reaction score
1,550
First Language
English
Primarily Uses
RMMV
When that error happens and you open the script editor, what line does it jump to?

Edit: nvm, got it. It's because it's trying to access an element of state_turns that no longer exists. Here's the amended script:

Code:
Game_BattlerBase.class_eval do
  def clear_states
    first_state = 2
    last_state = 6
    if @states
      new_states = @states.select { |state| state >= first_state && state <= last_state }
      @states = new_states
      new_turns = @state_turns.select { |key, value| key >= first_state && key <= last_state }
      @state_turns = new_turns
      new_steps = @state_steps.select { |key, value| key >= first_state && key <= last_state }
      @state_steps = new_steps
    else
      @states = []
      @state_turns = {}
      @state_steps = {}
    end
  end
end
 
Last edited:

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
Ohh! thanks so much again Trihan! I'll try it again ASAP and see how it goes! ^_^ :)
 

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
Wow!! It worked wonders now! ^_^ :) It no longer errors like that! :D Thanks so much again @Trihan ! <3 This is such a big help to me!! :D ^_^ Im putting you in my credits! <3
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,374
Reaction score
1,550
First Language
English
Primarily Uses
RMMV
I think I'm in basically everyone's credits at this point. XD
 

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
Ahaha well you deserve it for being one of the people who is such a great help for those with script probs! XD :D <3
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,402
Reaction score
499
First Language
English
Primarily Uses
RMVXA
Glad Trihan got it working for you.
But...
A little bit of google and we find this...
 

Starmage

Veteran
Veteran
Joined
Apr 2, 2016
Messages
679
Reaction score
733
First Language
FIlipino
Primarily Uses
N/A
Ohhh! I did find that before, but the Hime script was incompatible with my games scripts and it gave errors :( And I was kinda hesitant on bothering Himale about incompatibilities which is why I kinda decided to ask help from here. I hope it makes sense. xD
 

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

Latest Threads

Latest Posts

Latest Profile Posts

*sigh* I'm so sick of this heat! :kaosigh::kaoeh:

Between Rona and MZ, might as well buckle down and get serious in dev
I did it. I finish the test after 2 days 6 different subjects. Now I'm freeeeeeee
Got a nice little platform coming along backwards compatible with MV.

Forum statistics

Threads
100,659
Messages
978,206
Members
132,280
Latest member
ju9SW
Top