To check if the zombies are touching the trigger_radius, I don't know if this is what you need to check if the zombies are touching it. But yea, this is what I am using. And then the function continues on what will happen to the zombies if they are touching the trigger_radius, bla bla bla.
However, when I throw the grenade and spawn the radius, it seems like the zombies are not touching the trigger because I can throw the grenade far away, and the zombies still get effected even if they are outside the trigger.
So this is why I am wondering if there is a console command I can type that makes so I can see the trigger_radius. In that way I can properly see if the zombies are touching the trigger_radius.
Or am I using the wrong method to check if the zombies are touching the trigger?
Yes it's not working on an array, but it's not being called on an array. The array is 'zombs' but 'zombs[k]' is an entity in that array so that should work fine..
You can also use the distancequared() but there's not really a reason to spawn a trigger then i think..
I dont think you can link a trigger radius, not sure..
Last Edit: April 19, 2014, 12:44:08 pm by BluntStuffy
Well, I tested to add istouching, instead of distancesquered() I did the way Bluntstuffy did, but the zombies still get the effects even if they are not touching the trigger_radius. This is getting as wierd as when I tried to play fx's.
Well, I tested to add istouching, instead of distancesquered() I did the way Bluntstuffy did, but the zombies still get the effects even if they are not touching the trigger_radius. This is getting as wierd as when I tried to play fx's.
I don't know how you set up the rest of your code, but you could try checking if 'grenade.origin' actually returns a valid value by making it print on the screen with an iprintln() If that doesn't happen, the trigger prob won't spawn (correctly)
it should display the origin, so there's prob no value stored in that variable.. (i guess)
In general: you want to set it up like this i think, otherwise the second zombie won't be affected until the for loop for the first zombie has ended. That's just a side comment, try changing the print to this i'm not 100% sure if the iprintln() works like shown before (think it does). If still no print shows up for the grenade origin, but the tekst "special grenade test" is being printed, something is prob wrong with the grenade.origin value..
Code Snippet
Plaintext
zombs = getaispeciesarray("axis","all");
center = spawn("trigger_radius",grenade.origin,1,200,200);
I tried it out, and it only printed out "special grenade test" But not the other.
BUT, I tried an another thing. I added a 4 lines that looked like this,
Code Snippet
Plaintext
forward = player geteye(); vec = anglestoforward(player getPlayerAngles()); end = (vec[0] * 100000000, vec[1] * 100000000, vec[2] * 100000000); hammertrace = BulletTrace( forward, end, 0, player )[ "position" ];
And this makes the radius to spawn where you throw the grenade, and I noticed that because I spawned a script_model and set the model to a tag origin and played a fx, and with those three lines, it made the fx to play at the place you threw the grenade. In this way, I don't need to link the radius to the grenade.
So I spawned a trigger radius in this way as well to see what happens. Now the zombies didn't get the effects at all even if they are touching or not touching the trigger.
But I did do what you said but not with the grenade, I printed the line that says "hammertrace" Because this is were the radius will spawn. And this is what showed up ingame.
Well, now at least you know there's something stored in that variable. So the trigger should spawn at that position. Maybe it's the code after that. Try adding another iprintln() somewhere to tell you if the code is being executed, and maybe for a test just change the whole effect function to only do damage for now. So maybe something like this:
Code Snippet
Plaintext
zombs = getaispeciesarray("axis","all");
center = spawn("trigger_radius",grenade.origin,1,200,200);