Jump to content
Sign in to follow this  
Pundaria

Kill player/AI within the zone?

Recommended Posts

Hi

I am wondering how to kill person of a certain side who step in a zone defined by a trigger?

Trying to make a space impermeable to enemy for respawning and containing fighting zone :p

P.S. How the "Seize by ..." stuff work. I used seize by Blufor as winning condition, but with enemy number obviously outnumber us, I still win. Why?

Share this post


Link to post
Share on other sites

make a trigger with side you want to kill, present repeated.

on act:

{_x setDammage 1} foreach thisList

will kill all units of the side spcified when they enter the trigger area.

for the seized by i dont know, never used it.

Share this post


Link to post
Share on other sites

Thank you =)

---------- Post added at 18:18 ---------- Previous post was at 18:15 ----------

BTW, can I define only human to be killed?

Share this post


Link to post
Share on other sites

use condition Egosa-U said.

and in onact: {if (_x == player) then {_x setDammage 1}} foreach thisList

now trigger will only fire when a player is present, and will only kill players not AI

Edited by Demonized
edited text errors.

Share this post


Link to post
Share on other sites

How do you make a simple trigger to kill units that enter the area ? I was looking for it and cannot figure it out, or is this it ? If so i can't get it to work. I put this into the on act field of the trigger " {if (_x == player) then {_x setDammage 1}} foreach thisList" Is this wrong ?

Share this post


Link to post
Share on other sites

Lol, I had asked this like 2 months ago, and i think demonized said the same thing, hmm me thinks one should search before posting, lol Yoda :D

Share this post


Link to post
Share on other sites

Ok sorry i've got this working now, but is there anyway to make exceptions to this rule ?

EDIT: Or is there a way to make units possibly spawn with names then create the list of names that will be killed by the trigger leaving everything else exempt ?

Thanks

Dan

Share this post


Link to post
Share on other sites
Ok sorry i've got this working now, but is there anyway to make exceptions to this rule ?

EDIT: Or is there a way to make units possibly spawn with names then create the list of names that will be killed by the trigger leaving everything else exempt ?

Thanks

Dan

you can for example add any unit wich is "allowed" into a global array on creation:

place in init.sqf or somewhere else before using:

Allowed_entry = [];

when creating a unit, wich is to be allowed, use this line:

Allowed_entry = Allowed_entry + [_unitname];

now the on act like this will kill all that is in the array:

{if (_x in Allowed_entry) then {_x setDammage 1}} foreach thisList

now the on act like this will kill all that is NOT in the array:

{if (!(_x in Allowed_entry)) then {_x setDammage 1}} foreach thisList

you can also combine it with more conditions, only killing players that are not in the array:

{if (!(_x in Allowed_entry) AND _x == player) then {_x setDammage 1}} foreach thisList

and so on and so forth-

Share this post


Link to post
Share on other sites
you can for example add any unit wich is "allowed" into a global array on creation:

place in init.sqf or somewhere else before using:

Allowed_entry = [];

when creating a unit, wich is to be allowed, use this line:

Allowed_entry = Allowed_entry + [_unitname];

now the on act like this will kill all that is in the array:

{if (_x in Allowed_entry) then {_x setDammage 1}} foreach thisList

now the on act like this will kill all that is NOT in the array:

{if (!(_x in Allowed_entry)) then {_x setDammage 1}} foreach thisList

you can also combine it with more conditions, only killing players that are not in the array:

{if (!(_x in Allowed_entry) AND _x == player) then {_x setDammage 1}} foreach thisList

and so on and so forth-

Thanks alot for that :)

Share this post


Link to post
Share on other sites

Sorry to "bump" but, is there anyway to make a list of targets instead ? Do i make a game logic make the list in that then make the trigger dependent on that ?

Share this post


Link to post
Share on other sites
Sorry to "bump" but, is there anyway to make a list of targets instead ? Do i make a game logic make the list in that then make the trigger dependent on that ?

an array is a list....

like my example above:

now the on act like this will kill all that is in the array/list:

{if (_x in Allowed_entry) then {_x setDammage 1}} foreach thisList

Share this post


Link to post
Share on other sites

Hi, I'm trying to make an injury script that only activates when a variable reaches a certain value (cycles every few minutes). I'm trying to injure players who are in proximity to a building and give only those players a camera shake. I can't use a trigger either so it all has to be done with scripts. I've searched the forums and almost everything requires a in map trigger.

Share this post


Link to post
Share on other sites
make a trigger with side you want to kill, present repeated.

on act:

{_x setDammage 1} foreach thisList

will kill all units of the side spcified when they enter the trigger area.

for the seized by i dont know, never used it.

I did this for an MSO mission. I'm trying to make a base but the enemy AI keep spawning in the hangars and barracks. I was going to try to use this kill script to kill the enemies that spawn with a trigger but it's not working. I don't know if it's MSO messing it up or if I am messing it up.

---------- Post added at 04:56 ---------- Previous post was at 04:26 ----------

I did this for an MSO mission. I'm trying to make a base but the enemy AI keep spawning in the hangars and barracks. I was going to try to use this kill script to kill the enemies that spawn with a trigger but it's not working. I don't know if it's MSO messing it up or if I am messing it up.

Forgot to mention that I have been fiddling around with it to fix it and tried to use this code in On Act:

{_x setDamage 1} foreach thisTrigger;

And in Condition:

this

And I have a trigger for every faction I don't want in my base.

This is also the error message I'm getting too: "Error foreach: Type object, expected array". I am really new to this so help me out please.

Edited by dixon13

Share this post


Link to post
Share on other sites
iit's not thistrigger but thislist

I did try that, so then I tried thisTrigger, but nothing is working. I just don't want AI opfor to spawn at the souther airbase on Clafghan so I can use it.

Share this post


Link to post
Share on other sites

It kind of depends on how you have the trigger set up.

If you want to allow west then use east present repeating

Share this post


Link to post
Share on other sites
It kind of depends on how you have the trigger set up.

If you want to allow west then use east present repeating

Then how should I set it up. I've tried these listed ways on the forums nothing is working. Can you give me another way that's fresh. I'm getting really frustrated now.

Share this post


Link to post
Share on other sites

Actually your sort of right the previous will work but at times it seems to get over run and then fails.

It kills any current units but if multiple units enter at the same time it then fails as the condition hasn't changed.

This is made worse when units are in vehicles.

You will need to force a change in condition

east present repeating

cond

round (time %1) == 1

on act

{deletevehicle _x} foreach thislist

This deletes the units other wise you will end up with too many dead bodies.

Share this post


Link to post
Share on other sites
Actually your sort of right the previous will work but at times it seems to get over run and then fails.

It kills any current units but if multiple units enter at the same time it then fails as the condition hasn't changed.

This is made worse when units are in vehicles.

You will need to force a change in condition

east present repeating

cond

round (time %1) == 1

on act

{deletevehicle _x} foreach thislist

This deletes the units other wise you will end up with too many dead bodies.

Ohhh. So maybe I am doing it right (that's what she said LOL) but the script doesn't work because multiple AI are spawning at the same time. I will try this out.

Share this post


Link to post
Share on other sites
Ohhh. So maybe I am doing it right (that's what she said LOL) but the script doesn't work because multiple AI are spawning at the same time. I will try this out.

So I finally got it to work. This is what I did.

Condition:

this; round (time %1) == 1;

Action:

{_x setDamage 1} foreach thisList; {deletevehicle _x} foreach thisList;

and I created two triggers...

One for OPFOR and one for INDEPENDENT. Each was set for Present, Repeatedly.

Thanks a lot for the help. Much appreciated.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×