This is a script that will check if the zombies are touching a trigger and then will kill the zombies. And the purpose of this is that it will only kill the zombies that are touching the trigger, bu tinstead if only ONE zombie has touched the trigger, then all zombies dies.
I only want the zombies that touches the trigger to die, then why doesn't it do that? Thanks in advance.
Right off the bat I can see that the variable players does not seem to be defined. Not sure why it hasn't given you a script error on map startup already. Also, put the wait in your while loop instead of the if statement. (I saw both of those things at first glance, so keep that in mind if it does not work instantly.) Ill look into this more when I get to my desktop. (Im on a laptop now that cant run w@w for me to test)
Edit: For some reason on my laptop it didn't show the whole code box, ignore what I said about things not being defined. (I only saw part of it)
Last Edit: May 27, 2014, 07:51:46 pm by AwesomePieMan
This zombs = getaispeciesarray("axis","all"); you could maybe try this instead zombs = GetAiArray("axis");
I think I actually need that the one I have. getaiarray isn't for all ai "enemies" I think, the one I have works for both zombies and dogs, if I'm not mistaken.
I believe that your radius is returning undefined. From what I've experienced this makes the code ignore the if statement and run all lines of code, regardless if it actually true or not.
Just as a test, try this:
Last Edit: May 27, 2014, 09:13:47 pm by daedra descent
well besides your code doesnt exactly shows what you want it to do(useless vars, undefined stuff) your doing a for loop on the zombies array inisde the players for loop.
I believe that your radius is returning undefined. From what I've experienced this makes the code ignore the if statement and run all lines of code, regardless if it actually true or not.
Just as a test, try this:
I tried this and I changed the place of the "!" before "zombs[k]" instead of after. Becaus eit gave me a bad syntax.
Well I have tested it and when the zombies are touching the trigger, then it printed "no center defined" and it still printed that if the zombie touched it once and walked away from the trigger. And when the zombies didn't touch the trigger then it printed, "AI are not in the center!".
But the zombes didn't die if they touched the trigger, but this is just a test as you said.
Here is a test to hopefully kill off only 1 zombie instead of a multiple of them.
Hmm, it killed all the zombies anyway. As soon as one zombie is touching the trigger, then all zombies dies. And when it does that now, it loops forever so I get unlimited points, lol.
It is something with the for loop for the zombies. The wierd thing is I do put the end bracket for the zombie loop after it has only looped one zombie and killed it. But it still kill al zombies, that is wierd.
Maybe this one will work if you want to try it out but can't say for sure it will work.
It didn't work either it basically did the same thing, maybe I need to tell what I am trying to do. I am trying to spawn a trigger at were you throw a grenade, and then those zombies who are touching the trigger will die. The other zombies that are not touching the trigger will not get affected by it. Only the zombies that are touching the trigger will die. And the script will check if the zombies are touching the trigger and then kill them for 14 seconds and then stop.
Edit: How did other kill the zombies in script one at a time? Like other maps I have seen, why doesn't it work for me?
Nice, it worked, thank you so much! Now only the zombies that are near the entity dies. But why does distance check work but not istouching check with a trigger radius?