Jump to content
Sign in to follow this  
wobbleyheadedbob

Passing a value instead of a variable

Recommended Posts

I'v run into a bit of a snag with my script where I'm creating random, trigger-based IEDs.

I need to find a way to pass in the actual position value to the 'setTriggerStatements' call, otherwise I get an error due to the fact 'position _spawnObject' is meaningless on the player machine (since it's out of scope).

Are there any simple ways of doing this or are Script placed triggers a bad idea?

The Script:

private ["_spawnObject"];
_spawnObject = _this select 0; //Pointer to the Wreck object hiding an 'IED'

_trg=createTrigger["EmptyDetector",position _spawnObject]; 
_trg setTriggerArea[15,15,0,false];
_trg setTriggerActivation["WEST","PRESENT",false];
_trg setTriggerStatements["this", "nul='Bo_GBU12_LGB' createVehicle (position _spawnObject);hint 'BOOM!!!'", ""]; 

---------- Post added at 12:26 PM ---------- Previous post was at 12:07 PM ----------

Ok, nevemind. Finally found a solution:

_trg setTriggerStatements["this", "_bomb = nearestObject [getPos (thislist select 0), 'Man'];boom = 'Bo_GBU12_LGB' createVehicle position _bomb;hint 'BOOM!!!'", ""];

Now I just need to find out what class the objects I'm generating are in, yay!

Share this post


Link to post
Share on other sites
_trg setTriggerStatements["this", format ["'Bo_GBU12_LGB' createVehicle %1",position _spawnObject], ""];

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  

×