Jump to content
Sign in to follow this  
Fumbles88

Urgent - addAction Teleport Script help

Recommended Posts

RESOLVED - See third post for finished script.

Hi,

I've seen similar threads regarding addAction and Teleporting however seeing as I'm not essentially using a teleporting position that is 'set in stone' I want to find out if I have made some obvious mistakes.

The script is semi-urgent as I need/desire to use it for tonight's training session. The idea is that when they click on 'teleport' on the flagpole they are teleported between 1.5 and 2.5km from the 'objective' marker. They spawn 100m in the air and perform a pseudo t-10 static line drop. This works flawlessly in the editor however when I put it on a server for testing, no one can use it - we just click on 'teleport' and nothing happens.

Script is as follows -

//setPos.sqf by 2lt M Henderson [6thAB]
//18/08/2013 for patrolling MkI & misdrop-training
//PNCOTC 6thAD

private ["_radius","_locationx","_locationy","_locationz","_finalLocation","_pole","_unit"];

//Set if server condition
if (!isServer) exitWith{};

_pole = _this select 0 ;
_unit = _this select 1;

//Get objective marker position
_locationx = getMarkerPos "Objective" select 0;
_locationy = getMarkerPos "Objective" select 1;
_locationz = getMarkerPos "Objective" select 2;

//Set radius for spawn
_radius = random(2500);
while {_radius < 1500} do
	{
		_radius = random(2500);
	};

//Spawn Player
_finalLocation = [(_locationx) + _radius * sin(random 359), (_locationy) + _radius * cos(random 359), (_locationz) + 100];
_unit setPos _finalLocation;
_unit addweapon "ACE_ParachuteRoundPack";
_unit execVM "\x\ace\addons\sys_eject\jumpout_cord.sqf"; 

Any help would be much appreciated guys as this has me tearing my hair out!

EDIT: I would just like to add that I have already tried calling it as 'player' as opposed to _unit but that did not work either.

Edited by Fumbles88

Share this post


Link to post
Share on other sites

Actions are executed locally, remove the !isServer condition

Edited by columdrum

Share this post


Link to post
Share on other sites

Awesome, can't believe I never thought of that. It works - you just saved my bacon mate!

For those who want to use this script - here is the finished 'solution'

//setPos.sqf by 2lt M Henderson [6thAB]
//18/08/2013 for patrolling MkI & misdrop-training
//PNCOTC 6thAD

private ["_radius","_locationx","_locationy","_locationz","_finalLocation","_pole","_unit"];

_pole = _this select 0 ;
_unit = _this select 1;

//Get objective marker position
_locationx = getMarkerPos "Objective" select 0;
_locationy = getMarkerPos "Objective" select 1;
_locationz = getMarkerPos "Objective" select 2;

//Set radius for spawn
_radius = random(2500);
while {_radius < 1500} do
	{
		_radius = random(2500);
	};

//Spawn Player
_finalLocation = [(_locationx) + _radius * sin(random 359), (_locationy) + _radius * cos(random 359), (_locationz) + 100];
_unit setPos _finalLocation;
_unit addweapon "ACE_ParachuteRoundPack";
_unit execVM "\x\ace\addons\sys_eject\jumpout_cord.sqf";

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  

×