How would i make it so that the attacker has to be facing what he wants to attack or it wont do anything.
mob/characters
verb
Attack(M as mob in oview(1)) /*The "M as mob in oview 1" part will make it so you do this to a mob that is in front of you only, you can edit the oview(#) to the amount of spaces away the attack can effect*/
set category = "Actions"
if(usr.attacked)return
flick("attack",usr) /*this will make the user look like he is punching*/
var/damage = rand(Strength)
if(damage <= 0)
usr << "Your attack doesnt do any damage to [M]"
else
attacked=1
sleep(2)
damage -= M:Defense
M:HP -= damage
M:DeathCheck() /*this will insure that after each attack that the opponent can die according to the deathcheck proc*/
usr << "[src] Attacks [M] For ([damage])!"
sleep(15)
attacked = 0
mob/var/attacked=0
ID:175726
Mar 16 2003, 10:12 am
|
|
mob/characters |
In response to Garthor
|
|
didnt work,this is what errors i get
attack.dm:5:error:set :invalid proc definition attack.dm:6:error:if :invalid proc definition attack.dm:6:error::invalid proc definition attack.dm:7:error:M :invalid proc definition attack.dm:9:error::invalid proc definition attack.dm:4:error:Attack :previous definition attack.dm:11:error:Attack :previous definition here's my code mob/var/attacked=0 mob/characters verb Attack(M as mob in oview(1)) set name = "Attack" set category = "Actions" if(attacked) return var/mob/M = locate() in get_step(src,dir) if(M) Attack(M) proc Attack(mob/M) flick("attack",src) var/damage = rand(Strength) if(damage <= 0) src << "Your attack doesnt do any damage to [M]" else attacked = 1 sleep(2) damage -= M:Defense M:HP -= damage M:DeathCheck() src << "<font size = 1><font color = white>[src]<font color = white> Attacks <font color = red>[M]<font color = White> For <font color = White>(<font color = White>[damage]<font color = White>)<font color = White>!</font>" sleep(15) attacked = 0 |
In response to Baedock
|
|
Everything between <code>Attack(M as mob in oview(1))</code> and <code>proc</code> has to be indented once more.
|
In response to Garthor
|
|
k no error's now,i changed a couple things.does that look right?
mob/var/attacked=0 mob/characters verb Punch() set name = "Attack" set category = "Actions" if(attacked) return var/mob/M = locate() in get_step(src,dir) if(M) Attack(M) proc Attack(M as mob in oview(1)) flick("attack",src) var/damage = rand(Strength) if(damage <= 0) src << "Your attack doesnt do any damage to [M]" else attacked = 1 sleep(2) damage -= M:Defense M:HP -= damage M:DeathCheck() src << "[src] Attacks [M] For ([damage])!" sleep(15) attacked = 0 |
-Nova