Common Scripting Tasks


Here’s some common scripting tasks that get used a lot.

    • Naming a Group – In the group leader’s init field put the following. You can then refer to the group as groupNamein other places like scripts and triggers.
      groupName = group this;

 

    • Starting in a vehicle – To start in a vehicle you can set each member of a group which includes a vehicle to In Cargo under the Specialbox in the editor, or place the following code in the Group Leader’s init field.
      {_x moveInCargo vehicleName} forEach units group this;

 

    • Deleting a vehicle– To properly delete a vehicle, you need to remove the crew first, like this.
      {deleteVehicle _x} forEach crew vehicleName + [vehicleName];

 

    • Stopping the “Hi” option – To stop players from being able to click on each other and say “Hi” constantly, use this code in your init.sqfto stop core conversations:
      player setVariable ["BIS_noCoreConversations", true];

 

    • Activate Trigger at a specific hour– To set off a trigger at a certain hour use the daytime command.  The number would be the hour on a 24 hour clock, so trigger at 7:00PM would be:
        daytime > 19

 

    • Set off a flare– To set off a flare without something shooting it use the following. Flare classnames can be “F_40mm_White”, “F_40mm_Green”, “F_40mm_Yellow” or “F_40mm_Red”. 250 is the height that it will be dropped from. Thanks to Wolle for the modelToWorld trick.
      _flare = "F_40mm_White" createVehicle (flare_1 modelToWorld [0, 0, 250]);

 

    • Get position based on thrown smoke– Here’s a method for getting a position based on a player throwing smoke thanks to Rocket:
      //init
      	_cpos = markerpos "center";
      	_radius = 1500;
      	_wait = 5;
      
      //loop check
      	while {alive c130} do {
      		_smokearray = _cpos nearObjects ["SmokeShell",_radius];
      		_qty = count _smokearray;
      		if (_qty > 0) then {
      			//Smoke has been dropped
      			_smoke = _smokearray select 0;
      			_smokepos = position _smoke;
      			hint format ["%1",_smokepos];
      		};
      		sleep 2;
      	};

 

    • Disable Stamina in ACE– Normally to turn off Stamina in ACE you’d place down the Stamina Disable module, however this disables the ruck system. [KH]Jman on the BIS forums posted this trick to keep rucks but turn off/down Stamina.
      player setVariable ["ACE_SYS_STAMINA_MULTI",0.0001];

Comments are closed.