Jump to content

Recommended Posts

A little bit of background first. I am an amateur scripter with a decent amount of mission making under my belt. Because of my amateur status I've had to rely on awesome people in my community and the arma 3 community in general to do what I wanted to do for my missions and templates. This was my very first step into what I consider really trying to create something that is a little different. I'm sure there are better ways to do what I've done, and I would love to hear them! But I just wanted to share this to hopefully help anyone who has also started the journey into arma 3 scripting.

 

To really get into things I'll start by saying that with the way my unit works in Arma 3 I make all of the mission templates for our operations. Which averages around 3-4 per week depending on mod updates, errors (on my part mostly!) module tweaks, etc. None of that really bothers me, what did bother me is when I got all of that out of the way and the mission works fine, and there is no need to update the template except for the fact that the unit has changed starting locations for a few players. ARGH! lol So with that in mind I went to youtube to try and figure something out and I cam across this nifty video:

 

 

I thought cool that would work. I could place the initial spawn right inside of a teleport zone and immediately have the players that load in move to that zone. Zeus can move whatever object it is to the new starting point for the week and I'll be able to perhaps make a few less templates on average. (Still need have updates and stuff right? yep, no worries.)

 

Well then I came up with a few more ideas to make it "better" which is certainly my own fault. So about a week and a half later, and lots of help from a few different people and a lot of browsing the wiki led me to this finally:

 

The Features:

- JIP Functional

- Enable or Disable the Teleport Manually

- Automatically Disable the Teleport if the Teleport Flag is deleted

- Automatically Renable the Teleport if the Teleport Flag is rebuilt

- Rebuild the Teleport Flag

- Delete the Teleport Flag

- Only Accessible by Zeus

- Automatically Add the Teleport Flag to Zeus at map start, and if rebuilt

- Spawn the players randomly around the flag (within 16 meters)

 

How it works:

1. Placed on the Map:

 

Player: controller

Player: s3ops

Player x 50: other names/players

ModuleCurator_F, name: zeusmod, owner: #adminLogged

ModuleCurator_F, name: zeusmod_1, owner: controller

ModuleCurator_F, name: zeusmod_2, owner: s3ops

flag named "s3_tf_spawn"

marker named "s3_tf_spawn_marker"

marker named "s3_tp_zone", size 16x16

"s3_tf_spawn" synced to ModuleCuratorAddEditableObjects

ModuleCuratorAddEditableObjects synced to 3 x ModuleCurator_F

trigger, size 0x0, activated repeatedly, blufor not present, condition "this && !alive s3_tf_spawn;", on act "s3_tf_spawn = nil;"

object (Laptop), name: s3_spawn

 

2. In the init.sqf:

s3_spawn addAction ["Enable Teleport to Flag", "scripts\s3_tp_enable.sqf"];
s3_spawn addAction ["Disable Teleport to Flag", "scripts\s3_tp_disable.sqf"];
s3_spawn addAction ["-----------",""];
s3_spawn addAction ["Rebuild Teleport Flag", "scripts\s3_spawn_s3_tf_spawn.sqf"];
s3_spawn addAction ["Delete Teleport Flag", "scripts\s3_delete_s3_tf_spawn.sqf"];
s3_spawn addAction ["-----------",""];
3. in the initplayerlocal.sqf:

waituntil {! isnull player};

if (player == player) then 
{
	null = execVM "scripts\s3_tp_init.sqf";
}
else {};
 

Now the Scripts:

 

4. s3_tp_init.sqf:

_run = true;

while {_run} do
{
	if(isNil "s3_tf_spawn") then
	{
			stopTeleporter = "yes"; 
			publicVariable "stopTeleporter";
	}
	else 
	{	
		if(isNil "stopTeleporter") then
		{
			stopTeleporter = "no"; 
			publicVariable "stopTeleporter";
		};
		if(stopTeleporter == "yes") then
		{
			_run = false;
		};
		if(player distance (getMarkerpos "s3_tp_zone") < 15) then
		{
			player setPos [(getPos s3_tf_spawn select 0)+((random 16)-8), (getPos s3_tf_spawn select 1)+((random 16)-8)];
		};
	};
	sleep 2;
};
5. s3_tp_enable.sqf:

_s3curators = allCurators;
_s3logic = getAssignedCuratorLogic player;

if(_s3logic in _s3curators) then 
{
	if(isNil "s3_tf_spawn") then
	{
		Hint "The Flag Does Not Exist, Please Rebuild it."
	}
	else 
	{	
		stopTeleporter = "no"; 
		publicVariable "stopTeleporter";
		["scripts\s3_tp_init.sqf","BIS_fnc_execVM",true,true] call BIS_fnc_MP;
		Hint "Teleport Enabled";
		sleep 2;
	};
}
else 
{
	Hint "You are not in the Zeus Slot, Access Denied."
};
6. s3_tp_disable.sqf:

_s3curators = allCurators;
_s3logic = getAssignedCuratorLogic player;

if(_s3logic in _s3curators) then 
{
	stopTeleporter = "yes"; 
	publicVariable "stopTeleporter";
	Hint "Teleport Stopped";
	sleep 2;
}
else 
{
	Hint "You are not in the Zeus Slot, Access Denied."
};
7. s3_spawn_s3_tf_spawn.sqf:

_s3curators = allCurators;
_s3logic = getAssignedCuratorLogic player;

if(_s3logic in _s3curators) then
{
	if(isNil "s3_tf_spawn") then
	{
		s3_tf_spawn = "FlagCarrierWest" createVehicle markerPos "s3_tf_spawn_marker";
		zeusmod addCuratorEditableObjects [[s3_tf_spawn],true];
		zeusmod_1 addCuratorEditableObjects [[s3_tf_spawn],true];
		zeusmod_2 addCuratorEditableObjects [[s3_tf_spawn],true];
		publicVariable "s3_tf_spawn";
		Hint "Teleport Flag Rebuilt";
	}
	else 
	{
		zeusmod addCuratorEditableObjects [[s3_tf_spawn],true];
		zeusmod_1 addCuratorEditableObjects [[s3_tf_spawn],true];
		zeusmod_2 addCuratorEditableObjects [[s3_tf_spawn],true];
		Hint "The Flag Already Exists, Added to Zeus."
	};
} 
else 
{
	Hint "You are not in the Zeus Slot, Access Denied."
};
8. s3_delete_s3_tf_spawn.sqf:

_s3curators = allCurators;
_s3logic = getAssignedCuratorLogic player;

if(_s3logic in _s3curators) then  
{
	deleteVehicle s3_tf_spawn;
	s3_tf_spawn = nil;
	publicVariable "s3_tf_spawn";
	Hint "Teleport Flag Deleted";
} 
else 
{
	Hint "You are not in the Zeus Slot, Access Denied."
};
If you have any questions on why, or how things worked feel free to ask and I shall answer to the best of my abilities.

Good luck and have a great one!

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

×