Is there any script call to check if an actor exists in general for battle_members?. I tried using $game_party.battle_members[2].exist? and it errors me out telling me thaat exists is undeclared.
Check to see if member exists
RPG Maker VXAce Supportjust drop the exists? part. if you simply do $game_party.battle_members[2] it will return true if it exists or false if it is nil
Thanks that did work, didn't think it was so simple
Why are you trying to do it via script? The Conditional Branch lets you check to see if an actor is in the party.
Are you trying to find out if a particular ACTOR is in the party (or an active battler), or just if there is a person in slot 2?
Are you trying to find out if a particular ACTOR is in the party (or an active battler), or just if there is a person in slot 2?
I could use the script call to check if an actor exists in the party (yes, it has to be part of a script, not an event)
For some reason it got left out of Archeia's event --> script call list (or at least I can't find it)
Edit: Specifically I need the conditional for:
def make_command_list
party_symbol = { # the hash table to push actors onto the shop choice screen
Sofia: "Sofia",
Lyrra: "Lyrra",
Jaxl: "Jaxl",
Mitzi: "Mitzi",
}
i=1
party_symbol.each do |k, v|
if <insert the conditional here> <--------------------- check for each actor's existence in party
add_command(v, k) i is incrementing index variable if needed
end
i+=1
end
end
More Edit: Ruby 1.9 (which RGSS 3 uses) guarantees the insertion order of a hash, so iterating the hash table I created should match the actor id's. Even if it doesn't, I should get some output, but I can't find a conditional to give me any (if I use 'true' then all four pop into place, so I just need the right conditional)
Even MOAR Edit: I've (finally) got it working using this: if $game_party.members.index($game_actors)
but it seems like there should be a more elegant or direct way to check...
For some reason it got left out of Archeia's event --> script call list (or at least I can't find it)
Edit: Specifically I need the conditional for:
def make_command_list
party_symbol = { # the hash table to push actors onto the shop choice screen
Sofia: "Sofia",
Lyrra: "Lyrra",
Jaxl: "Jaxl",
Mitzi: "Mitzi",
}
i=1
party_symbol.each do |k, v|
if <insert the conditional here> <--------------------- check for each actor's existence in party
add_command(v, k) i is incrementing index variable if needed
end
i+=1
end
end
More Edit: Ruby 1.9 (which RGSS 3 uses) guarantees the insertion order of a hash, so iterating the hash table I created should match the actor id's. Even if it doesn't, I should get some output, but I can't find a conditional to give me any (if I use 'true' then all four pop into place, so I just need the right conditional)
Even MOAR Edit: I've (finally) got it working using this: if $game_party.members.index($game_actors)
but it seems like there should be a more elegant or direct way to check...
Original thread: https://forums.rpgmakerweb.com/threads/check-to-see-if-member-exists.25196/