(VX Ace) States that retain even in death!

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!
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.
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? 😮 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
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?
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. 🙂
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
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.
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! 😀
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 🙁

b6dng3b.png


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! ^_^
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
Ohh! thanks so much again Trihan! I'll try it again ASAP and see how it goes! ^_^ 🙂
Wow!! It worked wonders now! ^_^ 🙂 It no longer errors like that! 😀 Thanks so much again @Trihan ! <3 This is such a big help to me!! 😀 ^_^ Im putting you in my credits! <3
I think I'm in basically everyone's credits at this point. XD
Ahaha well you deserve it for being one of the people who is such a great help for those with script probs! XD 😀 <3
Glad Trihan got it working for you.
But...
A little bit of google and we find this...
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
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.
Do you have something similar but where I pick various states rather than a range? This would be awesome for states like "acid rain" which applies a DoT to the party and remains until the end of battle.


Please and thank you.
Do you have something similar but where I pick various states rather than a range? This would be awesome for states like "acid rain" which applies a DoT to the party and remains until the end of battle.


Please and thank you.
Try this:

Game_BattlerBase.class_eval do
def clear_states
post_mortem = []
if @states
new_states = @states.select { |state| post_mortem.include?(state)}
@states = new_states
new_turns = @state_turns.select { |state| post_mortem.include?(state)}
@state_turns = new_turns
new_steps = @state_steps.select { |state| post_mortem.include?(state)}
@state_steps = new_steps
else
@states = []
@state_turns = {}
@state_steps = {}
end
end
end

Put states id in post_mortem. For example: post_mortem = [2, 3, 4]

@guts_cearense, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-states-that-retain-even-in-death.123798/