DaveP 66 Posted January 13, 2011 As the title suggests, I'm attempting to pass the name of a unit through a trigger's activation, which was originally spawned by the script. And failing. See below: _myman = _this select 0 //selecting the bloke _trg = "trigger" + _myman //as I believe the trigger needs to have a global variable for a name, correct? _trg = createTrigger["EmptyDetector",getPos _myman] _trg setTriggerArea[.5,2,0,false] _trg setTriggerActivation["CIV","PRESENT",true] _trg setTriggerStatements["this", "[_myman,(thislist select 0)] exec 'continueon.sqs'", ""] //this is where I imagine the problem is _trg attachTo [_myman,[0,1,0]] continueon.sqs starts with a simple _myman = _this select 0 and continues on from there, however it doesn't seem to catch the unit name, any ideas why? Is it because setTriggerStatements uses strings? Share this post Link to post Share on other sites
Muzzleflash 111 Posted January 13, 2011 This is what you set your triggers on activation to: [_myman,(thislist select 0)] exec 'continueon.sqs' It is the equivalent of writing that exact same piece of code into a triggers on act. However, a triggers on act is in some ways similar to a separate scripts. It does not know what _myman is. Triggers only work with global names. You need to get it to say the actual name of the unit where it say's _myman instead. If you need the unit and not just the name you will need a different approach. To do this you can use the format statement: _triggerOnAct = format "[%1,(thislist select 0)] exec 'continueon.sqs'", name _myman]; then put it in like this: _trg setTriggerStatements["this", _triggerOnAct, ""] Now will be the equivalent of: ["SomeName",(thislist select 0)] exec 'continueon.sqs' However, you script seems to conflict with it's uses of _myman: _trg = "trigger" + _myman Would suggest that _myman is a string not an object. _trg attachTo [_myman,[0,1,0]] Would suggest that _myman is a object and not a string. Oh btw, you need a semicolon at the end of all statements. Share this post Link to post Share on other sites
DaveP 66 Posted January 13, 2011 (edited) I get you on the formatting, good call The usage of _myman in the declaration of _trg was to give it a variable name that would be distinct to that unit and easily referred to I'm SQS scripting because I'm an old OFP scripting fart that doesn't stay up to date Also, for completion's sake, your line should read _triggerOnAct = format ["[%1,(thislist select 0)] exec 'continueon.sqs'", name _myman]; Edited January 13, 2011 by DaveP Share this post Link to post Share on other sites
galzohar 31 Posted January 13, 2011 You sure you want to use name and not vehicleVarName? Share this post Link to post Share on other sites
shuko 59 Posted January 13, 2011 _trg = "trigger" + _myman That doesn't do anything as the variable _trg is overwritten right after with the trigger object. Share this post Link to post Share on other sites