Jump to content
neofit

Addon scripting information/tutorial?

Recommended Posts

Hi,

Does anybody know of a proper tutorial about making addons and could link it here? The BIS wiki page about mission scripting is awesome, but for addons we only have a stub.

Yes, I know there are plenty of tutorials about how to make a texture, a new vehicle, about how to change some weapons configs. But I don't want to do any of thoses things, and none of actually explains how an addon works, what files are required, how and in what order they are launched, etc.

I managed to figure out that the main file is a config.cpp, and that it has to declare a CfgPatches class. That's about it :). I am looking for more theoretical info about that.

Then I see that people are declaring some classes within classes with weird names to then launch some custom .ini script. I have no idea how these are run, IIRC my C++ one has to declare/initialize a variable for its constructor to fire.

My goal is to make a couple of small addons with some addActions and their functions (and make sure they still work after a loading a save in SP).

I tried blindly copying other addons to make a "hello world!".

config.cpp:
 

class CfgPatches
    {
    class HelloWorld
        {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        };
    };
    
//copied from steady_shot, no idea where the class names are used or how it would even work
class CfgFunctions
{
    class vz
    {
        class addon_steadyShot
        {
            class ssh_init {file = "myinit.sqf"; postInit = 1;};
        };
    };
};


myinit.sqf:

player addaction ["Say something", "hint 'Hello World!'; sleep 1; hint ''"];

(works fine as init string placed on player inside the editor)

AddonBuilder.exe places the pbo inside "Arma3\@<name>\addons\", upon loading Arma3 says "myinit.sqf not found" even if it's in the same directory as config.cpp on the source, and I see its contents inside the pbo. So, ahem, I'd appreciate a link that explains how to properly run an .sqf in an addon.
 

Share this post


Link to post
Share on other sites

In the Arma 3 Tools Addon Builder, there should be an "Options" button, click it, the very first input box paste the following into it:

*.rvmat;*.pac;*.paa;*.rtm;*.sqf;*.sqs;*.bikb;*.fsm;*.wss;*.ogg;*.wav;*.fxy;*.csv;*.html;*.lip;*.txt;*.bisurf ;*.sqm;*.ext;*.dbf;*.prj;*.shx;*.shp;*.hpp;*.cpp

These are some of the more common file types that people use (I may be missing a couple), but this will allow the addon builder to copy any of these types of files directly into the pbo upon compilation. Hopefully that helps you.

You can of course add any other file types to the list easily by following the format displayed above.

 

 

As far as addons go in general, if you understand the basic principles of the description.ext (there is a bit more information on that file), it's the same in the config.bin/cpp, just with the edition of the CfgPatches class. The best tutorial I can give is to just open up addons that interest you, unpbo them and look at how they've set their stuff up, you can learn a lot from that.

  • Like 1

Share this post


Link to post
Share on other sites

I'm currently trying to build my first "real" ArmA mod, and am doing this by reading the biki and source code of existing mods (CBA, ACE3, etc.).

 

And like the OP I too would like to see a good tutorial/guide/sample of mod/addon building.

 

 

If time allows it I will try to write down my knowledge and provide a sample addon (both simple and complex structures) which can be used as a boilerplate.

Although I already want to point out that I'm far from an expert, and the most I've ever done before is mission scripting in ArmA2.

Share this post


Link to post
Share on other sites

I'm the same currently, I really want to learn to script addons but I'm struggling to find some info on getting started and at least understanding basics.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/CfgVehicles_Config_Reference

https://community.bistudio.com/wiki/CfgAmmo_Config_Reference

https://community.bistudio.com/wiki/CfgWeapons_Config_Reference

https://community.bistudio.com/wiki/CfgMoves_Config_Reference

https://community.bistudio.com/wiki/CfgMagazines_Config_Reference

There is few of many

 

First unpack the A3 Pbo's with Arma 3 Tools

> Take a look of the Arma 3 config.cpp files

> Take a look of Arma 3 Samples

 

Both are available in Steam

 

There is so much you can do so i suggest to start from something specific.

  • Like 1

Share this post


Link to post
Share on other sites

Sorry for reviving an old thread, but I'm having the identical problem as OP and have yet to find a solution, despite going through through several BI documentations. Anyone have a solution to OP's problem?

Share this post


Link to post
Share on other sites

Hello all,
I am having issues with this control structure:

if (_randomselectX >= 8) then {

_unit addEventHandler ["Fired", {_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "sounds\contact1.ogg"; playSound3D [_soundToPlay, (_this select 0), false, getPos (_this select 0), 20, 1, 150]}];

_unit addEventHandler ["FiredNear", {_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "sounds\alert1.ogg"; playSound3D [_soundToPlay, (_this select 0), false, getPos (_this select 0), 20, 1, 150]}];

_unit addEventHandler ["Dammaged", {_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "sounds\hit1.ogg"; playSound3D [_soundToPlay, (_this select 0), false, getPos (_this select 0), 20, 1, 150]}];

_unit addEventHandler ["Explosion", {_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString; _soundToPlay = _soundPath + "sounds\explosion1.ogg"; playSound3D [_soundToPlay, (_this select 0), false, getPos (_this select 0), 20, 1, 150]}];

};

and for whatever reason i cannot seem to start my own topic...

I need to somehow cause the event handlers to only activate one time or delay repeat activation 300 seconds... either would work... any help would be appreciated or a link to a tutorial or something similar else where
Thanks

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

×