Hero won't unequip weapon

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
M-nite
Slime
Posts: 10
Joined: Sun May 21, 2017 2:49 pm

Hero won't unequip weapon

Post by M-nite »

I'm trying to use scripting to have the hero lose their weapon but it doesn't seem to work at all. The script looks like this:

unequip item (0, slot:weapon)
delete item (1, 1)

But the item is still in the weapon slot. Any help would be appreciated.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1242
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

I believe a hero has to have something equipped at all times. You can make an "unarmed" item that you force equip to the hero.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Yes, when there's no weapon equipped, the hero's Default Weapon is shown in the Weapon slot instead. You can't unequip it as it doesn't actually exist. Create a weapon called Unarmed or None and set it as the default.

Strangely, I see that if a non-weapon is set as the Default Weapon, then the hero's default attack is some garbage value (very likely attack 0).
Now that the hero battle menus are flexible and customisable, this requirement to always have a weapon could be removed, I guess.
Last edited by TMC on Sun Jul 02, 2017 12:13 am, edited 1 time in total.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1242
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

Ah, right. What I said wasn't totally accurate. You don't need to force equip the none-weapon, you just need to make it the default and unequip the current weapon. Otherwise, you'll end up with "Unarmed" sitting in your inventory later.
My pronouns are they/them
Ps. I love my wife
Post Reply