ID:147585
 
Well its all ATB system, I can get the human attack code tow ork perfectly and everything but it won't let me loop the ATB proc for enemies over and voer the same way i did for humans stat(ATB()) so im wondering how to loop the proc over and voer wtihout giving an inifinite loop thing that byond crashes the proc without having to set that so it doesn't. heres the code.
EATB()
if(usr.ATBgauge <= 99)
sleep(1)
usr.ATBgauge += rand(4,5)
else
usr.adding = 0
usr.ATBgauge = 100
usr.EAttack()
The second part is i did a little kinking to skip the ATB and have enemies attack this code only works if its set to world and it worked perfectly for humans so im like wtf. heres the code

EAttack()
var/mob/M
for(M in view())
M << "[usr] attacks you for 999999 damage! mwahahaha"
usr.ATBgauge = 0

no damage or anything jsut trying to get the damn thing to work and its pissing me off, can anyone help me?
I've also tried different variations of definign M inside and out of the for proc so that doesn't work
LilTrunks wrote:
Well its all ATB system, I can get the human attack code tow ork perfectly and everything but it won't let me loop the ATB proc for enemies over and voer the same way i did for humans stat(ATB()) so im wondering how to loop the proc over and voer wtihout giving an inifinite loop thing that byond crashes the proc without having to set that so it doesn't. heres the code.
EATB()
if(usr.ATBgauge <= 99)
sleep(1)
usr.ATBgauge += rand(4,5)
else
usr.adding = 0
usr.ATBgauge = 100
usr.EAttack()

Have you tried adding a spawn() EATB() after the if/else statement, because that would finish the proc, then call EATB() afterwards, thus eliminating the infinite loop problem. Also if this is a proc for monsters that people cant control, then i suggest replacing usr with src.
<edit>
        EATB()
if(src.ATBgauge <= 99)
sleep(1)
src.ATBgauge += rand(4,5)
else
src.adding = 0
src.ATBgauge = 100
src.EAttack()
spawn() src.EATB()

</edit>
In response to Lazyboy
Thanks, I shoulda known the golden rule of never use usr unless its a client it worked and it magically fixed the attack proc to lol thanks, you were a big help