ID:166911
May 31 2006, 4:50 am (Edited on May 31 2006, 5:15 am)
|
|
My code: var/sound/crit = 'criticalhit.wav' var/sound/att = 'attack.wav' var/sound/hit = 'hit.wav' var/sound/mhit = 'enemy-hit.wav' var/sound/matt = 'enemy-attack.wav' var/sound/dodge = 'dodge.wav' var/sound/mdod = 'dodge2.wav' mob proc attack(mob/M) if(M) src << "You attack [M]." src << sound(att) M << "[src] attacks you." M << sound(matt) sleep(5) if(rand(1,4)==4) src << "[M] dodges ." src << sound(dodge) M << "You dodge [src]'s attack." M << sound(mdod) sleep(5) else var/damage// = src.str - M.def if(damage<=0) damage = 1 src << sound(hit) M << sound(mhit) if(luckchance(src)) damage = damage*2 src << sound(crit) M << sound(crit) src << "Critical hit!" M << "Critical hit!" sleep(10) src << "You hit [M] for [damage] hit points." M << "[src] hits you for [damage] hit points." M.hp -= damage sleep(10) var/sound/att = 'attack.wav' var/sound/matt = 'enemy-attack.wav' In battle I can hear the var "matt" but not "att" and I can't figure out why. Any help would be apprecited. |
Copyright © 2024 BYOND Software.
All rights reserved.
Anyway, the reason you're only hearing the matt sound is because in this instance, you're M and the enemy is src. The reverse could sometimes be true.
Because each sound is only sent to one mob, only one sound is heard during the proc instead of both. In other words, you should've done this:
Kudos in avoiding the usr trap that so many people fall into. I also have a few other suggestions that may help you out.
When calculating dodge chance, you used if(rand(1,4)==4), but an easier approach is if(prob(25)).
I also see that the damage formula was never calculated because it was commented out. Typically when using an attack-defense method, you'd use rand(0,attack)-rand(0,defense) and go from there. This is usually a pretty lousy formula, but it's a place to start.
Lummox JR