Jump to content
Sign in to follow this  
braincrush

Attaching trigger to moving object

Recommended Posts

I'm looking for the answer to that question for a while now and i think this is the place to get the accurate one :

is there a way to attach a trigger to a moving object eg. car or AI ?

Share this post


Link to post
Share on other sites

in your init.sqf:

[] spawn {
 while {not isnull unit} do { "markerUnit" setmarkerpos getpos unit; sleep 0.5; };
};

Unit is the object you want marked and markerUnit is the name of a pre-placed marker.

Share this post


Link to post
Share on other sites

my god , that was quickest answer to any question i've ever asked :) thanks a bunch !

just one more quick question : now that i have my marker moving with the unit , should i use createTrigger and getpos from marker1 or should i pre-place a trigger and use setpos ? im not sure which one if any of them will work ?

Edited by braincrush

Share this post


Link to post
Share on other sites

Unless I'm miss reading it that's how to attach a maker to an object not a trigger.

For a trigger a simple way is to name the trigger trig1 and name the car car1 and in the objects init put trig1 attachto[car1,[0,0,0]]

Share this post


Link to post
Share on other sites

Erm, yeah, it does say trigger. Teach me to answer a question right after waking up! As F2k_Sel said, attachTo is your friend. :)

Share this post


Link to post
Share on other sites

oh i just thought that only way to do it is via marker position and since the marker is moving nicely with the object .... :) but obviously i was looking for the syntax you've posted , thanks !

actually the setmarkerpos will come really handy aswell now :)

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  

×