Jump to content
Dj Rolnik

Teleport ai that enters a trigger

Recommended Posts

Hey,

 

It's probably simple but I cannot find a simple solution for it.

 

I would like to teleport individual AI that enter a trigger into a predefined spot (by coordinates).

 

Thanks in advance!

Share this post


Link to post
Share on other sites

You could basically use the same simple code of this video, but instead of teleporting them when pressing an action, the code would be in your trigger's activation field 😉
 

 

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, JCataclisma said:

the code would be in your trigger's activation field

Wouldn't work because you have a caller and the code has a switch which is best used with an addaction.

 

Ideally though not using any coordinate position, this code will work:

 

{if not (isPlayer _x) then {_x setPos (getMarkerPos "mark1 ")};} foreach thisList;

 

So what you do is the following:

1. Create a trigger, set it as anybody present

2. Put the code in the trigger's on activation box

3. Create a marker on the map name it mark1 or whatever you want and then put the name of the marker where it says

getMarkerPos "mark1  in the code, just replace or use mark1 with what your name is.

 

Heres a working example

 

You can always do something like this too if you want coordinates, though you'll need to get the exact coordinates you want to use:

https://forums.bohemia.net/forums/topic/213255-simple-auto-teleport-trigger/

 

  • Like 3

Share this post


Link to post
Share on other sites

For player with veh

------------

 

condition

 

this && player in thislist || vehicle player in thislist

 

Activation

 

if (vehicle player != player) then  

 
(vehicle player) setposatl [81.384,16777.488,211.453]; 
 
}else{ 
 
player setposatl [81.384,16777.488,211.453]; 
 
}

Share this post


Link to post
Share on other sites

this && player in thislist || vehicle player in thislist  ...

 

 

this & thisList are magic variables referring to:

- the preset condition like ANYBODY PRESENT (for this, and the preset condition only!)

- the list of units/vehicles matching this preset condition (only)

 

this &&...   may be useless here if you are already filtering with the preset condition. You can write that when you are setting a 2nd condition with no link with the preset one. Example:
Preset: BLUFOR PRESENT   condition:  this && triggerActivated someOtherTrig 

 

For all players:

this & player in thisList.... is just a convoluted way for:

ANY PLAYER PRESENT

and this  as condition. Simple.

Here vehicle player in thisList  : useless, trigger is activated for player on foot or player inside a vehicle

 

 

For BLUFOR (as example), two ways:

BLUFOR PRESENT

and vehicle player in thisList

vehicle player will activate the trigger even if player in on foot, because in this case: player is same as vehicle player.

Activation example: vehicle player setPos ([[81,16777,0],[184,15788,0]] select (vehicle Player isKindOf "CAManBase"));

 

or

ANY PLAYER PRESENT

and WEST countSide thisList >0

Activation example: {vehicle _x setPos ([[81,16777,0],[184,15788,0]] select (_x isKindOf "CAManBase"))} count (thisList select {side _x == WEST}) ;

  • Like 1

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

×