The code is perfectly fine but no matter where I put it or change it, I cannot get the enemy to attack:
proc/Wander()
while(src) //While the mob is still here...
if(P in oview(1))
step_towards(src,P) //Step towards the PC
Mattack(src,P)
else
step_rand(src) //Step randomly once.
sleep(10) //Wait one second
for(P in oview(1))
break
sleep(10)
spawn(5)
Wander()
proc/Mattack(mob/M)
var/mhitper=rand(1, src.dex)
var/dodgeper=rand(1,dex)
var/mdamage = rand(1,src.strength)
usr << "[src] attacks you!"
if (mhitper >= dodgeper)
usr << sound('hit.wav')
usr << "[mdamage] damage!"
HP -= mdamage
sleep 10
else
usr << sound('wooh.wav')
usr << "They miss!"
sleep 10
usr.Death()
sleep 1000</<></<>
ID:178528
Apr 29 2002, 8:31 pm
|
|
In response to Shadowdarke
|
|
I changed it to P but it still doesn't work.
proc/Mattack(mob/P) var/mhitper=rand(1, src.dex) var/dodgeper=rand(1,dex) var/mdamage = rand(1,src.strength) usr << "[src] attacks you!" if (mhitper >= dodgeper) usr << sound('hit.wav') usr << "<font color=red>[mdamage] damage!</font>" HP -= mdamage sleep 10 else usr << sound('wooh.wav') usr << "They miss!" sleep 10 P.Death() sleep 1000 |
In response to Likwiddraino000
|
|
There are a lot more usrs in there than the one you replaced.
|
Also, you should not be using usr in Mattack(). You send it two vars, the attacker (src) and the target (P), but the Mattack() proc only recieves one. usr will not always be the player target when you are running the game multiplayer.