So I have a character selection system that lets the player choose between several different actors. When they choose a character, the actor ID is stored into a variable. I can't condense these into one actor ID and simply change the images/class/etc, because all the actors they don't choose will show up in the game as NPCs that can temporarily join the party for missions and such. So yes, I need multiple actors with different IDs ^_^
That said, when I need to make something happen to the "main" actor (like applying a state, etc), I can usually do it by using the default buttons and just identify the target actor by using the variable their ID is stored in. But sometimes that's not an option with the buttons. For example, I'm trying to make a conditional branch checking if the player has X weapon equipped. But in the conditional branch window, the buttons only allow me to choose a specific actor and not identify them using a variable. So, I've been trying to figure out what script to use to make this happen. I'm pretty sure I've got the identifying the actor part right:
when Variable 44 = chosen actor ID
$gameActors.actor($gameVariables.value[44])
It's the checking the equipped weapon part that I can't figure out. I've scoured Google and forums and found like 3 or 4 different scripts and I've tried them all and it always crashes and says it's unable to read a property (i.e. 'isWtypeEquipped' or 'equips') of "null", even when the actor DOES have the weapon equipped.
From several different sites/forums, I've found and tried:
$gameActors.actor($gameVariables.value[44]).isWtypeEquipped(1)
and
$gameActors.actor($gameVariables.value[44]).equips()[1]
and
$gameActors.actor[$gameVariables.value(44)].equips[1].id == 1
and
$gameActors.actor[$gameVariables.value(44)].equips[1] && $gameActors.actor[$gameVariables.value(44)].equips[1].id == 1
and
$gameActors.actor($gameVariables.value[44]).equips()[1] && $gameActors.actor($gameVariables.value[44]).equips()[1].id == 1
I really have no experience with JavaScript but I'm trying so hard to understand. What's hard is I can get the gist of why something is how it is, but I can't use common sense to just guess what a script should be because of all the specific syntax and punctuation and all that I don't know. It could be that all those scripts are totally wrong, or just one thing is off in one of them, or I could be using the wrong IDs for something (I've seen there's something weird about equipment IDs like they do or don't start at 0 but then also something about the equipment slots and they don't match up with the database or something??) It just all goes over my head.
Please help me *o*
I just want to be able to check if an actor (ID defined by variable) has a specific weapon equipped in a conditional branch. Lol, I feel like that should be one of the most simple things ever, but it's giving me so much trouble it's now one of the only two RPG Maker things that have utterly stumped me in my year of working with it so far.
Thank you in advance! If the above code examples aren't enough and you need screenshots, please someone let me know and I can gather those together.
P.S. If this has already been answered somewhere, please link me to it, and sorry for posting! I've been digging for a couple hours and seriously haven't found anything that works.