eviljack109 11 Posted February 4, 2018 I have a mission where an ammo box is sex to randomly spawn via some markers. The players are then going to teleport to aid box and defend around it. I have the teleporter set up, I have it so a marker will move to the box to clearly. Now I set up a sector control area synced to a trigger. The problem is I can't get this trigger to move to where the box is. I don't know if it's possible to sync the position of the trigger and the box but I would love some help. [] spawn { while {not isnull obj} do { _unitPos = getpos obj; "mrk" setmarkerpos _unitPos; trg attachTo _unitPos; }; }; This is the code I have in the init obj is the box mrk is the marker the follows the box and trg is the trigger. Thank you! Share this post Link to post Share on other sites
beno_83au 1369 Posted February 4, 2018 attachTo You can't attach something to a position. You could try either attaching the trigger to the box, or setPos'ing the trigger to the boxes position. Edit: Also, once the marker and trigger are in place you don't need to keep setting their positions in a constant loop if the box isn't moving. Share this post Link to post Share on other sites
eviljack109 11 Posted February 4, 2018 2 minutes ago, beno_83au said: attachTo You can't attach something to a position. You could try either attaching the trigger to the box, or setPos'ing the trigger to the boxes position. Tried that... didn't work Share this post Link to post Share on other sites
beno_83au 1369 Posted February 4, 2018 What did you try with the attachTo command? At a guess i would figure this still applies: https://forums.bohemia.net/forums/topic/156507-moving-a-trigger/?do=findComment&comment=2461335 Share this post Link to post Share on other sites
eviljack109 11 Posted February 5, 2018 Yeah I've tried... trg setPos obj; trg setPos _unitPos; trg attachTo [obj, [0,0,0]]; trg attachTo [_unitPos, [0,0,0]]; all of those. Share this post Link to post Share on other sites
eviljack109 11 Posted February 5, 2018 Fixed it! I had to put the code in the init of the box NOT the init.sqf. Thanks for the link, I skimmed it at first thinking "I already did this!" Then after some reading I learned of my mistake. 1 Share this post Link to post Share on other sites
pierremgi 4906 Posted February 5, 2018 There is no reason to fix your problem like this way. init.sqf or init field of the box do the same... even considering initialization order. Share this post Link to post Share on other sites
beno_83au 1369 Posted February 5, 2018 6 hours ago, pierremgi said: init.sqf or init field of the box do the same... I was going to say the same thing, but it sounds like all the spawning happens during the mission so trying to use commands in init.sqf on things that don't exist yet would explain why it would fail there. Share this post Link to post Share on other sites
pierremgi 4906 Posted February 5, 2018 If I'm right, the only things "not existing" at start, but placed in 3den (so we can speak about init box) are players if disabled AI in lobby. All other stuffs, simple objects, simulated or not, hidden or not, can serve the init purpose on each PC. You can run any script from any placed object in 3den (even init.sqf content if unscheduled). btw, init objects are run before init.sqf. Share this post Link to post Share on other sites