ID:147135
 
I'm having a little problem with my Equiping code in my game. The problem is pretty simple. Its not recognizing the Weapons Vars. I don't know why or how to fix the problem.
obj
Weapon/Hand
Rusted_Tin_Knuckles2
name = "Rusted Tin Knuckles"
icon = 'Weapons.dmi'
icon_state = "RustedTinKnuckles"
var
Strength = 2
Equipped = 0
Hand = 0
verb
Get()
set src in oview(1)
usr.LockMovement = 0
usr.opened = 0
usr. << "You picked up the [src.name]!"
usr.contents += src
return
Click()
if(usr.opened == 1)
return
else
if(src in usr.contents)
usr.LockMovement = 1
usr.opened = 1
Equip()






obj
proc
Equip()
switch(input("What would you like to do?","[src.name]")in list("Equip", "UnEquip", "Nothing"))
if("Equip")
if(src.suffix == "Equipped")
usr << "[src.name] is already Equipped!"
usr.opened = 0
usr.LockMovement = 0
else if(istype(src,/obj/Weapon/Hand))
switch(input("Where would you like to Equip it to?","[src.name]")in list("Left Hand","Right Hand","Don't Equip"))
if("Left Hand")
if(usr.LeftHand == "nothing")
usr.LHandWeap += src.Strength
src.suffix = "Equipped"
src.Equipped = 1
usr.LeftHand = "[src.name]"
usr << "You Equipped the [src.name]!"
src.Hand = "Left"
usr.opened = 0
usr.LockMovement = 0
else
usr << "Something is already Equipped to this hand!"
usr.opened = 0
usr.LockMovement = 0



the Error Message that I'm getting is

loading New ORPG.dme
Weapons.dm:46:error:src.Strength:undefined var
Weapons.dm:48:error:src.Equipped:undefined var
Weapons.dm:51:error:src.Hand:undefined var

New ORPG.dmb - 3 errors, 0 warnings (double-click on an error to jump to it)
This equipment system has a big design flaw. You need to have a var belonging to the mob that points to the weapon in use, or null for none. Giving the weapon its own Equipped var will only lead to problems.

Lummox JR
In response to Lummox JR
I got everything working. I just don't know if there anythings in here that could cause problems later on. Here's what the code looks like now.
obj
Weapon/Hand
Rusted_Tin_Knuckles2
name = "Rusted Tin Knuckles"
icon = 'Weapons.dmi'
icon_state = "RustedTinKnuckles"
verb
Get()
set src in oview(1)
src.suffix = ""
usr.LockMovement = 0
usr.opened = 0
usr. << "You picked up the [src.name]!"
usr.contents += src
return
Click()
if(usr.opened == 1)
return
else
if(src in usr.contents)
usr.LockMovement = 1
usr.opened = 1
usr.BeingStrength = 2
usr.BeingEquiped = src.name
if(src.suffix == "")
usr.BeingHand = "Nothing"
Equip()
else
if(src.suffix == "Equipped (Left)")
usr.BeingHand = "Left"
Equip()
else if(src.suffix == "Equipped (Right)")
usr.BeingHand = "Right"
Equip()






obj/proc
Equip()
switch(input("What would you like to do?","[src.name]")in list("Equip", "UnEquip", "Nothing"))
if("Equip")
if(usr.BeingHand == "Nothing")
if(istype(src,/obj/Weapon/Hand))
switch(input("Where would you like to Equip it to?","[src.name]")in list("Left Hand","Right Hand","Don't Equip"))
if("Left Hand")
if(usr.LeftHand == "nothing")
usr.LHandWeap += usr.BeingStrength
src.suffix = "Equipped (Left)"
usr.LeftHand = "[src.name]"
usr << "You Equipped the [src.name]!"
usr.opened = 0
usr.LockMovement = 0
else
usr << "Something is already Equipped to this hand!"
usr.opened = 0
usr.LockMovement = 0