Jump to content
cyberaddict

How do I make the .sqf script contained in my .pbo addon auto-execute immediately after starting any mission.

Recommended Posts

Maybe this has already been discussed somewhere, but I couldn't find it, so I apologise in advance for possibly repeating a question that has already been asked here before. If there is a forum thread where it has already been discussed, send me the url.

 

I created a .pbo file, which connected as an addon to the arma. With this, I figured it out.

In general, I want my script runs every time I start any mission in arma3. I have config.cpp and the script itself with script.sqf file in the same folder.

The sqf so far uses the hint call script just to check its auto-run.

I've already tried everything and nothing happens after starting the mission or starting the game in the editor.

 

My cpp file contains this but didnt work:

class CfgPatches {

    class MyAddon {

        units[] = {};

        weapons[] = {};

        requiredVersion = 1.0;

        requiredAddons[] = {};


        class Extended_InitPost_EventHandlers {

            class MyAddon {

                init = "call compile preprocessFileLineNumbers 'script.sqf';";

            };

        };

    };

};

 

 

What's the best practice for this now?

Share this post


Link to post
Share on other sites
class CfgPatches {

    class MyAddon {
        units[] = {};
        weapons[] = {};
        requiredVersion = 1.0;
        requiredAddons[] = {};
    };
};

class CfgFunctions {
	class MyAddon {
		tag = "TAG";
		class Category {
			file = "MyAddon\functions";
			class someScript { postInit = 1; };
		};
	};
};

Where the script file is named fn_someScript.sqf.

postInit = 1 makes it autorun at mission post init.

It would also compile it as a function called TAG_fnc_someScript, so change TAG and file path as needed.

  • Like 3

Share this post


Link to post
Share on other sites

Thanks for all your help!

I did as you said, however in the game in the function browser the contents of the file fn_someScript.sqf is empty.

 

Before compiling, there's nothing there, it just contains a " hint "Hello, World!"; " to check if this function is automatically called.

I've already tried everything and the file is still empty.

 

I have the source code in the \Arma 3\Addons\myAddon folder, with the config.cpp and fn_someScript.sqf files in the root directory. I changed the name to someScript.sqf, or put it in a "functions" folder, and it's still empty in the game.

 

What else can I try and what additional information can I provide?

 

UPD:

I've got it all figured out!

It turns out that the arma 3 tools compiler properties didn't specify the right file extensions to copy into the mod.

 

Edited by cyberaddict
Updated info

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

×