Jump to content
Sign in to follow this  
SteelSampson

How do I activate trigger only if certain vehicles enter?

Recommended Posts

I have only eight specific vehicles that I would like to be able to activate the trigger?

Thanks.

Share this post


Link to post
Share on other sites

I don't know, but can you help me? I need someone to retexture the US Marine corpsman and scout to have a Navy digital camo skin. Can you do that for me? Thanks.

  • Haha 1

Share this post


Link to post
Share on other sites

I don't know, but can you help me? I need someone to retexture the US Marine corpsman and scout to have a Navy digital camo skin. Can you do that for me? Thanks.

(Arma2)

---------- Post added at 21:39 ---------- Previous post was at 21:38 ----------

Can you help me blitzer?

Share this post


Link to post
Share on other sites

@privateponage this is arma 3 section you need arma 2 and start new post don't highjack someone elses

Edited by Blitzer134

Share this post


Link to post
Share on other sites
group vehicle to trigger then you will have a new drop down in the trigger

Thanks for your fast reply! Although, I am hoping to accomplish this through scripting methods instead of grouping them to each trigger because I have about twenty triggers that I need this to happen on.

Idk if this helps but, I'm hoping to put something like this in the condition field of many triggers for a list of many vehicles:

"Tank2_1 in (list Table8_StartTrig)"

Edited by SteelSampson

Share this post


Link to post
Share on other sites

EDIT: After some testing this kinda works

myVehicles = [veh1,veh2,veh3,veh4,veh5];

_trg = createTrigger["EmptyDetector",getMarkerPos "mypos"];
_trg setTriggerArea[30,30,0,false];
_trg setTriggerActivation["ANY","PRESENT",true];
_trg setTriggerStatements["this && ({_x in myVehicles} count thislist > 0)",
							  "{if (_x in thislist) then {player sidechat format['%1',_x]}}foreach myVehicles",
							  "hint 'no myVehicles in trigger'"];

But has problems :-

1) myVehicles is a global var otherwise its not found. I presume this is a namespace issue because of where the statements are stored via the command?

2) of course the hint only shows the first vehicle that fires off the condition being true

3) you need to use thislist and thisTrigger when referring to the trigger rather than 'list _trg' (again _trg would need to be global)

After messing around with this for an hour my conclusion is triggerstatements are a pain in the arse. :mad:

Ive never really used them due to the above problems, maybe im doing something wrong, hopefully someone else will chime in and put us all out of our misery.

Until then, I have been using a separate thread to check my triggers and do all my relevant code on the triggers list.

waitUntil{!(isNull player)};

_myVehicles = [veh1,veh2,veh3,veh4,veh5];

_trg = createTrigger["EmptyDetector",getMarkerPos "mypos"];
_trg setTriggerArea[30,30,0,false];
//use the activation command to whittle down relevant objects eg WEST
_trg setTriggerActivation["WEST","PRESENT",true];

_handle = [_trg, _myVehicles] spawn {
private["_myVehicles","_trg"];

_trg = _this select 0;
_myVehicles = _this select 1;

//loop forever, can end by terminating the thread handle
while {true} do {

	//wait for trigger to become active
	waitUntil{triggerActivated _trg};

	//do what ever
	_hstring = "";
	_trglist = +(list _trg);

	{
		if(_x in _trglist) then {
			_hstring = _hstring + format ["veh in trig, %1\n",_x];
		}else{
			_hstring = _hstring + format ["veh not in trig, %1\n",_x];
		};
	}forEach _myVehicles;
	hint _hstring;
};
};

and a test mission.sqm to go with

version=12;

class Mission

{

addOns[]=

{

"A3_Soft_F_Hunter",

"A3_Characters_F_BLUFOR",

"a3_map_stratis"

};

addOnsAuto[]=

{

"A3_Soft_F_Hunter",

"A3_Characters_F_BLUFOR",

"a3_map_stratis"

};

randomSeed=14342054;

class Intel

{

timeOfChanges=1800.0002;

startWeather=0.30000001;

startWind=0.1;

startWaves=0.1;

forecastWeather=0.30000001;

forecastWind=0.1;

forecastWaves=0.1;

forecastLightnings=0.1;

year=2035;

month=7;

day=6;

hour=14;

minute=15;

startFogBase=0.001;

forecastFogBase=0.001;

startFogDecay=0.0049999999;

forecastFogDecay=0.0049999999;

};

class Groups

{

items=6;

class Item0

{

side="WEST";

class Vehicles

{

items=1;

class Item0

{

position[]={1799.8766,5.5,5622.2813};

azimut=553.85999;

id=0;

side="WEST";

vehicle="B_Hunter_F";

leader=1;

skill=0.60000002;

text="veh1";

};

};

class Waypoints

{

items=4;

class Item0

{

position[]={1797.8632,5.5,5615.8032};

speed="NORMAL";

combat="SAFE";

class Effects

{

};

showWP="NEVER";

};

class Item1

{

position[]={1766.865,5.5,5510.3169};

class Effects

{

};

showWP="NEVER";

};

class Item2

{

position[]={1738.3229,5.5,5498.2373};

speed="LIMITED";

class Effects

{

};

showWP="NEVER";

};

class Item3

{

position[]={1806.5063,5.5,5600.1343};

class Effects

{

};

showWP="NEVER";

};

};

};

class Item1

{

side="WEST";

class Vehicles

{

items=1;

class Item0

{

position[]={1851.5261,5.5000963,5567.9614};

azimut=-66.755501;

id=1;

side="WEST";

vehicle="B_Soldier_F";

player="PLAYER COMMANDER";

leader=1;

skill=0.60000002;

};

};

};

class Item2

{

side="WEST";

class Vehicles

{

items=1;

class Item0

{

position[]={1808.4358,5.5,5619.043};

azimut=553.85999;

id=2;

side="WEST";

vehicle="B_Hunter_F";

leader=1;

skill=0.60000002;

text="veh2";

};

};

class Waypoints

{

items=4;

class Item0

{

position[]={1806.4224,5.5,5612.5649};

speed="NORMAL";

combat="SAFE";

class Effects

{

};

showWP="NEVER";

};

class Item1

{

position[]={1774.4989,5.5,5508.9287};

class Effects

{

};

showWP="NEVER";

};

class Item2

{

position[]={1745.525,5.5,5479.7827};

speed="LIMITED";

class Effects

{

};

showWP="NEVER";

};

class Item3

{

position[]={1810.2076,5.5,5592.7314};

class Effects

{

};

showWP="NEVER";

};

};

};

class Item3

{

side="WEST";

class Vehicles

{

items=1;

class Item0

{

position[]={1817.4579,5.5,5615.8037};

azimut=553.85999;

id=3;

side="WEST";

vehicle="B_Hunter_F";

leader=1;

skill=0.60000002;

text="veh3";

};

};

class Waypoints

{

items=4;

class Item0

{

position[]={1815.4445,5.5,5609.3257};

speed="NORMAL";

combat="SAFE";

class Effects

{

};

timeoutMin=2;

timeoutMid=2;

timeoutMax=2;

showWP="NEVER";

};

class Item1

{

position[]={1782.5955,5.5,5505.459};

class Effects

{

};

showWP="NEVER";

};

class Item2

{

position[]={1763.0341,5.5,5470.3271};

speed="LIMITED";

class Effects

{

};

showWP="NEVER";

};

class Item3

{

position[]={1813.6775,5.5,5586.0234};

class Effects

{

};

showWP="NEVER";

};

};

};

class Item4

{

side="WEST";

class Vehicles

{

items=1;

class Item0

{

position[]={1826.0171,5.5,5613.0273};

azimut=553.85999;

id=4;

side="WEST";

vehicle="B_Hunter_F";

leader=1;

skill=0.60000002;

text="veh4";

};

};

class Waypoints

{

items=4;

class Item0

{

position[]={1824.0037,5.5,5606.5493};

speed="NORMAL";

combat="SAFE";

class Effects

{

};

timeoutMin=4;

timeoutMid=4;

timeoutMax=4;

showWP="NEVER";

};

class Item1

{

position[]={1790.9232,5.5,5502.2202};

class Effects

{

};

showWP="NEVER";

};

class Item2

{

position[]={1780.4214,5.5,5465.6929};

speed="LIMITED";

class Effects

{

};

showWP="NEVER";

};

class Item3

{

position[]={1818.3041,5.5,5579.7773};

class Effects

{

};

showWP="NEVER";

};

};

};

class Item5

{

side="WEST";

class Vehicles

{

items=1;

class Item0

{

position[]={1832.7256,5.5,5609.5581};

azimut=553.85999;

id=5;

side="WEST";

vehicle="B_Hunter_F";

leader=1;

skill=0.60000002;

text="veh5";

};

};

class Waypoints

{

items=4;

class Item0

{

position[]={1830.7122,5.5,5603.0801};

speed="NORMAL";

combat="SAFE";

class Effects

{

};

timeoutMin=6;

timeoutMid=6;

timeoutMax=6;

showWP="NEVER";

};

class Item1

{

position[]={1799.2511,5.5,5499.2129};

class Effects

{

};

showWP="NEVER";

};

class Item2

{

position[]={1800.6581,5.5,5465.1831};

speed="LIMITED";

class Effects

{

};

showWP="NEVER";

};

class Item3

{

position[]={1823.6249,5.5,5572.8369};

class Effects

{

};

showWP="NEVER";

};

};

};

};

class Markers

{

items=1;

class Item0

{

position[]={1806.3975,5.5,5577.0601};

name="mypos";

markerType="ELLIPSE";

type="Empty";

colorName="ColorRed";

fillName="Horizontal";

a=30;

b=30;

};

};

};

class Intro

{

addOns[]=

{

"a3_map_stratis"

};

addOnsAuto[]=

{

"a3_map_stratis"

};

randomSeed=9196308;

class Intel

{

timeOfChanges=1800.0002;

startWeather=0.30000001;

startWind=0.1;

startWaves=0.1;

forecastWeather=0.30000001;

forecastWind=0.1;

forecastWaves=0.1;

forecastLightnings=0.1;

year=2035;

month=7;

day=6;

hour=14;

minute=15;

startFogBase=0.001;

forecastFogBase=0.001;

startFogDecay=0.0049999999;

forecastFogDecay=0.0049999999;

};

};

class OutroWin

{

addOns[]=

{

"a3_map_stratis"

};

addOnsAuto[]=

{

"a3_map_stratis"

};

randomSeed=15539325;

class Intel

{

timeOfChanges=1800.0002;

startWeather=0.30000001;

startWind=0.1;

startWaves=0.1;

forecastWeather=0.30000001;

forecastWind=0.1;

forecastWaves=0.1;

forecastLightnings=0.1;

year=2035;

month=7;

day=6;

hour=14;

minute=15;

startFogBase=0.001;

forecastFogBase=0.001;

startFogDecay=0.0049999999;

forecastFogDecay=0.0049999999;

};

};

class OutroLoose

{

addOns[]=

{

"a3_map_stratis"

};

addOnsAuto[]=

{

"a3_map_stratis"

};

randomSeed=135908;

class Intel

{

timeOfChanges=1800.0002;

startWeather=0.30000001;

startWind=0.1;

startWaves=0.1;

forecastWeather=0.30000001;

forecastWind=0.1;

forecastWaves=0.1;

forecastLightnings=0.1;

year=2035;

month=7;

day=6;

hour=14;

minute=15;

startFogBase=0.001;

forecastFogBase=0.001;

startFogDecay=0.0049999999;

forecastFogDecay=0.0049999999;

};

};

Edited by Larrow
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@Larrow:

I'm truly impressed with the knowledge you have there and grateful for the effort you put in!::icon_eek:

Is there a way to simplify this?

1. All the triggers I am using have to be placed in very specific locations. So IF possible I like to have the triggers already placed on the map instead of creating them via script.

2. I love this:

myVehicles = [veh1,veh2,veh3,veh4,veh5]; 

All I really need now is the trigger to activate when any of "myVehicles" are present in a trigger. So by using the condition field in a trigger already on the map, how do I tell the trigger to activate when one of "myVehicles" is in the trigger?

Thank you!

Share this post


Link to post
Share on other sites

Sorry i presumed from your 'I am hoping to accomplish this through scripting methods instead of grouping them to each trigger' that you were doing it all in script no worries :)

So the triggers are already editor placed, are the vehicles too?

Does the trigger OnAct need to know about each individual vehicle from the list that is in the trigger, or just that A vehicle from the list is?

trigger:-

ACTIVATION =

anybody (or BLUFOR, OPFOR etc depending on what you need

repeatedly

present

condition

this && ({ _x in thislist} count [veh1, veh2, veh3, veh4] > 0)

and do what ever you need in the onAct and DeAct.

_____________________________________________________________________________________________

if you need to know about each individual vehicle from your list that is in the trigger then something like.

on Act.

handle = [thisTrigger] spawn {
_trg = _this select 0;
_myVehicles = [veh1, veh2, veh3, veh4];
_trg setVariable ["checkVehicles",_myVehicles];
while {triggerActivated _trg} do {
	sleep 1;
	_trglist = +(list _trg);
	{
		if (_x in _trglist) then {
			//do your stuff here _x being each individual vehicle
			player sideChat format["%1 in trig1",_x];


			//remove each vehicle from the list so you only process it once
			_myVehicles = _myVehicles - [_x];
			_trg setVariable ["checkVehicles",_myVehicles];

			//put vehicle back in list once it has left the trigger
			_handle = [_x, _trg] spawn {
				private ["_trg","_trglist"];
				_veh = _this select 0;
				_trg = _this select 1;
				_trglist = list _trg;
				waitUntil{!(_veh in _trglist)};
				_myVehicles = _trg getVariable "checkVehicles";
				_myVehicles set [count _myvehicles, _veh];
				_trg setVariable ["checkVehicles",_myVehicles];
			}; 
		};
	} forEach _myVehicles;
	hint str _myVehicles;
};
};

Remember to remove all the comment lines // from the above or it will throw errors being in a trigger dialog.

test mission.sqm

  • Thanks 1

Share this post


Link to post
Share on other sites

@Larrow Thank You! This works perfectly!

Sorry i presumed from your 'I am hoping to accomplish this through scripting methods instead of grouping them to each trigger' that you were doing it all in script no worries

So the triggers are already editor placed, are the vehicles too?

Does the trigger OnAct need to know about each individual vehicle from the list that is in the trigger, or just that A vehicle from the list is?

Sorry I should have explained myself better... I was referring to dragging the grouping line from each vehicle to each trigger. Way too messy for the amount of triggers I have placed on the map.

---------- Post added at 14:28 ---------- Previous post was at 13:51 ----------

@Larrow,

Sorry, a lot of this stuff is beyond me lol.

How would I send a hint only to the players in the tank that activated the trigger?

Also: The reason I want the vehicles to activate the triggers is because the triggers are spawning targets in random locations. I'm trying to make it so the number of targets spawned correlates exactly with how many vehicles have activated the trigger instead of what I had before where for every person in the tank spawns a target... ended up being a bit much lol. So I need the trigger to not sleep at all. Would this sleep command be for the eventhandler or for the trigger?:

handle = [thisTrigger] spawn {
   _trg = _this select 0;
   _myVehicles = [veh1, veh2, veh3, veh4];
   _trg setVariable ["checkVehicles",_myVehicles];
   while {triggerActivated _trg} do {
       sleep 1;      <<<-------------------------this<<<------------
       _trglist = +(list _trg);
       {
           if (_x in _trglist) then {
               //do your stuff here _x being each individual vehicle
               player sideChat format["%1 in trig1",_x];


               //remove each vehicle from the list so you only process it once
               _myVehicles = _myVehicles - [_x];
               _trg setVariable ["checkVehicles",_myVehicles];

               //put vehicle back in list once it has left the trigger
               _handle = [_x, _trg] spawn {
                   private ["_trg","_trglist"];
                   _veh = _this select 0;
                   _trg = _this select 1;
                   _trglist = list _trg;
                   waitUntil{!(_veh in _trglist)};
                   _myVehicles = _trg getVariable "checkVehicles";
                   _myVehicles set [count _myvehicles, _veh];
                   _trg setVariable ["checkVehicles",_myVehicles];
               }; 
           };
       } forEach _myVehicles;
       hint str _myVehicles;
   };
};

Edited by SteelSampson

Share this post


Link to post
Share on other sites

First, Thank you for the PM, I'm still studying it.

So... I had several guys help me test my mission yesterday and apparently I did not understand how triggers operate.

Here's a screenshot of the trigger area I'm referring to: http://cloud-2.steampowered.com/ugc/884109618818867408/DA5155D480F2DD6D9E41451E8E08073725A23AE9/

My Goal: Have one target spawn for each vehicle(not player) that rolls through a trigger.

My Action: Putting this in the condition line of each of those triggers:

this && ({ _x in thislist} count [Tank2_1, Tank2_2, Tank2_3, Tank2_4, Tank2_1b, Tank2_2b, Tank2_3b, Tank2_4b] > 0) && isServer;

The Problem: The condition doesn't determine the activation of the trigger it only says "Don't activate until these conditions are met." So every time a full tank rolled though I was still getting four targets (for each of the players in the tank).

The Question:: Is there a way to tell the trigger to ignore the players and only activate once for each vehicle that trips the trigger? That way I only get 1 target for each tank.

Thanks

Share this post


Link to post
Share on other sites

by adding this it may limit it to the driver but as it's MP I could be wrong.

(player == driver vehicle player) && ({ _x in thislist} count [Tank2_1, Tank2_2, Tank2_3, Tank2_4, Tank2_1b, Tank2_2b, Tank2_3b, Tank2_4b] > 0) && isServer;

Share this post


Link to post
Share on other sites
by adding this it may limit it to the driver but as it's MP I could be wrong.

(player == driver vehicle player) && ({ _x in thislist} count [Tank2_1, Tank2_2, Tank2_3, Tank2_4, Tank2_1b, Tank2_2b, Tank2_3b, Tank2_4b] > 0) && isServer;

If I am understanding this right this would have the same effect. The trigger wouldn't be activated until these conditions were met, but then it would still spawn a target for every BLUFOR player in the tank. What I'm asking here is how to access the "Activation" field of the trigger and make it activate based on the vehicles in the trigger not the BLUFOR units in the trigger.

Share this post


Link to post
Share on other sites
First, Thank you for the PM, I'm still studying it.

So... I had several guys help me test my mission yesterday and apparently I did not understand how triggers operate.

Here's a screenshot of the trigger area I'm referring to: http://cloud-2.steampowered.com/ugc/884109618818867408/DA5155D480F2DD6D9E41451E8E08073725A23AE9/

My Goal: Have one target spawn for each vehicle(not player) that rolls through a trigger.

My Action: Putting this in the condition line of each of those triggers:

this && ({ _x in thislist} count [Tank2_1, Tank2_2, Tank2_3, Tank2_4, Tank2_1b, Tank2_2b, Tank2_3b, Tank2_4b] > 0) && isServer;

The Problem: The condition doesn't determine the activation of the trigger it only says "Don't activate until these conditions are met." So every time a full tank rolled though I was still getting four targets (for each of the players in the tank).

The Question:: Is there a way to tell the trigger to ignore the players and only activate once for each vehicle that trips the trigger? That way I only get 1 target for each tank.

Thanks

Aslong as Tank2_1 and Tank2_2 etc are the names of your vehicles and your OnAct is something simple like

_spawnedVehicle = createVehicle [vehicletype, pos, [], 0, "NONE"];

then it should only be spawning one per vehicle.

Show me what you have in your OnAct.

Share this post


Link to post
Share on other sites

This is what I have in the onAct field:

RR2t551 = createVehicle ["T55_TK_EP1",getMarkerPos "r2_1",["r2_2","r2_3","r2_4","r2_5","r2_6","r2_10","r2_19","r2_22"], 100, "NONE"];

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  

×