ID:154880
 
Id like to make a Sprint verb for my game. But every angle that I try to approach just doesn't work out, can someone help me figure out how to get it to work properly?

Code:

mob
icon = 'Mobs.dmi'
icon_state = "player"
step_size = 3
var
HP = 100
MHP = 100
str = 1
def = 1
running = 0
walking = 1
mob
verb
Run()
step_size += 2
proc
Checkspeed()
if step_size > 7
step_size = 5
else running = 1


It seems that I have an unlimited amount of runs available, but I only want them to only be able to press it once.
Then check if you are already running and <code>return</code> so it doesn't continue.
In response to Neimo
Ok, Ive adjusted it but now I get a "missing expression" error on the If line.

mob
icon = 'Mobs.dmi'
icon_state = "player"
step_size = 3
var
HP = 100
MHP = 100
str = 1
def = 1
running = 0

mob
verb
Run()
if (usr.running = 0)
step_size += 2
else return
In response to Kkirk15
Add another <code>=</code> sign after the one in the <code>if()</code> statement.
In response to Neimo
Alright, Now my final problem. I need to find a way to make running only be used once, But everytime I add coding I get errors, I would appreciate if anyone can help me.

mob
icon = 'Mobs.dmi'
icon_state = "player"
step_size = 3
var
HP = 100
MHP = 100
str = 1
def = 1
running = 0

mob
verb
Run()
if (usr.running == 0)
step_size += 3
else return


How can I make the variable running = 1 at the end of the verb, Also how can I make it where if running = 1, the user cannot click run again and gain speed.
In response to Kkirk15
In response to Kkirk15
Run()
if (!running)
running = 1
step_size += 3