ID:1534834
 
(See the best response by Pirion.)
Code:
mob/proc/Execution(path,radius)
for(var/turf/T in orange(radius,src))
new path(T)
for(var/mob/M in orange(radius,src))
src.FireAoE_Damage(M,radius)


mob/proc/FireAoE_Damage(mob/M,radius)
var/dmg = round(src.Willpower * 3) + round(src.Strength * 2.7)
M.Health -= dmg
M.Death_Check()


Problem description:Created this from learning from a resource about AoE's, although it's not exactly what I was looking to learn. I'm trying to figure out how to make this AoE do damage multiple times while in the radius. (Say if you stand in the radius for 3 seconds, you'll take the damage each second, 3 times in total). I realize it isn't that difficult, but I just can't come across how to do it. Any suggestions?

Best response
You need to use a while loop.

mob/proc/Execution(path,radius)
var
ticks = 10 //this is how long to sleep
loops = 3 //this is how many times to loop
for(var/turf/T in orange(radius,src))
new path(T)
while(!loops--) //while there is loop work to do
for(var/mob/M in orange(radius,src))
src.FireAoE_Damage(M,radius)
sleep(10) //sleep 10 ticks, or 1 second
In response to Pirion
Pirion wrote:
You need to use a while loop.

> mob/proc/Execution(path,radius)
> var
> ticks = 10 //this is how long to sleep
> loops = 3 //this is how many times to loop
> for(var/turf/T in orange(radius,src))
> new path(T)
> while(!loops--) //while there is loop work to do
> for(var/mob/M in orange(radius,src))
> src.FireAoE_Damage(M,radius)
> sleep(10) //sleep 10 ticks, or 1 second
>


Tried this. It now damages me once, but no one around me.

Sorry, the ! mark is incorrect - remove this and you should be good.