Home   Help Search Login Register  

Author Topic: Attatch trigger to a unit?  (Read 2574 times)

0 Members and 1 Guest are viewing this topic.

Offline stephen271276

  • Members
  • *
Attatch trigger to a unit?
« 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>?
« Last Edit: 01 Feb 2011, 12:42:08 by stephen271276 »

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Re: Attatch trigger to a unit?
« Reply #1 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).

Offline F2kSel

  • Members
  • *
Re: Attatch trigger to a unit?
« Reply #2 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.
« Last Edit: 01 Feb 2011, 14:13:13 by F2kSel »