Script call not working?

Alright, so, this shouldn't be as much of a problem as it is, but i'm not great with scripting and i'm a little confused.
I'm using the script call to Change Equipment of an actor, where both the actor and the equipment are decided by variables.
The string of code looks like this:

$gameActors.actor($gameVariables.value(0001)).changeEquip(03, $dataArmors[$gameVariables.value(0003)]);

Where Variable 0001 gets the actor's index # while variable 3 gets the equipment's index #.
The thing is that this string doesn't seem to work at all. It's not even giving me an error!
So i tried something that could not possibly go wrong:

$gameActors.actor(0001).changeEquip(03, $dataArmors[0001]);

And this should change Actor 0001's third equipment slot to Armor 0001
But it still appears not to run at all.
I'll post a couple of screens from my project so i can give you a better idea of how i have got things set up.

I really hope this is the right place to ask this question. I don't want to mess up again.

1.png

2.png

3.png

4.png
Never ever use leading zeroes to reference values when scripting.


Example:  $gameVariables.value(1)  not  $gameVariables.value(0001)


It's possible there are other problems going wrong here as well, but this one is the most obvious to me.
Are you counting 3 as the third equipment slot or the third armor slot?


Because equipment slots are 0 indexed, with 0 being weapon, 1 being the second slot (which would be the first armor slot) etc. So, to do the 3rd equipment slot it would be 2, to do the 3rd armor slot it would be 3.
It's the third equipment slot.
I went along with the indexes in the Equipment Types list, so i put 3 since "Boon & Bane" is the 3rd equipment type after Weapon and Trinket
All classes are able to equip the "Character" Armor Type, and all armors from n°1 to n°56 are of that type, so i expected the third equipment slot to get filled.
I just tried changing that to 2 instead of 3 and it still didn't seem to work
Have you checked that your variables your using in the script call do actually have a value?


Put a show text event before your script call and list your variables in there which you want to use the value of with \v[x] with x being the number of the variable (without leading 0's)


The syntax looks okay as far as I can see (compared it to something of mine doing a similar things and looks identical) so apart from checking the variable value, I'm out of ideas. Maybe someone else who has more knowledge can see something if the above doesn't work.
I put a message with "\V[3]" in it to show me the value of Variable n°3, and... Yup, the Variable n°3 definitely has a value right before the check. Still doesn't work.
This is the string i have now, but really i didn't change much besides the removal of the zeroes.

$gameActors.actor($gameVariables.value(1)).changeEquip(3, $dataArmors[$gameVariables.value(3)]);

I used the script calls from this spreadsheet right here, and it says that the string should be:

$gameActors.actor(actorId).changeEquip(slotId, item);

where

item = $dataWeapons[n] or $dataArmors[n]


I can't help but feel like the "slotId" part is what's messing me up, here, but as i said, i am still a novice when it comes to programming/scripting.
Do you have the armor that your trying to equip in the inventory before you run the script call?
Apparently that was the problem.
Also, you were right about the index numbers for equip slots. Indeed, Weapon is counts as 0 and not 1. I wish the editor wasn't so misleading about it.
For anyone who might be interested, this is the portion of code which actually functions.

$gameParty.gainItem($dataArmors[$gameVariables.value(3)], 1);


$gameActors.actor($gameVariables.value(1)).changeEquip(2, $dataArmors[$gameVariables.value(3)]);

This code gives the player 1 piece of the Armor whose index number is equal to Variable n°3, then proceeds to equip said armor to the Actor whose index number is equal to Variable n°1, in the 3rd slot from the top, since the Weapon slot is the slot number 0.
Cool, glad it worked out 😀
Yeah, thanks a lot! Your help was greatly appreciated : ]

Original thread: https://forums.rpgmakerweb.com/threads/script-call-not-working.67634/