ID:2248724
 
Hello everyone, I was wondering if there was an "Easy Method" to damaging everyone in your view. I was attempting to use something along the lines of for(var/mob/m in view()) and just have m.Health-= damage. Though, it would only injure me. I want it to not only injure me, but also injure everyone in my view. Would I have to go about using something completely different that view,oview,etc?
The method of using for() and view() would be correct, if it's only damaging you there's something causing the loop to break. You'd have to show some actual code.
The code is suppose to drop a boulder onto the location of the player and damage, or kill, everyone including them. I assume the death proc is blocking it so that once the player get's hit and presumably dies, the rest stops and only the player will die.

 mob
verb
Meteor_Shower()
var/delay=0
if(!delay)
delay=1
for(var/mob/m in view(src,8))
new/obj/Boulder(src)
view()<<"[src]: Meteor Shower!"
m.Health-=src.Energy
m.death_check(src)
spawn(100)
del(a)
sleep(500)
delay=0
return
else
src<<"You must wait..."
return
No, you're returning in the middle of the loop, which stops the entire procedure from continuing. You only use return if you want the entire proc to halt. You don't need anything at the end of a loop.
In response to Unwanted4Murder
I was able to fix the problem so it does damage/kill the other npcs. It's just that now, it waits to kill them. When I had more health than the damage, it went straight to the npc's death after I took damage. But if it kills me, it goes through the entire death proc I presume, then it kills them.
You'd want to 'set waitfor = 0' inside of death_check()
In response to Nadrew
Where should I set "waitfor=0" At the start of the death proc before it sets specific vars to 0 and such or after it spawns the player back to the spawn at the end of the death proc? Thank you again for helping!
Not 'waitfor = 0', 'set waitfor = 0' at the top of the proc, like any verb/proc setting (look it up in the reference)
In response to Nadrew
Thanks a bunch! It works perfectly now!