Equip a weapon/armor using JS

Lady_JJ

Villager
Member
Joined
May 6, 2019
Messages
22
Reaction score
6
First Language
English
Primarily Uses
N/A
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
210
Reaction score
180
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

Villager
Member
Joined
May 6, 2019
Messages
22
Reaction score
6
First Language
English
Primarily Uses
N/A
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

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,339
Reaction score
591
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

Villager
Member
Joined
May 6, 2019
Messages
22
Reaction score
6
First Language
English
Primarily Uses
N/A
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
210
Reaction score
180
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

okay, i experimented with some more fonts, let me know if theyre easier to read and if you have a preference!

Hiatus; Still doing my best to get employed. :hwink:
Finally took the plunge and got myself MV. Time for some productivity!
Not more Goblins but variations of the Irish Merrow this time...

Okay so now you can prepend a JS library to your Haxe plugin. You can also prepend your attribution information to every compiled plugin.

Forum statistics

Threads
99,169
Messages
962,577
Members
130,744
Latest member
slatlift
Top