[XP] states that inflicts another state

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
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.
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
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...
 
Joined
Oct 26, 2018
Messages
21
Reaction score
3
First Language
English (AUS)
Primarily Uses
RMXP
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
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
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...
 

MarioWidjaya123

Veteran
Veteran
Joined
May 16, 2020
Messages
103
Reaction score
2
First Language
English
Primarily Uses
RMXP
@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?)
 

kyonides

Veteran
Veteran
Joined
Nov 17, 2019
Messages
131
Reaction score
29
First Language
English
Primarily Uses
RMXP
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
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Besides my Might and Magic inspired project, I have always wanted to make a Fire Emblem-like game. Time is the culprit... Between life, composing music packs, and working on a game can it be done!? The tactical plugins for MV work quite well based on what I have tested.
Yaaay! My second public script is out and approved! A VX Ace Final Fantasy IX styled Throw Script!

I look forward to all the constructive feedback I get but most importantly I hope everyone who ends up using it enjoys!

Yaaaay! Making scripts is fun lol. :D
When you're lost out therrrrre and you're alllll alone, ahwahwah waitin, to carry you hooooommmme, uhhheverywhere you look! (someone hit me with those backing vocals)
X.X cant focus... too many thing want do... help!
Day 2 of teaching MV, student can move cat across the map.

Forum statistics

Threads
100,525
Messages
976,813
Members
132,080
Latest member
nwr
Top