Equipping weapon with script

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
I know this is not the usual way to equip a weapon, the reason I am using this method is down to the user being able to select a Class for the character before the game begins. The weapon to be equipped cannot be used by each class.
Code:
  ◆Script:$gameActors.actor(1).changeEquip(1, $dataWeapons[22]);
This is the script which according to the MV Script call list should work. The weapon is just removed entirely however, I also cannot find it in the inventory or item book, despite this coming after
Code:
  ◆Change Weapons:Spear + 1
The spear is weapon 22 in the database, equip 1 is for weapons.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,088
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
changeEquip's first argument is slotId, not the equip type ID; slotId starts counting from 0, so try replacing the 1 with a zero. :)

That said, this all seems possible with eventing. Conditional Branch > Actor > Class to check the actor's class, then Change Equipment in each of the branches as appropriate.
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
changeEquip's first argument is slotId, not the equip type ID; slotId starts counting from 0, so try replacing the 1 with a zero.
You were right, thanks. Changing slotID to 0 fixed it.
That said, this all seems possible with eventing. Conditional Branch > Actor > Class to check the actor's class, then Change Equipment in each of the branches as appropriate.
I have that check before the weapon is given to the player. It still does not let me select the spear from the dropdown menu.
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,088
Reaction score
1,508
First Language
EN
Primarily Uses
RMMZ
I have that check before the weapon is given to the player. It still does not let me select the spear from the dropdown menu.
Oh, yes, I'd forgotten about that quirk in the editor. :kaosigh:

Happy RPG Making! ^_^
 

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top