[XP] states that inflicts another state

i want a script that a state will inflict another state after the first state has been removed.

for example:
Actor #1 is inflicted with [Fury] for 3 turns
when [Fury] effect is gone after 3 turns, inflict [Tired]
Actor #1 will became [Tired] when his [Fury] state is gone

i seen scripts like that for VX (Ace) and maybe MV
if only there is something like that on XP.
What I'm about to say won't always be true, but that might depend on what kind of battle system and other addons you're currently using. So what battle related scripts are you currently using in your game?
This might help you avoid getting strange issues for lack of script compatibility...
You may want to work with the Game_Battler 2 script, as that has all the stuff for inflicting status effects.
It's the remove_state defs you want to work with.

You will want to add something like this to a remove_state def:
Ruby:
  def remove_state(state_id, force = false)
    # If this state is added
    if state?(state_id)
      # If a forcefully added state is not forcefully removed
      if @states_turn[state_id] == -1 and not force
        # End Method
        return
      end
      # If current HP is at 0 and options are effective [regarded as HP 0]
      if @hp == 0 and $data_states[state_id].zero_hp
        # Determine if there's another state [regarded as HP 0] or not
        zero_hp = false
        for i in @states
          if i != state_id and $data_states[i].zero_hp
            zero_hp = true
          end
        end
        # Change HP to 1 if OK to remove incapacitation.
        if zero_hp == false
          @hp = 1
        end
      end
      # Delete state ID from @states and @states_turn hash array
      @states.delete(state_id)
      @states_turn.delete(state_id)
    end
    # Check maximum value for HP and SP
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
      
    #TRY ADDING THIS:
    # Add other states upon removal
    if state_id == #Insert ID of state that inflicts another state here
        add_state(#Insert ID of the state that is inflicted here)
    end
  end
@BloodSoakedPuppeteer98
i tested it, and it worked!
thank you!
Well, my plan was to let him learn to provide some basic information first...
There's something you should know about that piece of code. If a state was removed because of getting hit or some other common reason, and you happened to let the state be the same as one of those that you wanna replace with another one, it will get replaced as well.
Since I'm not expecting you to be a pro in scripting, OP, I gotta warn you that if for any weird or unforeseen reason you call remove_state(1) for instance and it's not removed, but 1 matches the State ID that will be replaced automatically, you'll end up with an actor or monster with a state that came out of the blue...
@kyonides
well whatever you say, that addison work anyway
(btw you never answered my question about how the KEndure script exactly works,
like does the endure effect activates once per battle or something?)
Just make sure that you never activate it by mistake, that's all I want you do keep in mind. Even so the addition of such condition would be a good thing.
Just in case you didn't know, you can make a condition like...

Code:
if [ID1, ID2, ID3].include?(state_id)
  add_state(custom_state_id)
end

It uses an array to check out if the current State ID matches any of those you set up in the array. This is convenient if a few states should share the same end state after the original one gets removed.

P.S.

I know. XP
bump!

i've added a despair state from persona 5,
where the despaired person loses 5% SP every turn and dies at the 3rd turn
1600604871457.png

1600605006918.png

1600605122728.png


i believe that that code in Game_Battler 2 has this weird issue
and look what happens here.
im gonna make Litten frozen at Turn 0
1600605361008.png


and...

1600605400261.png

whaaaaaaaaat???

i think theres a bug where a battler gets instantly fainted,
cuz of the "Regard as HP 0" thing?
or cuz of the self.hp = 0 thing, cuz i tested with that too?
or maybe it does this when a different state is applied and not the despair state?
i dunno, im not a programmer.
anyways, if anyone knows how to fix this, let me know.
bump!

i've added a despair state from persona 5,
where the despaired person loses 5% SP every turn and dies at the 3rd turn
View attachment 161281
View attachment 161282
View attachment 161283

i believe that that code in Game_Battler 2 has this weird issue
and look what happens here.
im gonna make Litten frozen at Turn 0
View attachment 161284

and...

View attachment 161285
whaaaaaaaaat???

i think theres a bug where a battler gets instantly fainted,
cuz of the "Regard as HP 0" thing?
or cuz of the self.hp = 0 thing, cuz i tested with that too?
or maybe it does this when a different state is applied and not the despair state?
i dunno, im not a programmer.
anyways, if anyone knows how to fix this, let me know.
Does the Frozen state have "Regard as HP 0" checked?
Becuase "Regard as HP 0" will make actors faint.
Does the Frozen state have "Regard as HP 0" checked?
Becuase "Regard as HP 0" will make actors faint.
1600675486130.png

Nope. just regular Frozen state.
i think it has something to do about the
other states that have "Regard as HP 0" enabled.
you know, the usual Fainted state,
and the two other Fainted states for the Light and Dark insta-kills from the Persona Series.

P.S.
btw, how do i add in states where an actor has learned a skill?
example:
where Litten has Regenerate 1 from level up, and he's regenerating 2% HP per turn.
and thats coming from a state.
its about like...
Ruby:
if skill_id_learn? == 190 # Regenerate 1 Skill ID
        add_state(55) # Regenerate 1 State ID
    end
  end
or something like that.

and also how does a state like that regenerates HP/SP?
here is the anwser
1600680814064.png

------------------------
55, 56, and 57
are Regenerate 1/2/3
------------------------
59, 60, and 61
are Invigorate 1/2/3
------------------------
Nope. just regular Frozen state.
i think it has something to do about the
other states that have "Regard as HP 0" enabled.
Are you sure the Frozen state has nothing to do with any of the other states that cause fainting, or that it doesn't inflict any states that cause fainting?
Are you sure the Frozen state has nothing to do with any of the other states that cause fainting, or that it doesn't inflict any states that cause fainting?
my guess is that where, if that battler does not have despair
and has other states (like frozen), it will give them 0 HP regardless.
(or something like that)



and btw, you did answer my question of this.
P.S.
btw, how do i add in states where an actor has learned a skill?
example:
where Litten has Regenerate 1 from level up, and he's regenerating 2% HP per turn.
and thats coming from a state.
its about like...
Ruby:
if skill_id_learn? == 190 # Regenerate 1 Skill ID
add_state(55) # Regenerate 1 State ID
end
end
or something like that.

and also how does a state like that regenerates HP/SP?
here is the anwser
1600680814064.png

------------------------
55, 56, and 57
are Regenerate 1/2/3
------------------------
59, 60, and 61
are Invigorate 1/2/3
------------------------
@BloodSoakedPuppeteer98
hey! are you even there???

Original thread: https://forums.rpgmakerweb.com/threads/xp-states-that-inflicts-another-state.124668/