-
Notifications
You must be signed in to change notification settings - Fork 2
Useful Commands
This page is for utilising fun or immersive things in missions.
Most if not all of these should be placed inside init.sqf and never in the object init field in the editor.
This section is dedicated to things you can do with AI.
When utilising helicopters in missions units being held in vehicles away from the AO more often than not do spot helicopters, eject from their vehicles and go into combat mode. Essentially even if the pilot doesn't see these units they have become useless. The vehicle will move away without the QRF when activated.
The example on the wiki is:
_veh setUnloadInCombat [true, false];
The first part of the command needs to be a vehicle variable name, not the driver.
The second parts are allowing Cargo to dismount and allowing Turrets to dismount.
To prevent any units from dismounting before you force them to you simply need to use
Example_Vehicle setUnloadInCombat [false, false];
This doesn't need to be changed if you use a waypoint for "Transport Unload" as they will be ordered to dismount by themselves.
the disableAI command is worthwhile to use for multiple purposes.
This is designed for preventing moving, firing, cover etc. The use cases are available on the wiki
For the example we'll be disabling AI Pathing. They can't move, but can still turn and aim. (Disabling Move also disables turning)
The example on the wiki is
_soldier1 disableAI "PATH";
This would disable the soldiers ability to move. But if you wish to disable a full groups to hold a garrison position you would want the command to be ran on all of them. Give the AI group a variable name, i.e Example_Group_1 and then in init.sqf you can do
{
{
_x disableAI "PATH";
} forEach (units _x);
} forEach [Example_Group_1];This disables the path on every unit inside Example_Group_1 and you can expand this for as many groups as you like by changing
} forEach [Example_Group_1]; to } forEach [Example_Group_1, Example_Group_2, Example_Group_3];
Ensure that you have a comma between each group variable otherwise it will give you an error.
This example works with all of the available AI behaviours. And if you wish to re-enable any of the ones you disable, you can use the same example as above but using enableAI instead of disableAI
Vehicles in Arma can have their speed limited if required, in my experience it does seemingly limit the amount of accidents the AI get into.
A basic example of utilising this is:
ExampleVehicle limitSpeed 50;
The vehicle itself (not the unit driving it) needs a variable name and using the above command will not allow it to go above the speed specified until it reaches it's destination or you change the speed it's allowed to travel at.
The wiki has examples of using loops but that is for much older versions of Arma, it now remains set without being looped.
This section is for utilising CBA functions.
Wait and Execute is the ONLY option when wanting to execute code with delays. There will be no sleep.
A useful method to using it is:
ied_1 setDamage 1;
[{
ied_2 setDamage 1;
}, [], 1] call CBA_fnc_waitAndExecute;
[{
ied_3 setDamage 1;
}, [], 2] call CBA_fnc_waitAndExecute;
[{
ied_4 setDamage 1;
}, [], 3] call CBA_fnc_waitAndExecute;In this example, when the code runs it will detonate ied_1 then the others with a 1 second delay.
[{ CODE HERE }, [PARAMS], DELAY] call CBA_fnc_waitAndExecute;
The delay is not time since the last one ran, it is time after the block starts. So for code that runs in sequence of 5, it's 5, 10, 15 & 20 instead of using only 5 in each.
This has examples of some commands for useful immersion features in missions.
This uses the playSound3D command.
playSound3D ["z\ace\addons\explosives\data\audio\cellphone_ring.wss", example, false, getPosASL example, 1, 1, 50];
for this to work properly, you must specify a path to the sound which is already present. Then follow it with the Object that will make the sound, this can be anything but it must have a variable name.
example, false, getPosASL example, 1, 1, 50];
These are the last parameters required.
- example = Object making the sound
- false = is inside
- getPosASL example = location of the object making the sound
- 1 = Volume, this is capped to 5.
- 1 = sound pitch, don't touch this.
- 50 = distance, the distance at which you can hear the sound.
This uses the createSoundSource command.
You can create a simple base alarm by utilising the following:
if (isServer) then {
tac_baseAlarm = createSoundSource ["Sound_Alarm", position Example_Object, [], 0];
};This is wrapped in if (isServer) then { for a reason. If it is not it will execute globally and you'll have more than 1 alarm playing at once and it's bad. There will be no global sound sources.
The parameters of this are:
- The Sound (the wiki has a list of preconfigured ones)
- Position of an object, usually using a loudspeaker or something.
- Marker array, unless you want a randomly placed soundSource leave it as
[] - Random radius around the object for the soundSource to be placed in, recommended to leave as 0.
One final note on using this: Have a way of stopping it.
in this case, the "vehicle" is tac_baseAlarm and can be deleted with deleteVehicle.
if (isServer) then {
deleteVehicle tac_baseAlarm;
};```
This will end the looped sound and bring peace and quiet.Pages
- Home
- Your First Mission
- Creating A Mission
- Contract Missions
- Difficulty Guidelines
- Events
-
Functions Library
- Ambient Effects
- Base Spectator
- Bomber
- Car Alarm
- Chemical Detector
- Collect Intel
- Connect Battery To Defusable
- Contamination Gas
- Count Alive
- Dialogue
- Disable AI
- Download Intel
- Earthquake
- Enable AI
- Force Shooting
- Ground Fog
- Hunt
- In Area
- Lock Doors
- Mark Buildings
- Monitor Units
- Mortar Strike
- Ping
- Players
- Reaction
- Reinforcements
- Reinforcement Waves
- Respirator Effects
- Set Sleeping
- Sound Source
- Surrender
- Switch Action
- Teleport
- Toggle Lights
- Trigger Area
- Helicopters
- Resources
- Quality Checklist
- Useful Commands
- ArmaQDL