ID:146270
 
mob
verb
if(usr.Stamina >= 3)
Attack(mob/M as mob in oview(1))
set category = "Fighting"
var/damage = usr.Strength*2 - M.Defense*3
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
flick("Punch",usr)
else
M.PL -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()
usr.MaxPL += 50
usr.Strength += 10
usr.Defense += 7
else
usr << "You don't have enough stamina!"


Problem description: I get an error thats says invalid proc definition for else and if

You put the if() outside of the verb definition, and the else is outside the verb as well.

Note that you need to check if M is null in this verb.

Lummox JR
is it an indentation error?
On the damage variable, you might want to use the round() proc or damage will probably be something like "409833.3902".

edit::

mob
verb
Attack(var/mob/M as mob in oview(1)) // For a mob in an outside view of 1, rather than a nonexistant mob/M
set category = "Fighting"
var/damage = round(usr.Strength*2 - M.Defense*3) // Rounds the damage amount up so we don't get decimal points in our damage.
if(usr.Stamina >= 3)
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
flick("Punch",usr)
else
M.PL -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()
usr.MaxPL += 50
usr.Strength += 10
usr.Defense += 7
else
usr << "You don't have enough stamina!"
In response to Lummox JR
that made absolutly no sense to me
In response to CYN
he was saying when you do damage the gamage might come out as:

38.38232

and round() makes it

38

In response to Crzylme
where do i put round()?
In response to CYN
look at sinoflifes post. He put it in.