vrakpant 11 Posted February 28, 2016 Hi! I'm working on a small script to respawn a group of units upon death, mostly as an exercise, so inb4 links to respawn scripts on armaholic.My script is: _myGroup = createGroup West; _Soldier = _myGroup createUnit ["B_Soldier_F", getmarkerpos "start",[],0.8,"Sergeant"]; _Soldier2 = _myGroup createUnit ["B_Soldier_F", getmarkerpos "start",[],0.8,"private"]; _trg = createTrigger ["EmptyDetector", getPos _soldier]; _trg setTriggerActivation ["NONE", "PRESENT", false]; _trg setTriggerStatements ["((!alive _soldier) and (!alive _soldier2))", "hint 'test'",""]; And it passes without any error-messages in the editor, but when I kill _soldier and _soldier2, the hint at the end does not show up. Where did I go wrong, is it the names? Share this post Link to post Share on other sites
AZCoder 921 Posted February 28, 2016 Make the soldier names global, such as Soldier and Soldier2 without the underscore. Share this post Link to post Share on other sites
davidoss 552 Posted February 28, 2016 You cant use local variables in trigger code. Local variables are local for script after script done your local variables becomes undefined. You need to storage objects variable on the trigger using setvariable command like this: _myGroup = createGroup West; _Soldier = _myGroup createUnit ["B_Soldier_F", getmarkerpos "start",[],0.8,"Sergeant"]; _Soldier2 = _myGroup createUnit ["B_Soldier_F", getmarkerpos "start",[],0.8,"private"]; _trg = createTrigger ["EmptyDetector", getPos _soldier]; _trg setTriggerActivation ["NONE", "PRESENT", false]; _trg setVariable ["soldier", _Soldier]; _trg setVariable ["soldier2", _Soldier2]; _trg setTriggerStatements [" private ['_soldier', '_soldier2']; _soldier = thisTrigger getVariable 'soldier'; _soldier2 = thisTrigger getVariable 'soldier2'; !alive _soldier && !alive _soldier2", " hint 'test'; ","" ]; The difference between AZCoder proposition is that there will be no global variables "Soldier" and "Soldier2" on machine where the script was executed. 1 Share this post Link to post Share on other sites
vrakpant 11 Posted February 29, 2016 That did it! Thanks a lot! Share this post Link to post Share on other sites