ID:149828
 
I've been trying to make my verb get delayed, and now I've got a way that half works. It will delay but if you relog it's next_action_time stays at the old world.time which is however many times I attacked + 6.

mob/verb/Attack(mob/M as mob in oview(1))
if(world.time>=next_action_time)
next_action_time = world.time+ 6
else
return 0


How do I make it so when the user logs out the next_action_time is reset?
Switch wrote:
[snip]
How do I make it so when the user logs out the next_action_time is reset?

Either use the mob's Logout(), the mob's Login(), or just make next_action_time tmp. I'd make it tmp because chances are you don't care about saving it. (Something like mob/var/tmp/next_action_time = 0 as num.)
In response to ACWraith
If I make it a tmp it doesn't delay them then.


mob/verb/Attack(mob/M as mob in oview(1))
var/NPCDamage = usr.Strength+usr.Weapon
var/tmp
next_action_time
if(world.time>=next_action_time)
next_action_time = world.time+ 6

else
return 0

That's what you meant, right?


In response to Switch
Actually, I think I gave the example. Don't do it inside the function. Keep it as a mob variable, but make it temporary.

mob/var/tmp/next_action_time

PS: You are returning false when the attack fails. Shouldn't you also be returning true when it works?