Newquaza 96

Veteran
Veteran
Joined
Sep 5, 2014
Messages
35
Reaction score
6
First Language
Italian
Primarily Uses
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
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,859
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

beenbaba

Slowly getting there
Veteran
Joined
Apr 28, 2015
Messages
289
Reaction score
159
First Language
English
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.
 

Newquaza 96

Veteran
Veteran
Joined
Sep 5, 2014
Messages
35
Reaction score
6
First Language
Italian
Primarily Uses
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
 

beenbaba

Slowly getting there
Veteran
Joined
Apr 28, 2015
Messages
289
Reaction score
159
First Language
English
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.
 

Newquaza 96

Veteran
Veteran
Joined
Sep 5, 2014
Messages
35
Reaction score
6
First Language
Italian
Primarily Uses
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.
 

beenbaba

Slowly getting there
Veteran
Joined
Apr 28, 2015
Messages
289
Reaction score
159
First Language
English
Do you have the armor that your trying to equip in the inventory before you run the script call?
 

Newquaza 96

Veteran
Veteran
Joined
Sep 5, 2014
Messages
35
Reaction score
6
First Language
Italian
Primarily Uses
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.
 
Last edited by a moderator:

beenbaba

Slowly getting there
Veteran
Joined
Apr 28, 2015
Messages
289
Reaction score
159
First Language
English
Cool, glad it worked out :D
 

Newquaza 96

Veteran
Veteran
Joined
Sep 5, 2014
Messages
35
Reaction score
6
First Language
Italian
Primarily Uses
Yeah, thanks a lot! Your help was greatly appreciated : ]
 

Latest Threads

Latest Profile Posts

Hi everyone! Enjoying this nice long weekend. How are you all doing? :)
I just successfully tested having events check if specific actors are in a particular party slot and then changing image to match. This will let me make scenes take into account who is in the party at the time and arrange them accordingly - this is important since I'll have extra actors beyond current party. The script used is the same from MV and is compatible with my current core plugin setup in MZ. Thank goodness.
That awkward moment when you're talking about thinking about writing a limited shop stock plugin for MZ and then find out you already wrote one...last May. My memory is so bad.
When I open my project and I'm like, hell yeah.
Some drawings I made in Lapis, one day I intend to involve them in some RPG Maker project.
* maybe two wall frames
*or some sprite flower tiara, or maybe it inspires someone to do something.
bdd19b62e539d17b3b00cc3d63034f7d.jpg

fcca5c8471b34483da8e032cfe579275.jpg

Forum statistics

Threads
118,426
Messages
1,115,866
Members
155,379
Latest member
blooko
Top