Editor Codes

From 39th Battalion Wiki
Jump to navigation Jump to search


Index

Here you will find an expanding collection of codes that are useful for getting stuff done in the initialisation of mission objects.


Open/Close gate/door, trigger

  • Sliding gate
  1. Name gate (e.g. gate_1)
  2. Create trigger around or near gate
  3. Trigger activation:
gate_1 animate ["Door_1_Move", 1]; gate_1 animate ["Door_2_Move", 1];
  1. Trigger deactivation:
gate_1 animate ["Door_1_Move", 0]; gate_1 animate ["Door_2_Move", 0];
  • Swinging type gate/door
  1. Create trigger around or near gate
  2. Name gate (e.g. gate_2)
  3. Trigger activation:
gate_2 animate ["Door_1_Rot", 1];
  1. Trigger deactivation:
gate_2 animate ["Door_1_Rot", 0];

Notes: 1. 0 = close, 1 = open

Remove terrain objects, trigger

  1. Create trigger
  2. Trigger activation:
{
  _x hideObject true
} forEach (nearestTerrainObjects [position thisTrigger,[],((triggerArea thisTrigger select 0) + (triggerArea thisTrigger select 1)) /  2,false]);

Notes: 1. Will remove ALL terrain objects within trigger, however editor placed objects are ignored

Remove dead bodies from Garbage collection

In some instances, you would like to populate a FOB or checkpoint with dead bodies and have them stay during the mission to add atmosphere of something that went horribly wrong, without being deleted by the garbage collection system.

You can do this by name all the variables of units to be used as dead bodies body1, body2, etc. Open init.sqf and enter/modify the following:

removeFromRemainsCollector [body1, body2];
_killme = [body1, body2];
{_x setDamage 1} foreach _killme;

Note: Only line 1 and 2 are edited with unit names. Line 3 is just a loop to damage all under variable _killme

Animations by PLP, AI, script

Is the ‘one foot forward, weapon at rest’ position of AI looking a bit tired? Apply an animation to make NPC’s look more dynamic and alive.

  1. Ensure PLP_calmSoldier3.sqf is in script folder of mission
  2. Place NPC (non player character)
  3. In NPC init:
_nil = [0,"1",2,"3"] execVM "scripts\PLP_calmSoldier3.sqf"
  • Where:
  1. is NPC name.
  2. is animation type.
  3. is whether animation is “smoothly” adapted by NPC (not all animations support this being “TRUE”).
  4. is Gear State (best to leave as “ASIS”. Read as ‘as is’).
  • For example:
_nil = [this,"STAND",false,"ASIS"] execVM "scripts\PLP_calmSoldier3.sqf"

Notes:

  1. Animation types are available in the PLP_calmSoldier3.sqf file.
  2. This script is still being developed, but it seems to be more MP compatible than BIS animation functions.
  3. NPC will automatically react to combat.

Delete vehicle and crew, trigger

To relieve the server of computing the actions of live but unnecessary NPC vehicles, you may opt to remove the vehicle and crew by deleting it.

  1. Create trigger
  2. Trigger activation:
{{deleteVehicle _x} forEach crew _x + [vehicle _x]} forEach thisList;
  1. Force the vehicle via waypoint to pass through the trigger

Notes:

  1. The command does not prejudice; it will delete whatever enters it

IED detonation, trigger

IED named objects in the editor unfortunately have no way to detonate by themselves and as such remain an inert prop. The good thing is that any object, not just IED’s can be made to produce an explosion.

  1. Place down IED prop, or other object that is to explode
  2. Name IED (e.g. ied_1)
  3. Create trigger
  4. Trigger activation:
bomb="M_Mo_82mm_AT_LG" createVehicle (getPos ied_1); deletevehicle ied_1;

Notes:

  1. In the example, "M_Mo_82mm_AT_LG" is the classname of a laser guided 82mm Mortar munition that is used to reproduce an IED explosive effect.
  2. The munition type can be changed to something less or more significant depending on the desired outcome, for example “Bo_GBU12_LGB” is the effect of a GBU-12 Laser Guided Bomb.
  3. More ammunition class names can be found here. Testing is encouraged as

Texture, attach to object

A property called hidden selections exists in certain objects and as such a custom texture can be applied to them.

  • Create the image
  1. Most objects (not all) where textures can be applied, e.g. an existing sign or TV are the size ratio of 2:1 (2 wide x 1 high)
  2. Texture can only be JPG or PAA image format
  • Store image in img folder of mission
  • In init of object to be textured:
this setObjectTexture [0, "img\texture.paa"];

Notes:

  • For flags use;

this setFlagTexture "img\texture.paa";

Addaction, Interactable Object/Person

Adds the ability to interact with an AI and get them to give the player specific mission details

  1. In the init of AI place what you see below
this addAction[“INTERACTION TITLE (e.g. SPEAK TO MAYOR)”, {hintc "WHAT THE MAYOR WILL SAY"},nil,1.5,true,true,"","true",4,false,"",""];

NOTE: The “What the mayor will say” part can be as long as it needs to be, but is best done outside of arma so spelling can be checked and any errors corrected. https://community.bistudio.com/wiki/addAction

Interactable Intel

Adds intel to the map screen that any player on the server can read. It can be in written, visual (custom intel image) or a mixture of both on the map screen.

  1. Add this to the init of the intel object
if (isServer) then { this setVariable ["RscAttributeDiaryRecord_texture","img\INTEL.jpg", true]; [this,"RscAttributeDiaryRecord",["INTEL NAME","WHAT INTEL WILL SAY",""]] call bis_fnc_setServerVariable; this setVariable ["recipients", west, true]; };

ACE, make object carryable

  1. In init of object to be carryable
[this, true, [0,0,1], 0] call ace_dragging_fnc_setCarryable;
  • Where:
  1. [0,0,1] is x,y,z location of object relative to player
  2. , 0] is object rotation in degrees relative to player

ACE, make object loadable

  1. In Editor, locate and place ACE Module, Make Object Loadable
  2. Sync module with object(s) that require to be loadable into ACE Cargo

Waypoint, AI wait until trigger fired

In some instances, it may not be feasible or possible to sync a waypoint to a trigger for activation. This command in the waypoint will wait until a remote trigger has been activated.

  1. Create and name trigger, e.g. trigger_1
  2. In waypoint activation:
triggerActivated trigger_1
  1. NPC will wait at waypoint until trigger elsewhere is activated

Markers, create by Trigger or AddAction

During game, markers can be created not only by players but also by triggers, for example making task generation or information delivery more automated.

  • Create Marker by Trigger
  1. Create trigger
  2. In activation:
taskname = createMarker ["marker_name", [X,Y]]; "marker_name" setMarkerType "mil_box"; "marker_name" setMarkerColor "colorBLUFOR"; "marker_name" setMarkerText "WP1";
  • Where
  1. taskname is unique variable name for this entire task
  2. “marker_name” is unique name given to specific marker
  3. [X,Y] are the coordinates on the map the marker will appear
  4. setMarkerType, setMarkerColor are attributes to customise the marker
  5. setMarkerText is the label for the marker that will be seen in map
  • Create Marker by object AddAction
  1. Place and name object, e.g, Laptop called laptop_1
  2. In init of Laptop:
laptop_1 addAction ["Onscreen Prompt", {
   private _mrk = createMarker ["marker_name", [10000, 10000]];
   _mrk setMarkerType "mil_box";
   _mrk setMarkerColor "colorBLUFOR";
   _mrk setMarkerText "WP1";
}];
  1. Where "Onscreen Prompt" is a custom on screen message shown to players indicating an AddAction is available
  2. All other parameters are the same as by trigger, above.

Notes:

  1. Configuration choices for setMarkerType, setMarkerColor are available via their hyperlink.

Arsenal, attach to object

To create an unrestricted Arsenal on an object.

  1. Place object (e.g. barrel)
  2. In object init:
["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;

Teleport, trigger

Creates a simple one way transport system, between an entry trigger and an exit.

  • Create and in the name field enter “exit” , e.g. range
  • Create “entry” trigger
  1. Side to activate, e.g. BLUFOR
  2. Set repeatable
  3. Entry trigger Condition:
this
  1. Entry trigger On Activation:
{_x setPosATL (getPos range);} foreach thislist;

Object, attach to object

One or more objects, for example a weapon turret can be attached to other objects, like a truck becoming one synchronised entity.

  1. Create and name host object, e.g. a Ural and truck_1
  2. Create and name the object to be attached, e.g. a HMG turret and gun_1
  3. In object to be attached (turret) init:
gun_1 attachTo [truck_1,[0,0,1]];
  • Where [0,0,1] is x,y,z coordinates measured in metres relative to the host object (i.e.Ural). These values need to be adjusted in order to move the turret to your preferred location on the truck.

A Much easier way to perform the above in the 3DEN editor is to do the following.

  1. Create and name host object, e.g. a Ural and truck_1
  2. Create and name the object to be attached, e.g. a HMG turret and gun_1
  3. Postion the HMG turrent in the desidered postion in the 3DEN editor on the Ural.
  4. in the HMG turret init place the following code
[gun_1, truck_1, true] call BIS_fnc_attachToRelative;

If you want to attach more objects repeat the same process for every object, this also works for nesting objects inside say a open cargo box aswell.

Ammunition, unlimited

Gives ability to turrets to have unlimited ammunition.

  1. Place turret or vehicle
  2. In turret or vehicle init:
this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1;}]

Side alliance, trigger

Ability to set or change side 1 alliance to side 2.

  1. Place trigger
  2. In On Activation:
side1 setFriend [side2 , value]
  • Where side 1 is side to have an active behaviour change
  • side 2 is passive recipient of side 1 change
  • value will be:
  1. 0 = false
  2. 1 = true
  3. For example:
CIVILIAN setFriend [WEST , 1]
  • Says that Resistance (or Guerrilla) will be friendly with Opfor.

Notes:

  • Faction names:
  1. Blufor = WEST
  2. Opfor = EAST
  3. Guerilla = RESISTANCE
  4. Civilians = CIVILIAN
  • Be aware that this command only sets the friendliness of one side. If you want to have both sides attacking each other, you have to set both.
  • It is possible to make a side hostile towards itself. For example:
west setFriend [west, 0]

Radio Command restricting, trigger

Do you have radio trigger(s) that you only want activated by a particular player?

  1. Name player, e.g. curator
  2. In radio trigger Condition:
this && player == curator

Say3D

Sounds can be configured to broadcast within a certain range of an object or NPC. This function requires that a 16-bit OGG audio file already exist and the sound’s class variables have been set up in description.ext.

  1. Sample description.ext entry
class CfgSounds
{
   sounds[] = {};
   
   class mortar                            < classname of sound
   {
       name = "mortarsiren";               < name used in init fields
       sound[]={sound\siren.ogg, db+10,1}; < audio file/path, decibels, pitch
       titles[] = {0, ""};                 < only if subtitles will accompany
   };
};
  • In object’s init field, the classname of the sound is used with say3D
this say3D ["mortar", 300, 1];
  • Where
  1. this is an object where sound will originate
  2. “mortar” is classname of sound to be played
  3. 300 is range in metres from object sound should be heard
  4. 1 is pitch

Notes:

  • Sound looping. A sound will normally reach the end of its track length and stop. In order to force a track to loop, follow these steps:
  1. Create new soundLoop.sqf file in root of mission folder, and within:
_soundObject = _this select 0;
_trackLength = 30;              <edit
_delay = 0;                     <edit
while{True} do
{
 _soundObject say3D "generator";
 sleep _trackLength + _delay;
};
  • Where:
  1. _trackLength = is the length of the track played before restarting
  2. _delay = delay between track restarts
  • In object init field (sound source)
_nul = [this] execVM "soundLoop.sqf";

2. YouTube tutorial: https://www.youtube.com/watch?v=23gtR0tQhBQ

ACE Vanilla Damage Fix

In some unusual circumstances the vanilla medical system will apply itself to player injuries and ACE Medical is unable to recognise and hence no treatment avenues are available. The following code adds an option to the ACE self interaction menu in order to fully heal a player who may be afflicted. Copy and paste the following code into the initplayerlocal.sqf to initialise:

// ACE Vanilla damage fix
VanillaDamageFix = ['VanillaDamageFix','Fix Vanilla Damage',,{player setDamage 0},{_target == player},{}] call   ace_interact_menu_fnc_createAction;
[typeof player, 1, ["ACE_SelfActions"], VanillaDamageFix] call ace_interact_menu_fnc_addActionToClass;

SkipIntro

In some cases you will need to disable the intro.sqf from running when a player JIPs, if you are calling scripts within the Intro.sqf i.e. spawning a vehicle to a set position and setting its damage level to 1. Will result in the same action being executed for JIP resulting duplications and ruining the mission atmosphere.

Add the following code to the first line of the init.sqf

if (isServer) then {
 0 spawn {
    sleep 30;
    <scriptname> = true;
    publicVariable "SkipIntro";
 };
};

Add the following code to your script file intro.sqf as the 1st line.

if (!isNil "SkipIntro") exitWith {};

Searchlight, Action On

The following code, applied to a mounted Searchlight turret will switch On the Searchlight when the AI does not.

  1. Add the following code to the init box of the Searchlight:
this action ["lightOn", this];

setCaptive, trigger

Change a player’s status to civilian (setCaptive) when they are inside a trigger.

  • Place trigger
  • Set parameters
  1. Type: None
  2. Activation: Any Player
  3. Activation Type: Present
  4. Repeatable: On
  5. Condition:
player in thisList
  • On Activation:
player setcaptive true;
  • On Deactivation:
player setcaptive false;

Respawn in waves

Change the respawn values in the description.ext

From

respawnDelay = 99999;
respawnTemplates[] = {"ace_spectator"};

To

respawnDelay = 10;
respawnTemplates[] = {"ace_spectator","wave"};

Creating a Hold Enter to perform action

Adds an action to an object which requires the user to hold a key to perform the action can be used for such things like search fo intel or trigger a bomb, you will need to enter your code to execute for desired effect in the code execution on completion section.

Enter the code into the init section of any object or unit.

Example in mission using a HintC

 [
  Satphone,
  "Insert USB Hack Device",
  "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
  "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
  "_this distance _target < 3",
  "_caller distance _target < 3",
  {},
  {},
  {hintC "The device displays a bearing indicator 211 and remote station is connected, before the screen fades to black and becomes unresponsive." },
  {},
  [],
  12,
  0,
  true,
  false
 ] 
remoteExec ["BIS_fnc_holdActionAdd", 0, Satphone];

Addaction, move object to x,y,z

Although Addaction is covered elsewhere, this is documenting a way to use Addaction to move an object to new x,y,z coords.

this addAction ["My Action", "my script.sqf", [],1,false,true,"","_this distance _target < 2"];

Where:

  1. “My Action” = Name to display on action menu (String)
  2. “My script.sqf” = Commands or scripts to be run
  3. [] = Space to include arguments passed to script (optional)
  4. 1 = Priority of where it'll appear on the action menu list (Number)
  5. false = Display on center of the screen? True or False Boolean
  6. true = Close the action menu when used? True or False Boolean
  7. “” = Shortcut key (String, Optional)
  8. "_this distance _target < 2" = Condition (string, in this case distance to Addaction)

Example:

this addaction ["Launch Boat","boat_1 setpos  [16525.865,12485.36,0]; _this#0 removeAction _this#2",[],1,true,true,"","_this distance _target <2"]

Open vehicle door

Some doors on vehicles have an animation ability to be opened or closed on command. For instance you might want a door to be opened on game start to give the impression that it has just been exited for immersion.

  1. Identify classname of vehicle, e.g. C_IDAP_Van_02_vehicle_F
  2. Open Config Viewer (Eden/Tools/Config Viewer)
  3. Browse to and expand cfgVehicles
  4. Browse to and expand vehicle classname, in this case C_IDAP_Van_02_vehicle_F
  5. Browse to and expand UserActions
  6. Choose desired animation, for example Sidedoor_Open
  7. In right window frame, look for statement =
  8. Copy line (CTRL + C)
  9. Close Config Viewer (ESC)
  10. Paste line into init of vehicle
  11. Edit line so that only inside of quotes remains. That is:

From:

statement = "this animateDoor ['Door_3_source', 1]";

To:

this animateDoor ['Door_3_source', 1];

Note: Some vehicles have only limited animation options or none at all

Create Ambient Aircraft Flybys

Sometimes you want to spawn an air unit that moves from point A to point B, never engaging nor being engaged. It is set as captive and will despawn once it reaches its destination.

  • Setpoint A = [x,y,z] cordinates.
  • Setpoint B = [x,y,z] cordinates.
  • flying height = 100.
  • Speed vaule (LIMTED, NORMAL or FULL).
  • Aircraft classname.
  • Side which aircraft belongs to. (WEST, EAST, RESISTANCE)
[[SET_POINT_A,[SET_POINT_B],100,"FULL","B_Plane_Fighter_01_F",WEST] call BIS_fnc_ambientFlyby; 
  • create trigger.
  • set size radius 100 metres.
  • trigger type set to NONE.
  • trigger activation set to BLUEFOR.
  • copy the following code to On Activation field.
[[100,90,100],[500,400,100],100,"FULL","B_Plane_Fighter_01_F",WEST] call BIS_fnc_ambientFlyby; 

if you want to spawn more than one aircraft copy this code and set the trigger to repeat, this will randomly postion the aircraft in air, however it can sometimes spawn units closer causing them to explode mid air.

[[100+random 300-random 150,90,100],[500+random 300-random 150,400,100],100,"FULL","B_Plane_Fighter_01_F",WEST] call bis_fnc_ambientFlyBy;

Respawning on Static Boats

If you want to have players respawn on a static boat.

  • Place a empty marker in the area in which you want them to respawn and call it "respawn_west".
  • Postion a unit floor level on the deck in which you want to respawn on.
  • Open the units properties and copy the postion x vaule.
  • Copy the following code to your missions init.sqf file.
"respawn_west" setMarkerPosLocal [markerPos "respawn_West" select 0, markerPos "respawn_West" select 1, X];

where x = units postion x vaule found in the edit properties in eden.

Example code

"respawn_west" setMarkerPosLocal [markerPos "respawn_West" select 0, markerPos "respawn_West" select 1, 18];

Players will repsawn 18 metres above sea leave on the main deck of the aircraft carrier USS Freedom.

Looping sound with radio triggers

You may want to create a situation where you need a looping alarm which can be heard by players and can be toggled on and off by a radio trigger.

  • Find the source audio you would like to use. i.e. rocket attack siren.
  • Use audio editing software i.e. Audacity to create the audio file in .ogg format.
  • Create a folder called sounds under the mission folder.
  • Place the audio file in the sounds folder in your mission folder.
  • Open your init.sqf file and copy the following code
//=======================================================================================================================================
 publicVariable "alarmToggle";
//======================================================================================================================================= 
  • Save init.sqf file.
  • Open your description.ext copy the following code.
 //=======================================================================================================================================
  class CfgSFX
 {
	 class rocketattack
	 {
		 name = "Rocket Attack Siren";
		 sound0[]={"sound\rocket_attack.ogg", db+15, 1.0, 120, 1, 1, 1, 0};
		 sounds[]={sound0};
		 empty[]= {"", 0, 0, 0, 0, 0, 0, 0};
	 };
  };
  //=======================================================================================================================================
  • Save description.ext
  • Load mission file in 3DEN editor in ARMA 3.
  • In the editor place 3 triggers

Trigger 1

Set parameters

  1. Init text: Start Rocket Attack Siren
  2. Activation: None
  3. Activation: Radio Bravo
  4. Activation: Repeatable
  5. Condition: this
  6. On Activation: AlarmToggle = true;

Trigger 2

Set parameters

  1. Init text: Stop Rocket Attack Siren
  2. Activation: None
  3. Activation: Radio Bravo
  4. Activation: Repeatable
  5. Condition: this
  6. On Activation: AlarmToggle = false;

Trigger 3

Set parameters

  1. Init variable name: trgAlarm_1
  2. Activation: None
  3. Activation: None
  4. Activation: Repeatable
  5. Condition: AlarmToggle
  6. Effects SFX: Rocket Attack Siren
  • Place an object in which you want to have the sound coming from down in the 3DEN editor i.e. loudspeaker.
  • In the objects init copy the following code
trgAlarm_1 attachTo[this, [0,0,0]];
  • Now test your your mission, you be able to set off a alarm by opening the ingame radio and press Alpha to start and Bravo to cancel.

If you whish you have multiple objects playing the sound around a designated area.

  • Duplicate both the object and TrgAlarm_1 trigger.
    • When you duplicate the trigger the editor will increase the number value int the triggers variable field from TrgAlarm_1 to TrgAlarm_2.
  • Now on the duplicated object, update the init to the triggers new name which will be TrgAlarm_2.
  • Repeat this process as many times you like ensure the triggers variable name in the objects init matches so you don't have sounds playing in the middle of nowhere.

Create Live feed from a Playable UAV displayed on Monitors

In some scenarios you want to stream the live feed from a UAV for setting up mission atmosphere.

  • Create a file in you mission folder called UAV.sqf
  • Copy the following code to the UAV.sqf file.
/* create camera 1 and stream to render surface */
 cam_1 = "camera" camCreate [0,0,0];
 cam_1 cameraEffect ["Internal", "Back", "uavrtt_1"];
 
 /* create camera 2 and stream to render surface */
 cam_2 = "camera" camCreate [0,0,0];
 cam_2 cameraEffect ["Internal", "Back", "uavrtt_2"];
 
 /* create camera 3 and stream to render surface */
 cam_3 = "camera" camCreate [0,0,0];
 cam_3 cameraEffect ["Internal", "Back", "uavrtt_3"];

 /* attach cam to gunner cam position */
 cam_1 attachTo [uav, [0,0,0], "PiP0_pos"];

 /* attach cam to gunner cam position */
 cam_2 attachTo [uav, [0,0,0], "PiP0_pos"];

 /* attach cam to gunner cam position */
 cam_3 attachTo [uav, [0,0,0], "PiP0_pos"];

 /* make it zoom in a little */
 cam_1 camSetFov 0.01;

 /* make it zoom in a little */
 cam_2 camSetFov 0.01;

 /* make it zoom in a little */
 cam_3 camSetFov 0.01;

 /* switch cam to color*/
 "uavrtt_1" setPiPEffect [0];

 /* switch cam to white thermal */
 "uavrtt_2" setPiPEffect [2];

 /* switch cam to black thermal */
 "uavrtt_3" setPiPEffect [7];

 /* adjust cam orientation */
 addMissionEventHandler ["Draw3D", {
    _dir = 
        (uav selectionPosition "laserstart") /* when using the grayhawk use "laserstart", if using Darter use "PiP0_pos"*/
            vectorFromTo 
        (uav selectionPosition "commanderview"); /* when using the grayhawk use "commanderview", if using Darter use "PiP0_dir"*/
        cam_1 setVectorDirAndUp [
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
    ];
	cam_2 setVectorDirAndUp [
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
    ];
	cam_3 setVectorDirAndUp [
        _dir, 
        _dir vectorCrossProduct [-(_dir select 1), _dir select 0, 0]
    ];
 }];
  • Open the mission file in 3DEN editor.
  • Place a object down like a Rugged dual monitor.
  • Under the Rugged dual monitor objects properties set the following parameters
    • Texture #1#(argb,512,512,1)r2t(uavrtt_2,1)
    • Texture #2#(argb,512,512,1)r2t(uavrtt_3,1)
  • Place a trigger in the mission
    • Set parameters
      • Init variable name: None
      • Activation: None
      • Activation: None
      • Condition: this
      • On Activation : _null = execVM "uav.sqf";
  • Place a Grayhawk down in the mission
    • Change the Grayhawk variable name to UAV.

Play mission, monitor will now display camrea footage from the UAV.

Have Artillery Fire on Target, triggers

In some scenarios you want to have artillery or mortars firing at a location for either a mission object or setting up mission atmosphere.

  • Place a Artillery or Mortar unit down in the 3DEN editor.
  • Change the Variable Name to Arty_1
  • Create a Empty Marker place it on the map within the range of the Artillery or Mortars firing range.
  • Change the Variable name to Target_1
  • Place a trigger in the mission
    • Set parameters
      • Init variable name: None
      • Activation: None
      • Activation: None
      • Activation: Repeatable
      • Condition: this
      • On Activation : copy the below code.
_ammo = getArtilleryAmmo [Arty_1] select 0; 
_tgt = getMarkerPos "Target_1"; 
Arty_1 doArtilleryFire[_tgt,_ammo,20];
      • Timers: Min 30
      • Timers: Mid 30
      • Timers: Max 30

Play mission, you will now have either a Artillery or Mortar fire at the marker placed on the map every 30 seconds.

If you want to add more, just repeat the process again and ensure you update the Variable name for each unit and marker in the code placed into the On Activation in the trigger being used.

Teleport using addaction menu

In some missions you may want to add to the action menu to display a teleport location.

Create a .sqf file under your mission folder, name it teleport.sqf.

Copy the following code to teleport.sqf

//this addAction ["Teleport - destinationName","teleport.sqf",[objectName]];
// Get the destination.
_dest = (_this select 3) select 0;
// Get a random direction
_dir = 60;
// Move the person a few meters away from the destination (in the direction of _dir)
player SetPos [(getPos _dest select 0)-3*sin(_dir),(getPos _dest select 1)-0*cos(_dir)];

In 3DEN Editor place 2 flag pole objects down as an example.

Name each flag pole with a unquie name for example, we will name one HQ and Gunrange.

Propites for HQ Flag pole.

  • Variable Name = HQ
  • Init = this addAction ["Teleport - Gun Range","teleport.sqf",[gunrange]];

Propites for Gunrange Flag pole.

  • Variable Name = Gunrange
  • Init = this addAction ["Teleport - HQ","teleport.sqf",[hq]];

If you whish to create a hub area to teleport too and from, just repeate the steps above, in the HQ area add the new location. in the new location just copy the code that takes you back to HQ.

Create medivac sequence

In some scenarios you want to rescue a unit and escort him to an waiting evac unit, who will fly or drive away for either a mission object or setting up mission atmosphere.

For this example, an unconscious unit needs to be extracted from a area, loaded into a transport truck and than unloaded and loaded into a medivac helicopter, after the unit is loaded the helicopter will fly away and delete itself.

To accomplish this, do the following.

Place a unit down to be the unconscious unit.

Set the parameters of the unconscious unit to be the following

  • variable name: nil

init field copy the following code

this setUnconscious true;
this setcaptive true;
raaf = group this;

Now place a helicopter on the ground with an AI pilot.

Set parameters of the helicopter.

  • helicopter variable name ipdapheli.

Place a hold waypoint down near the helicopter.

Now place a tigger down in the mission.

Set parameters

  • Init variable name: None
  • Type: Skip Waypoint
  • Activation: None
  • Condition: copy the below code
 {_x in idapheli} count (units raaf) == {alive _x} count (units raaf);
  • On Activation: None

Than right click on the trigger and select Set Waypoint activation and sync it to the Hold Waypoint.

Create a move waypoint off map and place into the Activation the below code.

{{deleteVehicle _x} forEach crew _x + [vehicle _x]} forEach thisList;

the code above will delete the vehicle and crew so you don't have AI hovering in place the whole mission.

You will now have a helicopter that waits for a unconscious unit to be loaded before it can take off.