ID:267882
 
Here is what I have:
mob
verb
Attack(mob/M as mob in view())
attackmove(usr, M)



proc/attackmove(mob/a, mob/M)
step_towards(a, M)
if(a.Bump(M))
M << "YOU ARE UNDER ATTACK"
while(M.DeathCheck() == 0)
attack2(a, M)
var/delay = 50 - (M:spd - a:spd)
sleep(delay)
attack2(M, a)
delay = 50 - (a:spd - M:spd)
sleep(delay)
world << "[M] has been killed by [a]"

proc/attack2(mob/a, mob/M)
var/damage
damage = a:str - M:def + rand(1,a:str)
a << "[damage] damage!"
M.hp -= damage


proc/DeathCheck()
if(src.hp <= 0)
return 1
else
return 0
What I'm trying to do is have both people attack at the same time but have delays between there attacks. Also I don't want them to have to press Attack 1000x (and not to use macros)

The Problem is that it freezes when i try to attack a Slime
Dark Weasel wrote:
proc/attackmove(mob/a, mob/M)
step_towards(a, M)
if(a.Bump(M))
M << "YOU ARE UNDER ATTACK"
while(M.DeathCheck() == 0)
attack2(a, M)
var/delay = 50 - (M:spd - a:spd)
sleep(delay)
attack2(M, a)
delay = 50 - (a:spd - M:spd)
sleep(delay)
world << "[M] has been killed by [a]"

The thing being attacked isn't losnig HP! Make it give a minimum of 1 dmg or something. You may also want to spawn the procedure.

I really think you should also re-arrange the way your procedures are declared. Either make it a global procedure, or rather than usinf "mob/A" as a paramiter, just remove that, and wherever a. is, replace with src. (Or just remove them.)
In response to Yota
fixed everything, except i have 1 more error

proc/attackmove(mob/M)
StartAttackMove
step_towards(src, M)
if(src.Bump(M))
M << "YOU ARE UNDER ATTACK"
while(M.DeathCheck() == 0)
src.attack2(M)
var/delay = 50 - (M:spd - src.spd)
spawn(delay)
M.attack2(src)
delay = 50 - (src.spd - M:spd)
spawn(delay)
(*)world << "[M] has been killed by [src]"
M.Dead()
else
goto StartAttackMove

in the starred (*) line im getting an invalid expression warning

---
nvm i got the errors out but it still freezes
In response to Dark Weasel
Like I said, it's keeps looping untill the thing dies, but since the slime isn't taking damage via defence or such, it keeps looping forever! Make the thing always get damaged, even if damage minimum is 0.1.
Dark Weasel wrote:
if(a.Bump(M))

This will always be false, as Bump() does not return a value.