ID:145172
 
obj
Pbag
icon = 'Pbag.dmi'
icon_state = "Normal"
density = 1
verb
Train()
set src in oview(1)
if(usr.training == 0 && usr.rest == 0 && usr.Stamina >= 5)
if(usr.dir == EAST && usr.location(src.x-1,src.y,src.z))
usr.training = 1
usr.bagtrained = 1
flick("Hit",src)
usr<<"<font color = blue><b>You hit the heavy bag</b></font>"
usr.Stamina -= rand(2,5)
usr.Speedexp += 1
usr.Armstr += 1
usr.Endurance += 1/2
usr.Thirst += 1
usr.Hunger += 1/2
spawn(20 - usr.Speed)
usr.training = 0
usr.LevelCheck()

Fixed it so it has to face east but i want it to be directly left of the pbag. it gives me this error

Turf.dm:169:error:usr.location:undefined proc
loc not location
In response to A.T.H.K
loc=locate(x,y,z)
Um, why not simply let the player face the bag from any direction? Not that I support the use of pbags, mind you, since they're a bad bad bad idea, but if you must have one, there are better ways.
if(get_dist(usr, src) <= 1 && usr.dir == get_dir(usr, src))

The get_dist() check may look redundant, but it's not. Sometimes a macroed attack will keep going when it's not actually near the object anymore.

Lummox JR
In response to Mysame
obj
Pbag
icon = 'Pbag.dmi'
icon_state = "Normal"
density = 1
verb
Train()
set src in oview(1)
if(usr.training == 0 && usr.rest == 0 && usr.Stamina >= 5)
if(usr.dir == EAST && usr.loc = locate(src.x-1,src.y,src.z))
usr.training = 1
usr.bagtrained = 1
flick("Hit",src)
usr<<"<font color = blue><b>You hit the heavy bag</b></font>"
usr.Stamina -= rand(2,5)
usr.Speedexp += 1
usr.Armstr += 1
usr.Endurance += 1/2
usr.Thirst += 1
usr.Hunger += 1/2
spawn(20 - usr.Speed)
usr.training = 0
usr.LevelCheck()dm>


Bad Assignment
In response to CYN
Of course it is, you're trying to change the loc in an if() statement using locate(). Read what Lummox said.
In response to CYN
What the heck is usr.Endurance += 1/2

Why not just put .05 (if it works, try it)
In response to XzDoG
that doesn't work. Tried it.
In response to CYN
That's because it needs to be 0.5 .