Arma 3 – Some Basic Scripting

If you’re like me and have absolutely no idea just what in the hell all of the gobbledygook on the Bohemia wiki for coding init lines in this game does, even when watching tutorials, then this is for you, I’ll try to explain this slowly so we won’t have to pause eating our crayons to put these in.

Some Basic A3 Scripting for People that Have Absolutely No Frickin’ Idea What The Hell They’re Doing

Note: Credit goes to Blitz ÂceRosin

Adding An Arsenal To An Object

So, say you want an arsenal box. Sure, you could just go to Inventory on the object and tick the arsenal box, but, let’s say for some reason that isn’t there, what the hell do you do?

In the init box for your container that you want to use as an arsenal, input the following.

[“AmmoboxInit”,[this,true]] call BIS_fnc_arsenal;

And just like that, your object SHOULD have a pretty little arsenal when you walk up to it in play mode.

Infinite Ammunition On Vehicles

Doing drills? Practicing your strafing runs? Just generally sick of running out of ammo?

No problem!

Simply add the following line to the vehicles init. This also works for soldiers, but, only their primary and secondary weapons, I believe. I can confirm it doesn’t work reliably with launchers.

this addeventhandler [“fired”, {(_this select 0) setvehicleammo 1}]

Markers That Follow Units And Delete When They Die

So, this will only follow one specific soldier/vehicle, but, I feel it’s useful to know for the sake of attempting to do things.

We’ll start with the .sqf file, that’s going to be placed in the missions’ folder (Located in Documents\Arma 3 – Other Profiles[Profile name]\missions)

Name it something like markerscript.sqf or whatever, and open it in something like Notepad++, normal notepad will also work.

Paste in the following to markerscript.sqf

_marker = _this select 0;
_vehicle = _this select 1;

while {alive _vehicle} do
_marker setmarkerpos getpos _vehicle;
sleep 0.5;

deletemarker _marker;

With markerscript made, you’ll now have to create the marker and soldier/vehicle, in the init of the soldier/vehicle, place the following code, remembering to replace the “Marker” with the actual name of your marker, otherwise it won’t work.

If you saved markerscript as something else, remember to change that, too. Otherwise it won’t work and you’ll just get slapped in the face with a big, fat, throbbing error message.

nul = [“Marker”, this] execVM “markerscript.sqf”;

Now, if you start your mission, you’ll notice that your chosen object now has a marker following it that updates every half-second with the position of whatever you put it on, and deletes itself once the unit is dead, or the vehicle is destroyed.

Here’s an alternative marker script that just goes in the unit’s init line, it’s nowhere near as nice due to not being removed on death, but, it gets the job done.

[] spawn {
while {not isnull Unit} do { “Marker” setmarkerpos getpos Unit; sleep 0.5; };

Helena Stamatina
About Helena Stamatina 3204 Articles
I love two things in life, games and sports. Although sports were my earliest interest, it was video games that got me completely addicted (in a good way). My first game was Crash Bandicoot (PS1) from the legendary studio Naughty Dog back in 1996. I turned my passion for gaming into a job back in 2019 when I transformed my geek blog (Re-actor) into the gaming website it is today.

Be the first to comment

Leave a Reply

Your email address will not be published.