Equip a weapon/armor using JS

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
46
Reaction score
22
First Language
English
Primarily Uses
RMMV
I've been searching for days and have found many threads dealing with looking to see if a particular was equipped, or if a particular weapon is equipped then do this else do that, but there is only one thread I can find that deals with the simple equip this weapon.

This method coincides exactly with the RMMV Script Calls - Google Sheet (see row 55).

But I can't get it to work. My experience with JS is so-o-o-o- newbie... Here is what I have


1589723337974.png

Do I not have it properly written in 'Script' or should I have it written elsewhere / in another fashion? Thank you.
 
Last edited:

SeaPhoenix

Veteran
Veteran
Joined
May 14, 2015
Messages
222
Reaction score
191
First Language
English
Primarily Uses
RMMV
In your script call $gameActors.actor(1).changeEquip(0, 5) it should be $gameActors.actor(1).changeEquip(0, $dataWeapons[5]) instead.

Or since you're using variable 3 to store of the value of the weapon id, you can also use $gameActors.actor(1).changeEquip(0, $dataWeapons[$gameVariables.value(3)]) if you want to refer to the weapon id by variable number instead.
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
46
Reaction score
22
First Language
English
Primarily Uses
RMMV
Oh my word! I thought I had tried the $dataWeapons[5] and since that didn't work (maybe a typo on my end?), I chose to forego the variable and go straight to the literal. I am grateful to you for sending me back to $dataWeapons[5], and even moreso for showing me how to use a stored variable to re-equip. It's exactly what I needed. Thank you so much.

@SeaPhoenix As an aside, I just bought/downloaded The Lost Art of Innkeeping last night and I'm really looking forward to playing it.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
671
First Language
Portuguese - Br
Primarily Uses
RMMV
Ops! Sorry, someone already answers that ^^''
----
Hi there!
Yeah, these script calls are not so intuitive to use. I'm already making a plugin that simplifies that.

But the correct script call for you to use is that one:
$gameActors.actor(1).changeEquip(0, $dataWeapons[1])

you have to use $dataWeapons[ID] or $dataArmors[ID] etc..
 

Lady_JJ

Veteran
Veteran
Joined
May 6, 2019
Messages
46
Reaction score
22
First Language
English
Primarily Uses
RMMV
Thanks to you, Eliaquim, as well. I did go back to the Google doc sheet and saw that I had completely missed the instruction to use $dataWeapons(x) and not just x as item. One more tiny step in the learning curve for me....
 

SeaPhoenix

Veteran
Veteran
Joined
May 14, 2015
Messages
222
Reaction score
191
First Language
English
Primarily Uses
RMMV
Glad that worked, @Lady_JJ! Thanks for letting me know too that you bought the game... I hope you enjoy it! :smile:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

When you discover great tileset resources that you completely forgot that you had. :kaomad3::kaopride:
Just got a better look at the MZ RTP. I'm very happy with it, especially the sci-fi tiles and sprites. Glad I pre-ordered.
I've just checked the VisuStella Plugins for MZ and there are already 11 plugins. The Yanfly team(perhaps a big one?) really works so effectively and efficiently that some MZ users can likely use tons of Yanfly plugins right after MZ's released (still 13 days from now). I wonder if any other plugin developer(or team) will try to compete with Yanfly this time, no matter how slim the chance to win is :)
Hello! :kaopride:I am new to RPG Maker, though I have been lurking the forums for a while. :kaoswt: Hope to make some friends and learn some stuff here! :kaothx:
And now since I've got the whole game parts working, the *contents* await.

Forum statistics

Threads
100,594
Messages
977,582
Members
132,194
Latest member
linkvaovn88com
Top