Jump to content
Sign in to follow this  
Caldred

Loading Server Only Addon

Recommended Posts

I have a function library (addon I guess?) that I just want to be loaded by the dedicated server, not by clients, because it calls to an externall DLL using the RVExtension function. I'm stuck with how to load my addon on the server when the mission file is initially run/processed by the dedicated server. I have this basic code in my mission init.sqf file, so when the server runs this, it is supposed to load my addon init.sqf:

X_Server = false;

if (isDedicated) then
{
X_Server = true;
};

if (X_Server) then
{
[] execVM "\ServerLibraryTest\init.sqf";
};

Whenever I test my mission in multiplayer on the dedicated server I get a script error: cannot find script "\ServerLibraryTest\init.sqf". Maybe I'm either not getting the addon loaded onto the server properly, or maybe I am specifying the path wrong in my call to the execVM call?

I'm loading the addon pbo (built with the addon builder tool) to the server at Arma3Root\@ServerLibraryTest\addons\ServerLibraryTest.pbo, and the mission file I export to multiplayer and copy to the server MPMissions folder. My addon is really basic it just has a config.cpp and then the init.sqf which just initializes a couple variables. Also I load the addon when I start the server with the -mod=ServerLibraryTest option, and the RPT log file doesn't show any errors when server is starting, it shows that the addon is loaded.

Not sure what I am missing, maybe I'm going about this wrong as far as separating the server functions into their own library that is separate from the mission pbo?

Thanks for your help!

Share this post


Link to post
Share on other sites

If the path to ServerLibraryTest\init.sqf is back one directory from current directory then you need "..\ServerLibraryTest\init.sqf" directory. If it's in the current directory then it's "init.sqf". It is not below curenrt directory or else your ommand would work.

Also try this for your condition

X_Server = false;

If !(hasInterface || isDedicated) then
{
X_Server = true;
};

if (X_Server) then
{
[] execVM "\ServerLibraryTest\init.sqf";
};

Edited by Beerkan

Share this post


Link to post
Share on other sites

Thanks, that got rid of the script not found error. So something interesting I found...when I build my addon with the BI Arma 3 Tools addon builder (the one that you download from Steam) it seems to not work, or at least it seems to handle the file paths differently. When I build my addon with the Eliteness pbo tool then everything seems to work properly.

For example I was adding functions to my addon using the CfgFunctions {} in the config.cpp, according to the Wiki entry for CfgFunctions as far as directory structure, and when I packed my pbo using the BI addon builder, it was not able to locate any of the function files correctly. But when packed using Eliteness everything worked as according to the Wiki.

I probably have my Addon Builder setup wrong or need to get the latest version from Steam, not sure, but maybe this will save some people the headaches I went through.

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  

×