Jump to content
Sign in to follow this  
FileCorrupted

New to arma modding and scripting

Recommended Posts

Hey guys, as you can see by my register date and post count I am new to arma modding and scripting, I have used the editor plenty but have no real knowledge of how scripting works in arma 3. So I have come here to ask where I might find some tutorials on scripting. The biggest confusion for me is where I put my scripts and with what syntax I write them, and then how do I access that script in editor.

EX: say I want to make a script that spawns a few barells at random times in random positions, how would I do that? and where would I put the script?

I should also mention that I do have experience with programming and scripting in various engines and for various games, just never in arma 3.

Share this post


Link to post
Share on other sites

I had the same kind of challenge when I first started several months ago. Having some knowledge of other scripting languages and some C++ helped, but it was still confusing at first just figuring out what an SQF was and how it was called.

I looked around on youtube a lot and played around with individual missions that I downloaded. I opened those up and learned from them. I found it easiest to start developing scripts with missions before even thinking of undertaking a mod.

Other places that helped me were KillZoneKid's blog,

the Scripting commands for Arma 3 BIS Wiki page,

the more general Arma 3 Scripting Topics BIS Wiki page, and of course these forums.

Without getting into too much detail, to make barrels appear at random times in random positions, I would:

1. Create a mission in the editor

2. Open the mission folder and create a myscript.sqf file (the place for the code of your script) that will generate a barrel

3. Create a trigger in the mission editor that executes your script (see

for how to make radio triggers run code.)

4. Run the mission and use the radio commands to execute the trigger

I would put something like this in the "ON ACT." code box of the trigger:

nul = [] execVM "myscript.sqf";

Share this post


Link to post
Share on other sites

Something worth adding:

Set up your own functions library as soon as you got the basics covered.

This gives you the advantage that all scripts in that library are being loaded into memory upon mission start, a huge performance gain.

Really worth it.

More info here.

Share this post


Link to post
Share on other sites

I should also mention that I do have experience with programming and scripting in various engines and for various games, just never in arma 3.

Perfect! :)

The other posters here have got you covered well already, but I'll add in my own experience with starting out.

My past experience scripting was with papyrus (the language used by skyrim) and I never really understood it 100%, just kind of got by. From that starting point I simply referenced the wiki for everything. The scripting commands page in particular.

The syntax was easy enough to learn, but the things that took me a little bit longer to realize were:

  • Variable Namespace. Easy to understand, just not often explicitly mentioned anywhere during the process of learning.
  • Event Scripts. These are probably the most convenient way for mission designers to get scripts running.
  • Functions. Amazingly useful once a mission designer really grasps their potential.
  • The Mission Config File. It's likely you'll run into config files when you get further into scripting. The mission config file - description.ext - can contain predefined config entries (that govern settings and resources the mission will use) as well as custom config entries to be used by scripts in the mission. Config entries are simply data (arrays, ints, strings) - basically read-only variables stored in a file.
  • Simply the structure of an ARMA mission (in terms of files and folders - don't have a link for this, will explain below)

Mission Structure

So, a mission in ARMA is - to put it simply - a folder with a config file inside it. The world which the mission will take place in is defined in the folder name after a period (see: .altis, .vr, .stratis, etc.). Everything else is defined in the config file (that is: pre-placed objects; the mission name and description; anything else done in the editor) called mission.sqm. So all of your scripts and other mission resources will go into this folder (you can use sub-folders too).

These missions can be found under

C:\Users\<windows username>\Documents\Arma 3\<arma username>\missions - Missions made in the regular editor

C:\Users\<windows username>\Documents\Arma 3\<arma username>\MPMissions - Missions made in the MP editor (it's the same, but when you preview it takes you to a MP lobby)

When you export a mission you're simply taking the folder and packaging it into an archive (.PBO) ready for release. These missions are found under the game's install location.

Hope this helps!

Share this post


Link to post
Share on other sites

Here is a debugging tutorial. It also explains the order in which scripts/files are run and it comes with a foundation template that you may find useful as a good start to your own mission template

If the tutorial is of any use could you please bump it, it should idealy be stickied as it soon gets lost in the miriad of posts

http://forums.bistudio.com/showthread.php?176096-Zeu-Debugging-Tutorial-amp-Foundation-Template

Share this post


Link to post
Share on other sites
Something worth adding:

Set up your own functions library as soon as you got the basics covered.

This gives you the advantage that all scripts in that library are being loaded into memory upon mission start, a huge performance gain.

Really worth it.

More info here.

Since I'm also relatively new to the Arma scripting world, would you mind helping me with this? I have a Map/GPS addon that is 90% complete, and I have my own version of a functions library which essentially consists of all my functions as .sqf files in a folder called "functions" within the root of my add on folder:

Zehn_Root\functions
fn_GetAzimuth.sqf
fn_Init.sqf
fn_IntegerLength.sqf
fn_KeyPressed.sqf
fn_MouseDIK.sqf
fn_MouseUp.sqf
fn_PadZeros.sqf
fn_RoundNumDigits.sqf
fn_ScalarToString.sqf
fn_ToggleUIVariable.sqf

I have tried declaring them using the following class placed in my config.cpp:

class CfgFunctions
{
class ZehnRoot
{
	tag = "ZehnRoot";
	class ZehnRoot
	{
		file = "\Zehn_root\functions";
		class Init
		{
			postInit = 1;
		};
		class GetAzimuth{};
		class IntegerLength{};
		class KeyPressed{};
		class MouseDIK{};
		class MouseUp{};
		class PadZeros{};
		class RoundNumDigits{};
		class ScalarToString{};
		class ToggleUIVariable{};
	};
};
};

fn_Init.sqf always runs with no problem when the addon is loaded, but an time I try to reference one of the other functions by calling it like [] call ZehnRoot_fnc_GetAzimuth; it nothing happens (checked this by putting hints and diag_log lines in the called functions.

So instead, in the fn_Init.sqf, I just use the preprocess compiler to assign them to variables and then later use the variables to call them:

Zehn_fnc_GetAzimuth = compile preprocessFileLineNumbers "\Zehn_Root\functions\fn_GetAzimuth.sqf";
[] call Zehn_fnc_GetAzimuth;

Any ideas on what I might be doing wrong with my functions library?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×