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
223
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,419
Reaction score
672
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
223
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

Quexp wrote on Shaz's profile.
I absolutely love your profile/pic! :kaoluv:
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
I made a battle results screen for my minigame.. any feedback? :)
Things I thought would never happen but just did: I needed to use my snow shovel. In August. In the Northern Hemisphere.
So I finished Cupcake, now I need to figure out my next project!
Do I pick up one of my incomplete games?
Do I start something entirely new???
The possibilities are endless!

Forum statistics

Threads
100,682
Messages
978,380
Members
132,307
Latest member
secasus
Top