Jump to content
Sign in to follow this  
Loreansz

Arma 2 Teleport 2 People Limit

Recommended Posts

Hello, I'm currently trying to edit a script for my mission. Heres what I want: I want it so that only TWO players can use a teleport flagpole at a time. I'm trying to make a 1v1 mission for my friends and I and I don't want more than 2 people in the arena at once. What I was thinking was that I put a trigger down with a condition that will make it only activate when only two players are within' the trigger and it will teleport the two players to a marker.

This is the teleport script I'm using:

// To use: Add this script as an action on an item in it's init field. EG:
//
//this addAction ["Teleport - Talon","teleport.sqf",["FOB_Talon"]];
//this addAction ["Teleport - Base","teleport.sqf",["Base"]];
//this addAction ["Teleport - Airfield","teleport.sqf",["Airstrip"]];

// Where "Teleport - Base" is what the action will read and ["Base"] is the name of a pre-placed marker.

// Get the destination.
_dest = (_this select 3) select 0;

// Get a random direction
_dir = random 359;

// Move the person 15 meters away from the destination (in the direction of _dir)
player SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir)];

The problem here is, I don't know what to put into the trigger to make it so that it teleports the players and what I have to put in the condition so that it ONLY teleports when TWO players are in it and no more than two. I'm don't know very much lua and help would be appreciated. Thanks.

Share this post


Link to post
Share on other sites

I've made the mission and all I need is this script. Can anyone please help me?

Share this post


Link to post
Share on other sites

Not being MP scripter this may not work as intended. The bit I'm not sure about is this line if (isplayer _x and _inc < _limit) then { you'll have to try it.

Without isplayer _x and it will transport player and next nearest soldier including AI.

// To use: Add this script as an action on an item in it's init field. EG:
//
//this addAction ["Teleport - Talon","teleport.sqf",["FOB_Talon"]];
//this addAction ["Teleport - Base","teleport.sqf",["Base"]];
//this addAction ["Teleport - Airfield","teleport.sqf",["Airstrip"]];

// Where "Teleport - Base" is what the action will read and ["Base"] is the name of a pre-placed marker.

_pole = _this select 0;// the flag pole
_operator = _this select 1;// who flicks the switch

_limit = 2;// limit number to transport

// Get the destination.
_dest = (_this select 3) select 0;

// Get a random direction
_dir = random 359;

// Move the person 15 meters away from the destination (in the direction of _dir)

_whom = nearestobjects [_pole,["man"],10]-[_operator];// find units within 10 meters of flag excluding operator

_inc = 0;
{	
if (isplayer _x and  _inc < _limit) then {	
_x SetPos [(getMarkerPos _dest select 0)-10*sin(_dir),(getMarkerPos _dest select 1)-10*cos(_dir)];  
_inc=_inc+1;
};
} foreach [_operator]+_whom;// make sure operator teleports + next nearest man

Share this post


Link to post
Share on other sites

Sorry for late post, forgot to check this thread for 2-3 months because I got too lazy to make the mission. Thank you! That works almost to what I want it to work to, but I want it to only teleport you when two players are within' 10 meters of the pole. I was thinking maybe a trigger that adds the action to the pole once two people are within' it. I'll test it and post what happens.

---------- Post added at 06:55 ---------- Previous post was at 05:53 ----------

I got it working for when you walk in, it gives the player an option to teleport. Problem here, condition. Either I have to make a lot of triggers with

a distance trig1 < 10

I tried these, problem is that they don't work and I would have to continue it until there are no possibilities of units left

a AND b || a AND c
a AND b OR a AND c
a && b || a && c
a AND b distance trig1 < 10

Can someone give me a condition that may possibly work to teleport when a AND b are in the trigger? Sorry for sounding like such a noob with triggers, I don't use conditions very much unless using it to only activate a trigger when another trigger activates :P

Edited by mattstalker1234

Share this post


Link to post
Share on other sites

You could use inlist then use count to get the number of people in a trigger then compare it to 2 ill write it up for you when im home.

Share this post


Link to post
Share on other sites
You could use inlist then use count to get the number of people in a trigger then compare it to 2 ill write it up for you when im home.

Anything about that condition?

Edited by mattstalker1234

Share this post


Link to post
Share on other sites

I've been playing around with conditions recently, still haven't found one that works very well. Still waiting on that condition; would be very happy c:

Edit:

Thank the holy lords of Marma. I had the bright idea to use Bluebloods concept and do it myself.

triggerActivated act3 && player in thisList && count thisList == 1

for the teleport trigger and then put a trigger over that that has

player in thisList && count thisList == 2

Edited by mattstalker1234

Share this post


Link to post
Share on other sites

I'm really not following what your after.

But if you only want the action to show when two units are within then meters use the condition in the addaction

this addAction ["Teleport - Base","teleport.sqf",["Base"],1.5,true,true,"","_target distance _this <10  and count (nearestobjects [ getpos _this, ['man'] ,10]) == 2"]

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  

×