I am setting up an event and I find that I need to be able to check if an actor; based on a variable, does not have a skill. So my question is this.
How would I set up in the conditional branch script call a script that checks the actor, based on a variable I set up earlier in the event, and finds if they do not have a skill?
Thank you for any help.
In a script call in conditional branch, use this.
$gameParty.members()[0].skills().indexOf($dataSkills[$gameVariables._data[4]]) >= 0;
this will check party member with the index of 0, for the skill with the Id of variable #4.
weird, the numbers keep disappearing but anyways.
$gameVariables._data[variable id]
stick that inside the brackets for $gamePart.members, just like I did with $dataSkills, and the player checked will be the index of whatever variable ID you specify.
edit: just remember, the index starts with 0, so the top party member, will always be 0, the one below him 1 etc etc.
edit2: oh yeah, and if the variable isn't specified(or the variable is not a party member that doesnt exist) then you'll get an error.
Can you copy paste the codeyou typed into the conditional branch for me plz? 🙂
what number is the variable 489 set to?
and what number is 486 set to,
can you try using a script call before the conditional branch, with this in it.
console.log($gameVariables._data[489]);
and make another one, using,
console.log($gameVariables._data[486]);
then check the console, and the top number shown should be 489, the bottom 486, make sure that these numbers are between(for actors variable, if your party size is 4) 0 and 3, and for skill variable, make sure its within 0 to however big your skill list is.
also you've got the end wrong the code should be, $gameParty.members()[$gameVariables._data[489]].skills().indexOf($dataSkills[$gameVariables._data[486]]) >= 0
(or maybe the forum cut out the 0, that's what happened in my first post lol), anyways I just tested this out myself, and didn't have any error, so I think one of the variables might be off. just make sure to add the 0 at the end if it's not there lol.
$gameParty.members() checks how many actors are in your party currently, if you only have 1 actor in your party, using a value of 1 would cause an error, you'd need to use 0,
$gameParty.members() works differently than $gameActors, if you want to get a specific actor, not a party member use $gameActors._data[actorID] for example, using your actor list above, if you wanted to check the actor Lilly, to see if they have skill ID 5 you'd use
$gameActors._data[10] .skills().indexOf($dataSkills[5]) >= 0
apologies maybe I should have told you to use gameActors first, not sure what I was thinking xD also sorry again for not using the code boxes, but for some reason they're not working exactly right?(at least not on my end not sure if it's just me or.. ._.)
kk, glad that worked out, but yeah, if you're only trying to get a specific actor, it's better to use $gameActor._data, rather than $gameParty.members(), they both return an actor, but $gameParty.members, will only get actors if they are in the party, and it will return them by the partys index, not the actor id, so if your party is something like this(using default actors).
Going from the top of the party list to the bottom
Lucius(actorID 4)
Harold(actorID 1)
Marsha(actorID 3)
Therese(actorID 2)
$gameParty.members()[0] would return Lucius
$gameParty.members()[1] would return Harold
$gameParty.members()[2] would return Marsha
$gameParty.members()[3] would return Therese
hopefully this makes sense ._.; apologies if not, maybe someone can explain it better, I've never been good at explaining things xD