The code examples begin with a prefered calling method which is abbreviated
- The Event-Scripts
- initPlayerLocal.sqf
- initServer.sqf
- init Field of a unit
- Plane.init: The init-field of a plane
- In activation of a Trigger
- Trigger.OnActivation
- spawns ammunition box with parachute.
- land box safely (error: stuck in tree)
- spawn enemy patrol as a drawback
initPlayerLocal.sqf:
player addAction ["Spawn Ammobox", { _this call compile preprocessFileLineNumbers "ammoBox.sqf"; }];
Lets group of artillery fire simultaneously at targets (with deviation). Source artillery verhicle and target object are hard coded.
Trigger.OnActivation:
[] call compile preprocessFileLineNumbers "artillery.sqf";
Cleanup (land) units around marker (if no friendly unit present)
initPlayerLocal.sqf:
player addAction ["Cleanup Iraklia", Spec_fnc_cleanup, [player,"cleanup_1",2000]];
Destroys units (Man and LandVehicle) around given marker with given radius.
Trigger.OnActivation:
["target1", 500] call compile preprocessFileLineNumbers "destroyUnits.sqf";
- spawns helicopter at defined marker (private _markerNameHeliSpawn = "heli_spawn";)
- fly to player
- liftoff if no man nearby
- destination marker (private _markerNameBase = "ende";)
initPlayerLocal.sqf:
player addAction ["Call MedEvac", { _this call compile preprocessFileLineNumbers "heli_evac.sqf"; }];
simple script for a service point to perform a maintenance (repair, refuel, reammo) with german hints http://www.tacticalteam.de/content/script-servicepoint
Trigger.OnActivation:
[thisList select 0] call compile preprocessFileLineNumbers "hh_service.sqf";
3 examples to hide terrain objects in the initServer.sqf
jk_medicTent.sqf (by jokoho48)
Adds a Medical Tent to vehicles which can be built and used as an ACE medical facility has to be torn down before it can be constructed again.
- add vehicles to JK_Medical_Vehicles (
JK_Medical_Vehicles = [zamak_medic];
) - execute script on mission start (e.g. initPlayerLocal.sqf:
[] call compile preprocessFileLineNumbers "jk_medicTent.sqf";
)
Variant using Backpacks
- add class names of supported backpacks to JK_SupportedBackpacks (
JK_SupportedBackpacks = ["B_Carryall_mcamo"];
) - execute script on mission start (e.g. initPlayerLocal.sqf:
[] call compile preprocessFileLineNumbers "jk_medicTent_backpack.sqf";
)
take and put down a laptop - in initPlayerLocal.sqf
- addAction to take a laptop (which is attached to the player) - attacheLaptop.sqf (see header for example usage)
- addAction to the player to put the attached laptop down - detachLaptop.sqf (see header for example usage)
Checks if anything for a mission has been forgotten (e.g. respawn marker).
Places playable units in 3DEN Editor. Sets callsignes, frequencies and loadout variables.
Spawn pilots into plane (plane takes off) and assigns waypoints (with flyInHeight). The names of the waypoints as well as other stuff are hard coded (_markerNameWaypoints = ["wp1","wp2"];
)
MyPlane.init:
this addAction ["We are ready for take off.", {
params ["_target", "_caller"];
_target setVariable ["takeOffStarted", true, true];
[_target] call compile preprocessFileLineNumbers "plane.sqf";
}, [], 1.5, false, true, "", "!(_target getVariable [""takeOffStarted"", false])"];
Spawn vehicle at defined marker (private _markerVehicleSpawn = "marker_spawner";) if no vehicle of same type nearby.
Noticeboard.init:
this addAction ["Spawn Vehicle", { _this call compile preprocessFileLineNumbers "spawn_vehicle.sqf"];
simple caching script for infantry
- spawn groups in editor and set waypoints
- add in init field:
[this, numberOfGroup ] call Spec_cache_fnc_cacheGroup;
- to spawn unit call (e.g. in trigger):
numberOfGroup call Spec_cache_fnc_spawnGroup;
- numberOfGroup is unique (otherwise error is shown)
- see error that vehicle with crew can not be cached
- go near offroad to spawn patrolling team
- go to nearest armored vehicle to spawn crew at furthest armored vehicle (gets in and drives off)
ACE Cargo droppable in flight with Parachute
- pilot and gunner (with EventHander GetIn) can drop ACE Cargo (interaction with plane)
- dropped cargo will land safely (see addParachute)
- optional: small crates (NATO_Box_Base) can be packed into big supply crate (
[player] call Spec_cargoDrop_fnc_addPackAction;
)
Plane.init:
[this] call Spec_cargoDrop_fnc_addParaDropEvent;
Simple AI checkpoint script with smuggler (and intel) via ACE action.
- in Waypoint add to onAction:
[this,"marker_target"] call Spec_checkpoint_fnc_addPassCheckAction;
- then vehicle and unit has ace action to pass the checkpoint and drives to given marker position
- in vehicle of smuggler add:
[this call Spec_checkpoint_fnc_loadSmugglerItems;
to load nearby items (see const.hpp) into ace cargo - in initPlayerLocal of HQ add:
[this] call Spec_checkpoint_fnc_addTakeIntelAction;
to show how many smuggler reached their target - to take (intel objects) via ace action add:
[this] call Spec_checkpoint_fnc_addTakeIntelAction;
Simple construction script for static objects. A player or object can have an interaction to initiate construction progress (for a single object). In addition a object can be assigned multiple objects of one type (inclusively race conditions).
[truck,typeOf object, name of object, (number of animation),(number of objects)] call Spec_construct_fnc_objectAddConstructionStation;
[player,actionID, name of action, typeOf object, (number of animation)] call Spec_construct_fnc_playerAddConstructAction;
Template for ammo crates
- After mission start (fn_postInit.sqf) all available crates are searched for specific types and refilled (e.g. "TTT_Logistik_Medic_Bw" is filled with ACE medic content)
- Contains a crate filler
Adds ACE action to all crates to edit the display name in ACE cargo.
- add "CfgFunctions.hpp" to "CfgFunctions" in description.ext
- add "DescriptionExt.hpp" to description.ext (or "CfgEventHandlers.hpp" to "Extended_Init_EventHandlers" in description.ext)
- to name a crate in editor add to init field:
if (isServer) then { this setVariable ["ace_cargo_displayName", "My Crate", true]; };
Adds a waypoint to a single unit where a "farming" animation (crouch and stand up) is executed and another waypoint added.
- place (rectangle) marker to define a farming area
- place single civilian
- in init field:
this setVariable ["Spec_farming_marker", "marker_0"];
- in init field:
- add action to assign vehicle to provide full heal if player enters this tagged vehicle he will be healed with ACE personal aid kit and get some bandages (if not exist in backpack
initPlayerLocal.sqf:
[noticeboard_spawnerA, "spawnerA", 1, 5] call Spec_fullheal_fnc_addAssignVehicleAction;
two different upgrades of heli_evac.sqf which use a helicopter placed in the editor
- Spec_heli_fnc_taxi (taxi.sqf) and Spec_heli_fnc_moveMarkerLZ (moveMarkerLZ.sqf)
- choose ace action to mark a LZ
- if player clicks on map a LZ marker will be placed (visible for everyone and unique name)
- if helicopter is called flies to marker position and flies off to base if no man nearby
- Spec_heli_fnc_medEvac (medEvac.sqf) (Spec_heli_fnc_medEvacRetransfer heli_medevac_retransfer)
- helicopter flies to player/caller position
- flies to base if no man nearby
- unloaded passenger will be fully healed with a PAK (from ACE Advanced Medic)
- optional (heli_medevac_retransfer): ace action is to retransfer to last called LZ
initPlayerLocal.sqf:
private _actionMedevac = ["Spec_action_callMedevac", "Call MedEvac", "", {_this remoteExec ["Spec_fnc_heli_medevac",2]}, {true}] call ace_interact_menu_fnc_createAction;
[player,1, ["ACE_SelfActions"], _actionMedevac] call ace_interact_menu_fnc_addActionToObject;
[] call Spec_fnc_moveMarkerLZ;
private _actionBussard = ["Spec_action_callBussard", "Call Transport", "", {_this remoteExec ["Spec_fnc_heli_taxi",2]}, {true}] call ace_interact_menu_fnc_createAction;
[player,1, ["ACE_SelfActions"], _actionBussard] call ace_interact_menu_fnc_addActionToObject;
Name of Helicopter and Helipad in Editor are defined in const.hpp
#define MEDEVAC_ID weiss
#define MEDEVAC_HELIPAD_BASE_ID landingpad_weiss
#define HELI_TAXI_ID bussard
#define HELI_TAXI_HELIPAD_BASE_ID landingpad_bussard
training station for ACE advanced medical
- spawn medic dummy with wounds
- assign as medic
- show medic data of ace of nearest man (if player is medic)
- spawn medic supply
initPlayerLocal.sqf:
[sign_medic_area, medic_mat_1, "Medic Dummy A"] call Spec_medic_fnc_addTrainingStation;
training scripts for mk6 mortar with ACE (3CB BAF mortar)
- add in init field:
[this] call Spec_mortar_fnc_addTrainingStation;
- training station has ACE interaction to spawn crates (mortar, mortar ammo) and assign player to FAC
- FAC can spawn/move one target (offroad vehicle)
- FAC has different ACE self interactions to show info about target (liner, tip, solution)
- Hints are displayed if vehicle is hit/destroyed
Adds killed event handler to non player units which removes lootable stuff (e.g. magazines).
- add "CfgFunctions.hpp" to "CfgFunctions" in description.ext
- add "DescriptionExt.hpp" to description.ext (or "CfgEventHandlers.hpp" to "Extended_Init_EventHandlers" in description.ext)
simple slide show of pictures (e.g. at billboard)
- in init.sqf:
[sign_presentation, numberOfSlides, "pictureDirectory"] call Spec_presentation_fnc_addSlides;
OR[sign_presentationm, numberOfSlides] call Spec_presentation_fnc_addSlides;
(uses default directory "pictures") - object sign_presentation has addActions to navigate slides (calls are only handled from the server)
- pictures have to be named presentation_xxx.jpg starting with presentation_000.jpg
- for each unit
setVariable ["Spec_var_TFARgroup", 0];
- edit group entries in fn_initGroups.sqf (see switch case)
- sets TFAR frequencies according to Arrays (on Respawn)
to test (BFT values) team switch to unit and execute
[player] call "Spec_tfar_fnc_init";
- Curator unit sharing incl JIP/Respawn (from https://forums.bistudio.com/topic/166808-making-placed-units-be-editable-for-every-zeus/)
- placed units are transfered to the server (later extendable to headless client)
- currently serverID is determined in a bad way (with sleep 20)
- add functions via header-file in description.ext
If conditions are met unit, vehicle or other attached object will trigger a explosion (with 3 possible sizes).
Trigger.OnActivation:
[bomberA, 100, "Die!", 1, "SMALL"] call compile preprocessFileLineNumbers "suicide.sqf";
The (sever-only) trigger should be attached to bomberA (via initServer.sqf).