obj
armor
Leather_Boots
icon = 'obj.dmi'
icon_state = "green boots"
var/IN = 0
verb
Get()
set src in oview(1)
src.Move(usr)
Drop()
if(usr.foot == 1)
usr << "First un-equip [src]!"
return
else
src.Move(usr.loc)
Equip()
if(usr.foot == 1)
usr << "You already have [src] on!"
return
if(usr.foot == 0)
usr << "You put [src] on!"
src.suffix = "foot"
usr.foot = 1
return
UnEquip()
if(usr.foot == 1)
usr << "You take off [src]!"
src.suffix = ""
usr.foot = 0
return
if(usr.foot == 0)
return
New()
if(src in usr) return
if(src.IN == 0)
src.loc = locate(0,0,0)
sleep(50)
var/x = rand(1,25)
var/y = rand(1,25)
src.loc = locate(x,y,2)
world << "YES"
src.IN = 1
else
return
Problem description:
What I am trying to do is make a random location for loot in this dungeon when the world starts up. It works, but when my char has already equipped it, when I start the game up again it also randomly locates the boots from my inventory.
That's why it isn't working - src will never be in null, which is what usr is in this case. Instead, you should check what type src.loc has, using the istype() proc. If istype(src.loc,/mob) returns true, it's being held by somebody. If istype(src.loc,/turf) returns true, it's sitting on the floor.