OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: stephen271276 on 01 Feb 2011, 12:20:25

Title: Attatch trigger to a unit?
Post by: stephen271276 on 01 Feb 2011, 12:20:25
Is it possible to attatch a trigger to a unit?
In a previous thread I asked about attatching a marker which is great now I need to attatch a trigger which will activate dialogue when the unit in question is found and approached>?
Title: Re: Attatch trigger to a unit?
Post by: SaOk on 01 Feb 2011, 12:47:25
The easiest way is to change trigger condition to e.g.:
Code: [Select]
player distance unitname < 5
The trigger size dont then matter and you can set it zero, instead you give the distance in that condition (in meters).
Title: Re: Attatch trigger to a unit?
Post by: F2kSel on 01 Feb 2011, 14:05:16
There are  a couple of ways to attach a trigger


name the trigger  trig1

then in a units init,gamelogic script ect   put this     trig1 attachto [unitname,[0,0,0]]
0,0,0 are x,y,z so it can be offset.
Z won't work on triggers but will be the height if used to attach an object to an object.

Also
 trig1 attachto [unitname]
would attach the trigger relative to the players position.

some objects usually small one can't be attached to anything using attachto.

You would then have to do it by  moving it to the object in a loop

trig1  setpos [getpos unitname select 0, getpos unitname select 2, getpos unitname select 2, ];

this would have to be used in a loop or it would move to just the current location as a one off.

SaOk is right though as that's all you need in this case. Keep it simple when you can.