Arma 3
109 ratings
Arma 3 Eden Editor - Scripts I use often
By Greytega
This guide is mostly for me to place down scripts that I have had to hunt for and will be using them often.
2
   
Award
Favorite
Favorited
Unfavorite
Common scripts
Teleport to empty marker
setPos (getMarkerPos "markername")
Or , use set position module

---------------------------------------------------------------------------------------------------------------------------------

Trigger for create a marker - Also creates a hint
hint "An S.O.S Signal Was Detected"; _marker1 = createMarker ["markerSOS", [2188, 5362]]; "markerSOS" setMarkerShape "Ellipse"; "markerSOS" setMarkerSize [50, 50]; "markerSOS" setMarkerBrush "DIAGGRID"; "markerSOS" setMarkerColor "ColorYellow";

---------------------------------------------------------------------------------------------------------------------------------

Only fire a trigger when Multiple Triggers Have fired
triggerActivated TR_KILL_Parent_SU AND triggerActivated TR_Destroy_Supplies_Parent_SU;

Fire a trigger when either Triggers Have fired
triggerActivated TR_KILL_Parent_SU OR triggerActivated TR_Destroy_Supplies_Parent_SU;

---------------------------------------------------------------------------------------------------------------------------------

Create a Virtual Arsenal Object :
- In the Init field of the object place
["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;
In the Role Description, place : Arsenal


Add BI and ACE arsenal to the same box
["AmmoboxInit",[this,true]] call BIS_fnc_arsenal; [this, true] call ace_arsenal_fnc_initBox;

---------------------------------------------------------------------------------------------------------------------------------

Have a group patrol a vicinity randomly (ie 20 meters)
edit the Init of the group leader =
[group this, getPos this, 20] call bis_fnc_taskPatrol

Have a group man nearby static defenses within a 100 metre radius of the defense position and guard the position. Some units will man weapons, others will patrol and the remainder will sit on the ground.

edit the Init of the group leader =
[group this, getPos this] call BIS_fnc_taskDefend;

---------------------------------------------------------------------------------------------------------------------------------

Delete an Object
IE: Deletes the Helo and the Pilot - Units have to have variable name
deleteVehicle Insertion_Heli; deleteVehicle Insertion_Heli_CP;

Set Flying height for chopper
Insertion_Heli flyInHeight 40;

---------------------------------------------------------------------------------------------------------------------------------

Have Team Clear an Area or survive ambush by creating an OPFOR, PRESENT Trigger but reduced to 3 left or so. This will prevent the players having to hunt down all of them.
{alive _x} count thislist < 3


Mission Story Telling
AI chat
Note the AI object must exist
Insertion_Heli_P sideChat "Chat Message"

Set a hint
hint "Top Right Hint"

Add Breaks in Descritpions ie:
<br/><br/> Be Advised: You will need to use an Explosive Charge
Remove Hold Space to respawn
Create a initPlayerLocal.sqf file and place it in the mission folder, add this to it :

player addEventHandler["Dammaged",{ params ["_unit", "", "_damage","","_hitPoint","_source"]; if ( alive _unit && { _damage >= 1 && { _unit getVariable ["#rev_enabled", false] && { _hitPoint == "Incapacitated" && { _unit getVariable ["#rev_state", 0] isEqualTo 2 } } } } ) then { if ( vehicle _unit isEqualTo _unit ) then { _nul = [ _unit ] spawn { params[ "_unit" ]; waitUntil{ !( _unit getVariable [ "#rev_actionID_respawn", -1 ] isEqualTo -1 ) }; _actionID = _unit getVariable [ "#rev_actionID_respawn", -1 ]; [ _unit, _actionID ] call BIS_fnc_holdActionRemove; ["",false,_unit] call BIS_fnc_reviveOnForcingRespawn; _unit setVariable ["#revF", false, true]; waitUntil{ !( lifeState _unit == "Incapacitated" ) }; _unit setVariable [ "#rev_actionID_respawn", -1 ]; }; }; }; }];
Adding an Action in CO-OP/Multiplayer for all players
Object : Locator Beacon
Trigger: TR_LocatorBeacon


Put down object "Locator_Beacon" and in the init field i put:

this addAction ["Initiate Comm Scan", { (_this select 0) setVariable ["BeaconScan", 2, true]; }, [], 1.5, true, true, "", "true", 2, false, "", "" ];

This uses the defualts of addAction excpet for the 2 towards the end, that will set the distance from player to require at least 2 meters. IE close enough to touch.

Then put a trigger down and in condition put:

((Locator_Beacon getVariable ["BeaconScan", 0]) == 2)


SetVariable's 3rd arg broadcasts it too all clients and server so it will be syncronized in MP

getVariable's 2nd arg is the default value when one isn't set yet, so it will return 0 until it gets set by the addAction code
Create a Random Spawn Location with a Base
Follow these steps to create an object, have it spawn a random (or multiple random) location.

There are 2 ways to do this
1 - Have just the enemy AI / OPFOR be hidden/disabled
2 - Have the Entire based be hidden/disabled

Lets do Number 1 :

The Basics
  • Create the Object
  • Create a trigger
  • Right click the Trigger and select Connect -> Set Trigger Owner
  • Set the Owner as the Object
  • Edit the Trigger
  • - Activation -> Owner Only
  • - Activation Type -> Present
  • - Also make sure you specify a size / radius
  • - Set trigger variable name to SPAWN_A (or something)

To be sure that we know the trigger has fired, lets setup a hint that we will remove later.
In the On-Activiation of this trigger place :
hint "Spawned in A";
Now you have Trigger that will fire when this particular object is present and give us a hint that it has done so.

To create a second spawn point -
  • Create another trigger
  • Right click this Trigger and select Connect -> Set Trigger Owner
  • Set the Owner as the Object
  • Edit the Trigger
  • - Activation -> Owner Only
  • - Activation Type -> Present
  • - Set trigger variable name to SPAWN_B (or something)
  • - Feel free to setup another hint saying spawned in B

Now you should have two Triggers that will fire when this particular object is present within the area you specified of the trigger. (and hints to say this)

Create the Spawn
  • Now create an Empty Marker -> F6 -> System Markers -> Empty
  • Give it a name so you know what it is
  • Position it down towards the SECOND Trigger
  • Right Click the Marker and select -> Set Random Start
  • Link the random start to the object

Now you have an object, that can spawn in 1 of 2 places randomly selected and triggers that will fire once the object is detected as present.

TEST At this point so we know this much is working.
Play -> Spectate in SP


Building the Base

Put down whatever Units or objects you want (keep it small for testing)
  • Now create a Trigger edit the area so it is around all your units.
  • Activation = OPFOR
  • Type = Present
  • Give it a description so you know what its doing (SPAWN A - SHOW/HIDE OBJECTS)

Create two system Modules
  • F5 -> Modules -> Object Modifiers -> Show / Hide
  • Place two of these down (outside your base)
Edit the first one
  • Name -> Show_A
  • Apply to -> Objects Within Sync Triggers
  • Action -> Show Units

Edit the second one
  • Name -> Hide_A
  • Apply to -> Objects Within Sync Triggers
  • Action -> Hide Units

First we need to make sure the enemy are all hidden.
  • Sync Area Trigger to the Hide_A Module
  • Create a trigger, set the condition to True;
  • Link it to the Hide_A Module
  • In its current state, this will hide all enemy no matter what.


Create a new trigger
  • Put some text -> This will show A
  • Condition -> triggerActivated SPAWN_A;
  • This will then only fire the trigger once the trigger named SPAWN_A fires
  • Set a timeout of around 3 seconds (this will prevent conflicts with the first spawn and always make sure that Show fires After hide)
  • Right Click, Sync to - SHOW_A Module

Now you need to Do the same for SPAWN_B so that base will show up only if the object spawns at B

It should look like this In the Map view



It should look like this in the Game view



Give it a Test !


Option 2, Hide the whole base :

This is very similar, and can be easier depending on what you want.

Do the same as before, But do it to the side because we will move these items later.
  • Create the object and the Triggers to detect if that object is in the area
  • Place down the waypoint for the random start etc.
  • Just edit the Triggers for detection to have a 2 or 3 second timeout

Then, Build the Base
Put down whatever Units or objects you want (keep it small for testing)
Do not yet place down waypoints or anything other than the units and the buildings

Create two system Modules
  • F5 -> Modules -> Object Modifiers -> Show / Hide
  • Place two of these down (outside your base)
Edit the first one
  • Name -> Show_A
  • Apply to -> Synchronized Objects Only
  • Action -> Show Units

Edit the second one
  • Name -> Hide_A
  • Apply to -> Synchronized Objects Only
  • Action -> Hide Units

Select all your Buildings and Units, Right click, Sync to select the Hide Module
Select all your Buildings and Units again, Right click, Sync to select the Show Module
Sync the show module to the SPAWN_A Trigger
Now move the SPAWN_A Trigger into the base.


- Then do the same for Base B
- TEST IT
- Once you know its working, then you can create waypoints for your enemy etc.

It should look like this once your done.


9 Comments
Greytega  [author] 4 Jul, 2020 @ 1:53pm 
@jfcouture01 , Oh thanks so much, ill have to try those out and update this article ! (not worked with layers yet )
jfcouture01 4 Jul, 2020 @ 8:13am 
I'm looking at your last image and all the sync lines could be simplefied if you work with layers. You can associate them in the SHOW/HIDE module.

1- Add a layer (folder in list) in the left menu (editor)
2- drag all units/objets of the same base in that layer and name it.
3- Do the same for all other groups or bases.
3- In the SHOW/HIDE module, you should be able to select your new layers (dropdown menu).
4- Sync the triggers with the SHOW/HIDE modules, the same way you descibed.

Should be time efficient.
johnwestontattoos 28 Feb, 2020 @ 8:19pm 
//create marker in the editor and name it//
_mark = getMarkerPos "BaseMarker"; //find position of marker//

_boxes = _mark nearSupplies 3; //find supply boxes within 3 meters of the marker//

_box = _boxes select 0; //select first box in the array of boxes created by nearSupplies//

_units = _mark nearEntities ["Man", 5]; //find units within 5 meters of the center of the marker//

_numberofUnits = count _units; //check if there is a unit present to avoid errors//

if (_numberofUnits >= 1) then {

_unit = _units select 0; //select first unit near the box//

_unit action ["gear" , _box]; //make unit access the box//

} else {hint "No Unit Near Box";};

make sure to stand nearby the unit so that you can manipulate his inventory,
cheers hope this is useful to someone
johnwestontattoos 28 Feb, 2020 @ 8:18pm 
/Make unit access the inventory of a box and you can edit their loadout//
//it will pop up the standard inventory menu but for the AI //
//make unit stand near the desired box and then call the script via an addaction in the init field of the box or a post nearby,,, something like null = this addAction ["Open Inventory", "InventoryScript.sqf"]; //




Ellman 18 Aug, 2019 @ 11:33am 
Good guide! +1

Made this a couple of months ago, feel free to grab stuff from it if you want:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1635452218
Greytega  [author] 13 Aug, 2019 @ 6:01pm 
Thanks @Pyth3rEx, ill add that one in !
Pyth3rEx 13 Aug, 2019 @ 5:30am 
You should add this one: add BI and ACE arsenal to the same box
["AmmoboxInit",[this,true]] call BIS_fnc_arsenal;
[this, true] call ace_arsenal_fnc_initBox;
N o o t 5 Aug, 2019 @ 2:45am 
Time to favourite this in the event that I ever understand how to use the Editor properly, lol. Progress is slow.
Niko226 2 Aug, 2019 @ 12:36pm 
interesting