ID:179678
 
I'm on the equipment issue right now.
I'm trying to add a click proc where when you click on
a weapon, it equips it and when you click on it again, it unequips.
I have something like this :

obj/weapons
var
attack
basetype
Click()
set src in usr
if(usr.rhand == "") //this should equip it
usr.rhand = src
usr.rhandtype = src.basetype
usr.attack += src.attack
else
alert("Something is equip already!","Oops")

if(usr.rhand == src) //this should unequip it
usr.rhand = ""
usr.rhandtype = ""
usr.attack -= src.attack
else
alert("You don't have it equip!","Oops")


It compiles well ( so i have all the var and stats good), but i can't seem to be able to equip something.
Any ideas, suggestions ?

THX.
make sure rhand = ""

thats important

plus, in your proc, you have both the equip and unequip code, meaning it equips it, then it sees that its in your hand, and unequippes it

you will have to add a return 0 in the middle of the two.
In response to FIREking
I forgot to ask how to put a class restriction for each
weapon and armor.
Anyone know ?

Also, about my previous post, it still buggy after i added the return 0. When i have 2 weapons, i can equip both.

THX.
In response to Cravens
Cravens wrote:
I forgot to ask how to put a class restriction for each
weapon and armor.
Anyone know ?

Also, about my previous post, it still buggy after i added the return 0. When i have 2 weapons, i can equip both.

THX.

Check out istype()