Jump to content
Chipotles

[SOLVED] Can you use a script as an addon for the workshop?

Recommended Posts

Im a guy comming from mission-scripting and have been there for a while. I have now made a simple client-side gui controls script. The actual purpose of this script was coded with the "mission-file" context in mind. Now people asked me if i couldnt upload it to the steam workshop for easier installation and convenient use. I did some research on this but i cant fint anything relevant anywhere.

 

Is is possible to pack a single script in an workshop-addon and expect it to load on every mission that it is executed with?

When yes, how do i perform this?

Share this post


Link to post
Share on other sites

You have to make an addon. You create a config.cpp (kind of description.ext) with some classes: cfgPatches, and cfgFunctions (similar to BI_fnc_ , but home made with your scripts)

More here.

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

https://community.bistudio.com/wiki/Functions_Library_(Arma_3)

 

So, a config.cpp , with at least one function with  postinit = 1 to make it run automatically, referring to an external sqf (it's better).

Place that in a folder. Then launch the Arma3 tools >>  addon builder to pbo your files. You should get a @youraddon folder now.

 

Follow some links here:

https://community.bistudio.com/wiki/ArmA:_Addon_Editing

 

Good reading!

  • Like 1

Share this post


Link to post
Share on other sites
39 minutes ago, pierremgi said:

You have to make an addon. You create a config.cpp (kind of description.ext) with some classes: cfgPatches, and cfgFunctions

 

So, a config.cpp , with at least one function with  postinit = 1 to make it run automatically, referring to an external sqf (it's better).

Place that in a folder. Then launch the Arma3 tools >>  addon builder to pbo your files. You should get a @youraddon folder now.

 

 

Thank you very much! I tried your suggestion but it seems like im doing something wrong.

 

Could it be the folder structure? It looks like this

 

Arma 3\@AddonX\addons\@AddonX.pbo

Arma 3\@AddonX\config.cpp

Arma 3\@AddonX\fn_navBar.sqf

 

 

Do i even got the config file correct?

class cfgPatches
{
  class MyAddon
	{
		name = "My Addonx";
		author = "Mex";
		requiredVersion = 1.60;

		file = "fn_navBar.sqf";
		postInit = 1;
		ext = ".sqf";
	};
};

 

I activated the addon in the client too, but nothing happens when i get into server browser > host server > random mission.

Or is there something different i got to pay attention to?

 

im sorry if im asking too much it just seems like there is so much potential to fail..

Share this post


Link to post
Share on other sites

You missed the right classes:

cfgPatches are for information and dependencies

cfgFunctions for your function (sqf)

 

class cfgPatches {

  class MyAddon {

     name = "My Addonx";

     author = "Mex";

     requiredVersion = 1.60;

  };

};

class CfgFunctions
{
	class myTag
	{
		class myCategory
		{
			class myFunction
			{
				file = "fn_navBar.sqf";
                                postInit = 1; //1 to call the function upon mission start, after objects are initialized. Passed arguments are ["postInit", didJIP]
				recompile = 1; // optional 1 to recompile the function upon mission start (config.cpp only; functions in description.ext are compiled upon mission start already)
			};
		};
	};
};

Put config.cpp and fn_navbar.sqf in same folder (myAddon) then pbo it with tools to obtain @myAddon folder. Place it in your addon folder.

 

then you will have a new function in your function viewer (console or editor) and you call it as myTag_fnc_myfunction

  • Like 1

Share this post


Link to post
Share on other sites
14 hours ago, pierremgi said:

then you will have a new function in your function viewer (console or editor) and you call it as myTag_fnc_myfunction

 

Ok this is working. But there seems to be a small problem here. When im getting into the game or opening the function in the function-viewer it says "Script fn_navBar.sqf" not found. Funniely enough when im executing it on some missions its working, but not all missions.

 

*Edit, i got it finally to wortk with this config.cpp setup : 

 

class cfgPatches
{
  class MyAddon
    {
        name = "My Addon";
        author = "JonVeD";
        requiredVersion = 0.1;
    };
};

class CfgFunctions
{
  class myTag
  {
    class myCategory
    {
      file = "\myAddon\functions\compass";
  	  class myFunction {};
    };
  };
};

the script i put here \myAddon\functions\compass\script.sqf

 

It is now working thank your very much pierremgi

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

×