Help - Search - Members - Calendar
Full Version: [SOLVED]checking a party memebers status id
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
jayje
i want to set a variable equal to a party member's status id. i tried game_variables[1] = game_party.actors[0].state but nothing happens. any help would be appreciated.

EDIT: this would be used in a call script event.
Logan110
You can have multiple states on a character causing it to be an array. As far as I know thats not going to work as easily as you want.

BTW just add $ before those aka $game_variables[1]
Callista
Is there any state in particular you want to check? If so, you could do something like

CODE
class Game_Party
  def check_state(state,actor)
    actors[actor].states.each{|i| return state if state == i}
    return 0
  end
end


and call it like so:

CODE
$game_variables[1] = $game_party.check_state(2,1)

which would equal variable 1 to 2 if actor 1 has state 2 (default Stun) or 0 if not.

If you're only planning on using one state, a simple

CODE
$game_variables[1] = $game_party.actors[0].states[0]
would suffice.
jayje
If you're only planning on using one state, a simple

CODE
$game_variables[1] = $game_party.actors[0].states[0]
would suffice.
[/quote]

what would that do? check if the state is KO'd
Callista
That would set variable 1 to the first state it finds, which I'm pretty sure is the first one added to the character. Basically, states[] is an array of all the states the actor has, and by calling states[0] you're fetching the first element in the array.
jayje
QUOTE (Callista @ Mar 9 2010, 06:10 PM) *
That would set variable 1 to the first state it finds, which I'm pretty sure is the first one added to the character. Basically, states[] is an array of all the states the actor has, and by calling states[0] you're fetching the first element in the array.

so if i set it to say 2 would it call that state instead?
Callista
$game_party.actors[0].states[2] would get the third state Aluxes has. What exactly are you trying to do?
jayje
i'm trying to create an event that makes a regen effect. i.e if the party member has the regen it heals them by a certain amount
Callista
There's a conditional branch condition that says "state X" inflicted, you can use that.
jayje
QUOTE (Callista @ Mar 9 2010, 06:43 PM) *
There's a conditional branch condition that says "state X" inflicted, you can use that.

that would work if i didn't have a lot of characters.
Logan110
So use a conditional branch that uses script:
$game_party.actors[0].states.include?(1)

jayje
QUOTE (Logan110 @ Mar 10 2010, 05:53 AM) *
So use a conditional branch that uses script:
$game_party.actors[0].states.include?(1)

thanks. that was really helpful.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.