ID:150269
 
ok I have a variable called damage. And I have an attack. I want to make it so that when someone blocks they damage done to them is cut in half. Heres what I have so far,

mob
Login()
ect...
var
damage
verb
Attack(M as mob in oview(1))
icon_state = "Attack"
sleep(50)
damage = usr.Level
M:HP -= damage
Block()
damage /= 2


that doesn't work, so what should I do now, any help , please
BrollyX wrote:
ok I have a variable called damage. And I have an attack. I want to make it so that when someone blocks they damage done to them is cut in half. Heres what I have so far,

mob
Login()
ect...
var
damage
verb
Attack(M as mob in oview(1))
icon_state = "Attack"
sleep(50)
damage = usr.Level
M:HP -= damage
Block()
damage /= 2


that doesn't work, so what should I do now, any help , please

Using the colon operator *:* is eeeeevil! Especially the way you're using it.

As for your actual problem; in your case, you're confusing src with M without even realising it.

I'd recommend that you make a new proc along the lines of
the following:

//notice the difference: 'mob/M' instead of 'M as mob' allows you to use . instead of :
mob/verb/Attack(mob/M in oview())
icon_state = "Attack"
sleep(5) //0.5 seconds -- five seconds is a long time, you know
var/damage = usr.level
if(M.blocking)
damage /= 2
M.HP -= damage


(And this code will definitely not work in its current format. Any errors you get are up to you to fix.)