Jump to content
Sign in to follow this  
celtic_alliance

How can I start an infantry patrol with addAction?

Recommended Posts

Hello everyone. I am relatively new to scripting and I did search for what I'm about to ask but what I found didn't really fit the information I would like to find out.

I am working on a training mission for my clan. In this mission at a certain point people need to ambush a patrol with mines. For that to work I want the patrol to wait somewhere out of sight, only to start moving a predefined route once the people in question used the addAction to start the exercise.

I know how to add the addAction, and I do know how to put waypoints on the map in the editor but how do I make it so that once the addAction is used the patrol starts patrolling the waypoints?

I hope someone can steer me in the right direction?

Share this post


Link to post
Share on other sites

Hi!

Welcome to the forums! We hope you enjoy your stay!

My name is Ranwer (some people call me Rawner135, but I'm usually a pretty damn good scripter and your lucky to have me here posting ;) )

Anyways,

Ahh yes, the good-ol addAction (I love this script)

Before I begin, check out this link, it may help you too btw: https://community.bistudio.com/wiki/addAction

Now, to make an addAction is very simple, what you do is:

1. go in your arma 3 editor (any map, duhhh) and edit/create a unit.

2. once your in a dialog/window showing the init, name, rank, health, ammo etc. type this in: player addAction ["Begin Excercise", "begin.sqf"];

3. the begin.sqf is your script folder, head down to: My Documents\Arma 3 Other Profiles (or just plain ArmA 3)\missions (or mpmissions)\your mission name.

4. right click and go down to new, then new text file.

5. rename the text file completely to: begin.sqf, then launch it with notepad, MS Word, or WordPad.

This is where it gets fun...fun fun fun, haha...nvm...

6. Back in your editor, if you have just made one waypoint of the enemy convoy, edit the waypoint and name it "MyWaypoint1" and set the waypoint false so that way it doesn't activate...for now.

7. Head back into your opened "begin.sqf" file and just simply type: MyWaypoint1 = 1

And thats it! That's the basics of addAction!

If you would like to further know about other scripts, do not hesitate to reply in the thread or PM me :D

And also, this site will help you look up all the fun and little itsy bits of fun scripts to try out!: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3

Have a very happy Easter and have fun Scripting!

And before I go, here is an example template below:

Example completed addAction:

Unit init:

player addAction ["Begin Exercise", "begin.sqf"];

Convoy's Move waypoint is set to false for time being.

begin.sqf:

MyWaypoint1 = 1

Kind Regards,

Rawner135 / Ranwer

Edited by Ranwer

Share this post


Link to post
Share on other sites

Create a marker at the center point of the ambush area, then use the code given in the following post, and where you see "getPos _area" change it to "getMarkerPos _area".

http://forums.bistudio.com/showthread.php?185836-How-to-put-IED-s-on-the-road-hidden-and-how-to-create-a-basic-infantry-ambush&p=2823807&viewfull=1#post2823807

New example call line (to put in your addAction):

0 = ["mrkName",50] execVM "ambushGroup.sqf";

//addAction example

this addAction ["Start Ambush", {0 = ["mrkName",50] execVM "ambushGroup.sqf"},nil,6,true,true,"","_this distance _target < 5"];

Sorry, misread as you needing to create an ambush group :p.

You could actually use the above in the capacity of spawning the patrolling group, you would just need to script in your set of waypoints based on other predetermined positions.

Edited by JShock

Share this post


Link to post
Share on other sites

Thanks both. I am not out of the woods though, as I just got word what exactly we need for that mission. I'll explain.

Basically there is going to be two laptops, one to start and stop an infantry ambush exercise and another to start and stop a vehicle ambush exercise. Both exercises are supposed to be started and stopped by an instructor, and other players need to do the exercise. It also has to run properly on a rented server.

Now, here is what I am now supposed to create :)

  1. Make it run properly in a multiplayer setting on our rented server.
  2. Create addActions on both laptops. This is quite easy, but what I don't really understand yet is how to remove the current addAction and replace it with another one. Basically what we want is to have a "Start .... exercise" addAction to start the exercise, but once the exercise has started for it to be replaced by a "Stop ..... exercise" addAction. And vice versa.
  3. When we start the exercise spawn an infantry squad, or small vehicle convoy. I know how to do this, I am using the BIS_fnc_spawnGroup for this.
  4. When we stop the exercise despawn the infantry squad or vehicle convoy. I have no clue how to do this.
  5. When we start the exercise the squad or convoy needs to follow a specific set of waypoints. I don't know though how to set this up in a script. We have no waypoints set in the mission, so I was thinking that maybe I should place markers with names and make the script use those when setting up waypoints?

Hopefully someone can help me here :)

Share this post


Link to post
Share on other sites

3. For deleting units, use

{deleteVehicle _x} forEach crew vehicleName + [vehicleName];

.

Modify the syntax for your preferences.

5. forceMap - open the map, display instructions to click on the map n times to place n waypoints. Or https://community.bistudio.com/wiki/openMap

Try to use onMapSingleClick command: https://community.bistudio.com/wiki/onMapSingleClick

Spawn the _wps, edit their properties.

I've just put some guidelines for your script. It's pretty custom.

Share this post


Link to post
Share on other sites

2. At the end of each addAction code for start/stop, simply remove the currently "added" action, then add the opposite one:

removeAction (_this select 2);
(_this select 0) addAction ["Stop Exercise"....];

For #4 using the concept above pass in the return from BIS_fnc_spawnGroup in the arguments of the addAction, then do something like this within your stop code:

{deleteVehicle _x} forEach units (_this select 3) select 0;

Or if they are vehicles, pass in an array of those vehicles and use what Inlesco put above for each of them.

For #5, if it will always be the same path, I recommend the marker route, makes things easy.

Share this post


Link to post
Share on other sites

Sorry guys, I appreciate the help but I have no clue what you are talking about. I never scripted before, so I really do not understand what I should do and where. My level of knowledge in scripting is zero.

So, here goes.

I placed a laptop in the editor and gave it the name INF_Laptop in the NAME section when placing the laptop. In its init I added the following addAction code.

this addAction ["<t color='#00FF00'>Start infantry ambush exercise</t>", "INF_patrol_start.sqf",["INF_Laptop",0]];

Now, in the INF_patrol_start.sqf file I added the following code (and I think it is totally wrong, or at least parts of it are wrong).

_ILaptop = _this select 3 select 0;

_RAction = _this select 3 select 1;

INFpatrol = [getMarkerPos "INFSpawn", WEST, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")] call BIS_fnc_spawnGroup;

publicVariable "INFpatrol";

publicVariable "INF_Laptop";

_ILaptop removeAction _RAction;

_ILaptop addAction ["<t color=#FF0000'>Stop infantry ambush exercise</t>","INF_patrol_stop.sqf",["INF_Laptop",0,"INFpatrol]];

In the INF_patrol_stop.sqf file I added the following code.

_ILaptop = _this select 3 select 0;

_RAction = _this select 3 select 1;

_IDelete = _this select 3 select 2;

{deleteVehicle _x} forEach crew _IDelete + [_IDelete];

_ILaptop removeAction _RAction;

_ILaptop addAction ["<t color='#00FF00'>Start infantry ambush exercise</t>","INF_patrol_start.sqf",["INF_Laptop",0]];

As I said I think I did it wrong somehow. Like, how do I pass arguments to a script using addAction? And, how do I give the spawned infantry or vehicle patrol a name to use in the scripts? So, any suggestions or even example scripts would be appreciated.

Edited by Celtic_Alliance

Share this post


Link to post
Share on other sites

//Server
if ( isServer ) then {

//Default variables
infantryWPMarkers = [ "wp0", "wp1", "wp2", "wp3" ]; //Array of markers for group waypoints
infantrySpawnedGroups = []; //Array to hold groups that have been spawned for exercise

infantryExerciseRunning = false;
//Tell all machines 'infantryExerciseRunning' is false
publicVariable "infantryExerciseRunning";

//Function to start/stop exercise, called remotely from client using laptop
fnc_infantryExercise = {

	//exercise state
	switch ( infantryExerciseRunning ) do {

		//If true
		case ( true ) : {

			//Delete all spawned groups
			{
				{
					if !( isNull _x ) then {
						deleteVehicle _x;
					};
				}forEach units _x;
				deleteGroup _x;
			}forEach infantrySpawnedGroups;
			//Clear array
			infantrySpawnedGroups = [];

		};

		//If false
		case ( false ) : {

			//Spawn group
			_group = [
				getMarkerPos "INFSpawn",
				west,
				(configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")
			] call BIS_fnc_spawnGroup;
			//Add group to spawned array
			infantrySpawnedGroups pushBack _group;

			//Give group some waypoints based on marker array 'infantryWPMarkers'
			{
				_group addWaypoint [ getMarkerPos _x, 0 ];
			}forEach infantryWPMarkers;

		};
	};

	//Exercise state is now the opposite
	infantryExerciseRunning = !infantryExerciseRunning;
	//Update all clients with exercise state
	publicVariable "infantryExerciseRunning";

};
};

//Clients
if ( !isDedicated && hasInterface ) then {

//Store actionID on laptop
INF_Laptop setVariable [ "actionID",
	//Add action to laptop
	INF_Laptop addAction [ "Start Infantry Exercise",
		{

			//Ask server to START/STOP exercise
			[ [], "fnc_infantryExercise", false] call BIS_fnc_MP;

		},
		[],
		0,
		true,
		true,
		"",
		//Use Action condition to ...
		//Update action text based on PVed 'infantryExerciseRunning'
		//Only show action if user has variable of 'instructor' set to true
		"
			switch ( infantryExerciseRunning ) do {

				case ( true ) : {
					INF_Laptop setUserActionText [ _target getVariable 'actionID', 'Stop Infantry Exercise' ];
				};

				case ( false ) : {
					INF_Laptop setUserActionText [ _target getVariable 'actionID', 'Start Infantry Exercise' ];
				};
			};

			_this getVariable [ 'instructor', false ]
		"
	]
];

};

TESTMISSION

This is how i would likely go about this. One action that changes its title and asks the server to start/stop the exercise.

Share this post


Link to post
Share on other sites

Thanks man. That actually works quite well :)

I didn't start it from the init.sqf though, I just used execVM in the laptop init to start it.

Now I just need to change some bits to make sure I can use the same script for a vehicle convoy. Thanks again man :)

---------- Post added at 11:36 ---------- Previous post was at 11:20 ----------

One other question, how can I add colours to the addActions? The Start exercise needs to be green, the Stop exercise needs to be red. I tried doing it myself, but it doesn't work somehow...

Share this post


Link to post
Share on other sites
			//Use Action condition to ...
		//Update action text based on PVed 'infantryExerciseRunning'
		//Only show action if user has variable of 'instructor' set to true
		"
			switch ( infantryExerciseRunning ) do {

				case ( true ) : {
					_target setUserActionText [ _target getVariable 'actionID', '<t color=''#FF0000''>Stop Infantry Exercise</t>' ];
				};

				case ( false ) : {
					_target setUserActionText [ _target getVariable 'actionID', '<t color=''#00FF00''>Start Infantry Exercise</t>' ];
				};
			};

			_this getVariable [ 'instructor', false ]
		"

Share this post


Link to post
Share on other sites

Great! I got it working.

I have two more questions though.

1. There are two instructors who need to be able to start the exercise. How can I achieve this?

2. Can you show me how to despawn a vehicle convoy? I tried myself but I think I got it wrong.

Share this post


Link to post
Share on other sites
1. There are two instructors who need to be able to start the exercise. How can I achieve this?
As long as an instructors have the instructor variable set on them any should be able to see the actions.
2. Can you show me how to despawn a vehicle convoy? I tried myself but I think I got it wrong.
Show me what you have, what are you spawning? how are you assigning crew? do they have cargo (units) etc

Share this post


Link to post
Share on other sites

Basically I used the script you gave me for the infantry spawn and despawn, but changed the names of the variables in it to make sure it doesn't interfere with the infantry script. I also added some waypoint things to both scripts, such as combat mode etc.

I just wanted to spawn a small vehicle convoy with Ifrits or something but somehow I couldn't find them in the ConfigFile so tried something else. With the script as it is it actually does delete the crew but not the vehicles.

Here is what I have now.

//Server
if ( isServer ) then {

   //Default variables
   vehicleWPMarkers = [ "VP0", "VP1", "VP2", "VP3" ]; //Array of markers for group waypoints
   vehicleSpawnedGroups = []; //Array to hold groups that have been spawned for exercise

   vehicleExerciseRunning = false;
   //Tell all machines 'vehicleExerciseRunning' is false
   publicVariable "vehicleExerciseRunning";

   //Function to start/stop exercise, called remotely from client using laptop
   fnc_vehicleExercise = {

       //exercise state
       switch ( vehicleExerciseRunning ) do {

           //If true
           case ( true ) : {

               //Delete all spawned groups
               {
                   {
                       if !( isNull _x ) then {
                           {deleteVehicle _x} forEach crew _x + [_x]; 
                       };
                   }forEach units _x;
                   deleteGroup _x;
               }forEach vehicleSpawnedGroups;
               //Clear array
               vehicleSpawnedGroups = [];

           };

           //If false
           case ( false ) : {

               //Spawn group
               _group = [
                   getMarkerPos "VEHSpawn",
                   east,
                   (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Armored" >> "OIA_TankPlatoon")
               ] call BIS_fnc_spawnGroup;
               //Add group to spawned array
               vehicleSpawnedGroups pushBack _group;

               //Give group some waypoints based on marker array 'vehicleWPMarkers'
               {
                   _group addWaypoint [ getMarkerPos _x, 0 ];
                   [ _group, 1 ] setWayPointBehaviour "SAFE";
                   [ _group, 1 ] setWayPointFormation "COLUMN";
                   [ _group, 1 ] setWayPointCombatMode "BLUE";
               }forEach vehicleWPMarkers;

           };
       };

       //Exercise state is now the opposite
       vehicleExerciseRunning = !vehicleExerciseRunning;
       //Update all clients with exercise state
       publicVariable "vehicleExerciseRunning";

   };
};

//Clients
if ( !isDedicated && hasInterface ) then {

   //Store actionID on laptop
   VEH_Laptop setVariable [ "actionID",
       //Add action to laptop
       VEH_Laptop addAction [ "Start convoy ambush exercise",
           {

               //Ask server to START/STOP exercise
               [ [], "fnc_vehicleExercise", false] call BIS_fnc_MP;

           },
           [],
           0,
           true,
           true,
           "",
           //Use Action condition to ...
           //Update action text based on PVed 'vehicleExerciseRunning'
           //Only show action if user has variable of 'instructor' set to true
           "
               switch ( vehicleExerciseRunning ) do {

                   case ( true ) : {
                       VEH_Laptop setUserActionText [ _target getVariable 'actionID', '<t color=''#FF0000''>Stop convoy ambush exercise</t>' ];
                   };

                   case ( false ) : {
                       VEH_Laptop setUserActionText [ _target getVariable 'actionID', '<t color=''#00FF00''>Start convoy ambush exercise</t>' ];
                   };
               };

               _this getVariable [ 'instructor', false ]
           "
       ]
   ];

};

Edited by Celtic_Alliance

Share this post


Link to post
Share on other sites

Getting a nice convoy setup is a task in itself.

If it was me i would write a script that spawns your convoy as you want (maybe using the VEHspawn marker and direction as the head vehicle position) and then call this from the case false, passing back an array of all vehicles and units involved rather than trying to use a CfgGroups entry.

Quick fix fudge to delete groups including vehicles as it currently is...

{
{
	if !( isNull _x ) then {
		//If the unit is in a vehicle
		if ( vehicle _x != _x ) then {
			//Delte the vehicle
			deleteVehicle vehicle _x;
		};
		//Delete the unit
		deleteVehicle _x;
	};
}forEach units _x;
deleteGroup _x;
}forEach vehicleSpawnedGroups

Although if a vehicle gets left empty (can not move and crew have bailed) then that vehicle is not going to get deleted.

As i said above, you would be better off making a function to spawn a convoy then pass all units, vehicles and a group reference back to this code to apply waypoints and be ready for deletion.

Share this post


Link to post
Share on other sites

Right, so I have two nice challenges facing me then. And I don't know where to start :)

1. Set up a convoy of a maximum of four vehicles, including crew. I think I should first use createVehicle to spawn the vehicles, then spawn the units with createUnit or use BIS_fnc_spawnGroup, let them board the vehicles and add them all (vehicles + units) to one group. I have no clue how to get all this working though, but I'll give it a try.

2. Create that function. Again, I don't even know where to start.

And 3, make it possible to clean up the destroyed vehicles and dead bodies. That is not a priority though.

Share this post


Link to post
Share on other sites

Well, I tried doing this myself but no go. I was able to spawn four vehicles and crew with BIS_fnc_spawnVehicle, and I think I added all of them to one group but...

1. I have no clue how to add waypoints to each vehicle.

2. I am not sure how to change the code to remove the units and vehicles when the Stop exercise action is selected.

Here is what I have so far.

//Server
if ( isServer ) then {

   //Default variables
   vehicleWPMarkers = [ "VP0", "VP1", "VP2", "VP3" ]; //Array of markers for group waypoints
   vehicleSpawnedGroups = []; //Array to hold groups that have been spawned for exercise

   vehicleExerciseRunning = false;
   //Tell all machines 'vehicleExerciseRunning' is false
   publicVariable "vehicleExerciseRunning";

   //Function to start/stop exercise, called remotely from client using laptop
   fnc_vehicleExercise = {

       //exercise state
       switch ( vehicleExerciseRunning ) do {

           //If true
           case ( true ) : {

               //Delete all spawned groups
               {
                   {
                       if !( isNull _x ) then {
                           //If the unit is in a vehicle
                           if ( vehicle _x != _x ) then {
                               //Delete the vehicle
                               deleteVehicle vehicle _x;
                           };
                           //Delete the unit
                           deleteVehicle _x; 
                       };
                   }forEach units _x;
                   deleteGroup _x;
               }forEach vehicleSpawnedGroups;
               //Clear array
               vehicleSpawnedGroups = [];

           };

           //If false
           case ( false ) : {

               //Spawn group
               _group = [];
               _grp1 = [
                   getMarkerPos "VEHSpawn",
                   270,
                   "O_MRAP_02_hmg_F",
                   east
               ] call BIS_fnc_spawnVehicle;

               _grp2 = [
                   getMarkerPos "VEHSpawn1",
                   270,
                   "O_MRAP_02_hmg_F",
                   east
               ] call BIS_fnc_spawnVehicle;

               _grp3 = [
                   getMarkerPos "VEHSpawn2",
                   270,
                   "O_MRAP_02_hmg_F",
                   east
               ] call BIS_fnc_spawnVehicle;

               _grp4 = [
                   getMarkerPos "VEHSpawn3",
                   270,
                   "O_MRAP_02_hmg_F",
                   east
               ] call BIS_fnc_spawnVehicle;

               [ _grp1,_grp2,_grp3,_grp4 ] join _group;

               //Add group to spawned array
               vehicleSpawnedGroups pushBack _group;

               //Give group some waypoints based on marker array 'vehicleWPMarkers'
               {
                   ( _group select 2 ) addWaypoint [ getMarkerPos _x, 0 ];
                   [ ( _group select 2 ), 1 ] setWayPointBehaviour "SAFE";
                   [ ( _group select 2 ), 1 ] setWayPointSpeed "LIMITED";
                   [ ( _group select 2 ), 1 ] setWayPointFormation "COLUMN";
                   [ ( _group select 2 ), 1 ] setWayPointCombatMode "BLUE";
               }forEach vehicleWPMarkers;

           };
       };

       //Exercise state is now the opposite
       vehicleExerciseRunning = !vehicleExerciseRunning;
       //Update all clients with exercise state
       publicVariable "vehicleExerciseRunning";

   };
};

//Clients
if ( !isDedicated && hasInterface ) then {

   //Store actionID on laptop
   VEH_Laptop setVariable [ "actionID",
       //Add action to laptop
       VEH_Laptop addAction [ "Start convoy ambush exercise",
           {

               //Ask server to START/STOP exercise
               [ [], "fnc_vehicleExercise", false] call BIS_fnc_MP;

           },
           [],
           0,
           true,
           true,
           "",
           //Use Action condition to ...
           //Update action text based on PVed 'vehicleExerciseRunning'
           //Only show action if user has variable of 'instructor' set to true
           "
               switch ( vehicleExerciseRunning ) do {

                   case ( true ) : {
                       VEH_Laptop setUserActionText [ _target getVariable 'actionID', '<t color=''#FF0000''>Stop convoy ambush exercise</t>' ];
                   };

                   case ( false ) : {
                       VEH_Laptop setUserActionText [ _target getVariable 'actionID', '<t color=''#00FF00''>Start convoy ambush exercise</t>' ];
                   };
               };

               _this getVariable [ 'instructor', false ]
           "
       ]
   ];

};

Share this post


Link to post
Share on other sites

Since I'm not in the mood for explaining:

_vehicleSpawnedUnits = [];
_group = (_grp1 select 2);

{
_vehicleSpawnedUnits = _vehicleSpawnedUnits + (_x select 1);
vehicleSpawnedGroup pushBack (_x select 0);
} forEach [_grp1,_grp2,_grp3,_grp4];

_vehicleSpawnedUnits joinSilent _group;

{
_group addWaypoint [getMarkerPos _x,0];
[_group,1] setWaypointBehaviour "SAFE";
[ _group, 1 ] setWayPointSpeed "LIMITED";
[ _group, 1 ] setWayPointFormation "COLUMN";
[ _group, 1 ] setWayPointCombatMode "BLUE";
} forEach vehicleWPMarkers;

{
vehicleSpawnedGroup pushBack _x;
} forEach _vehicleSpawnedUnits;

Then in your stop exercise script:

{
deleteVehicle _x;
} forEach vehicleSpawnedGroup;

Edited by JShock

Share this post


Link to post
Share on other sites
//Server
if ( isServer ) then {

//Default variables
vehicleWPMarkers = [ "VP0", "VP1", "VP2", "VP3" ]; //Array of markers for group waypoints
vehicleSpawnedInfo = []; //Array to hold vehicle info that has been spawned for exercise

vehicleExerciseRunning = false;
//Tell all machines 'vehicleExerciseRunning' is false
publicVariable "vehicleExerciseRunning";

//Function to start/stop exercise, called remotely from client using laptop
fnc_vehicleExercise = {

	//exercise state
	switch ( vehicleExerciseRunning ) do {

		//If true
		case ( true ) : {

			//Delete all spawned
			_group = grpNull;
			{
				_veh = _x select 0;
				_crew = _x select 1;
				_group = _x select 2;

				{
					deleteVehicle _x;
				}forEach _crew;

				deleteVehicle _veh;

			}forEach vehicleSpawnedInfo;
			//Only delete the group once everything else has been deleted
			//As all vehicles belonged to the same group we can just delete the last group reference
			deleteGroup _group;

			//Clear array
			vehicleSpawnedInfo = [];

		};

		//If false
		case ( false ) : {

			//Make sure SIDE exists
			_side = createCenter east;

			//Create group
			_group = createGroup _side;

			//Spawn position Offset
			//20m seems reasonable for MRAPs as to not make them manoeuvre for space on spawn
			_spawnOffset = 20;

			//Spawn 4 vehicles with crew
			for "_i" from 0 to 3 do {

				//Spawn each vehicle _spawnOffset distance behind each other
				//trailing away from the marker
				_pos = [
					getMarkerPos "VEHSpawn",
					_spawnOffset * _i,
					markerDir "VEHSpawn" + 180
				] call BIS_fnc_relPos;

				//Spawn vehicle with crew into group
				_vehInfo = [
					_pos,
					markerDir "VEHSpawn",
					"O_MRAP_02_hmg_F",
					_group
				] call BIS_fnc_spawnVehicle;

				//Add vehInfo to spawned array
				vehicleSpawnedInfo pushBack _vehInfo;

			};

			//Give group some waypoints based on marker array 'vehicleWPMarkers'
			{
				_wp = _group addWaypoint [ getMarkerPos _x, 0 ];
				_wp setWaypointBehaviour "SAFE";
				_wp setWaypointSpeed "LIMITED";
				_wp setWaypointFormation "COLUMN";
				_wp setWaypointCombatMode "BLUE";
			}forEach vehicleWPMarkers;

		};

	};

	//Exercise state is now the opposite
	vehicleExerciseRunning = !vehicleExerciseRunning;
	//Update all clients with exercise state
	publicVariable "vehicleExerciseRunning";

};
};

//Clients
if ( !isDedicated && hasInterface ) then {

//Store actionID on laptop
VEH_Laptop setVariable [ "actionID",
	//Add action to laptop
	VEH_Laptop addAction [ "Start convoy ambush exercise",
		{

			//Ask server to START/STOP exercise
			[ [], "fnc_vehicleExercise", false] call BIS_fnc_MP;

		},
		[],
		0,
		true,
		true,
		"",
		//Use Action condition to ...
		//Update action text based on PVed 'vehicleExerciseRunning'
		//Only show action if user has variable of 'instructor' set to true
		"
			switch ( vehicleExerciseRunning ) do {

				case ( true ) : {
					VEH_Laptop setUserActionText [ _target getVariable 'actionID', '<t color=''#FF0000''>Stop convoy ambush exercise</t>' ];
				};

				case ( false ) : {
					VEH_Laptop setUserActionText [ _target getVariable 'actionID', '<t color=''#00FF00''>Start convoy ambush exercise</t>' ];
				};
			};

			_this getVariable [ 'instructor', false ]
		"
	]
];

};

and updated TESTMISSION

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  

×