Jump to content
Sign in to follow this  
RazorX

How does activateAddons command work?

Recommended Posts

Can anyone explain in details, please? What is the general purpose of using this command?

Share this post


Link to post
Share on other sites

http://forums.bistudio.com/showthread.php?t=89375&highlight=activateAddons

I believe it forces the game engine to load a particular addon to ensure that a dynamically added [spawned] item will load without errors. This is for non-BIS addons that the games does not know to load, because you have not placed a unit on the map.

Having said that, I have had no trouble in Arma2 with just spawning an object without using this command. Maybe it will bite me later on......

Share this post


Link to post
Share on other sites

I'm just curious, because I found it interesting for my project.

Let's say I'm creating a SP mission which a player will play for dozens of hours. When I will release a new modification for this mission - an addon containing a set of new scripts - I don't want to force the player to download the updated version of the mission including these scripts and start the mission all over again if he wants to play with this addon. It might be a bit frustrating.

So my question is: is it possible to load the addon during gameplay (ie. by dialogs system - user friendly :)) by activateAddons and the addon will now be visible to the game?

Edited by RazorX

Share this post


Link to post
Share on other sites

OK, a few more questions about this.

It seems that it's used to get around the fact that script spawned vehicles from an addon cause a missing addon error because they aren't declared in the top of the mission.sqm.

Where does one use it? Do we edit the SQM and put it in there? On the biki page, UNN says something about execute the command from a configs init event using spawn or execVM. What does that mean for users who are mission designers and not addon makers? Or should it be in the mission init?

Could it be combined with configFile>>"CfgPatches">> in this way?

if (isClass(configFile>>"CfgPatches">>"my_addon")) then {activateAddons ["my_addon"]};

In other words, if an addon is loaded, then activate it. If not, then don't.

Share this post


Link to post
Share on other sites

if (isClass(configFile>>"CfgPatches">>"my_addon")) then {activateAddons ["my_addon"]};

Well, this worked in editor preview. The addon was active but not mentioned in the sqm. The game was able to spawn objects from my addon without giving any errors.

Need to test it in MP.

Share this post


Link to post
Share on other sites

Don't forget that once you active the addon all of the saves from there on will be "tainted" by it and you won't be able to load the save without the addon present.

Share this post


Link to post
Share on other sites

I'm confused by this command. Why would you spawn things from an addOn in a mission but not tell people that they need the addOn? I've seen it happen of course, but this seems to be much more stress and worry than just saying "Hey Frank, make sure you load ACE and BB_OA_Mercs to play this."

Share this post


Link to post
Share on other sites

If I followed this right, the thing is he's making a script suite for his IED system that will either spawn stuff from his own addon if the addon is loaded, or PMC IEDs if it's not.

So people don't actually need the addon to have the script working, but if they do they have new objects spawned by the same script.

Share this post


Link to post
Share on other sites

You can do that with a simple isClass call:

_ace_present = isClass(configFile/"CfgPatches"/"ace_main");
if (_ace_present) then {
_wp = "ARTY_Sh_105_WP"; // replace with whatever the ACE WP shell is
} else {
_wp = "ARTY_SmokeShellWhite";	
};

Share this post


Link to post
Share on other sites

Yeah, but I guess the point is this would not work if the addon has not been loaded by the mission.sqm? I'm not sure, I'm trying to understand too.

Share this post


Link to post
Share on other sites

Use this command only in MP missions.

As noted before in SP (and addons with auto activated scripts (XEH/init EH)),

it most likely will break savegames and will force people to restart the mission.

Share this post


Link to post
Share on other sites
If I followed this right, the thing is he's making a script suite for his IED system that will either spawn stuff from his own addon if the addon is loaded, or PMC IEDs if it's not.

So people don't actually need the addon to have the script working, but if they do they have new objects spawned by the same script.

That's right, thanks. :)

---------- Post added at 12:38 ---------- Previous post was at 12:37 ----------

You can do that with a simple isClass call:

_ace_present = isClass(configFile/"CfgPatches"/"ace_main");
if (_ace_present) then {
_wp = "ARTY_Sh_105_WP"; // replace with whatever the ACE WP shell is
} else {
_wp = "ARTY_SmokeShellWhite";	
};

And that is how I do it. The problem is that when the addon version is spawned, unless you have it declared in the sqm, you get the missing addon error. This command appears to solve that.

---------- Post added at 12:40 ---------- Previous post was at 12:38 ----------

;2246721']Use this command only in MP missions.

As noted before in SP (and addons with auto activated scripts (XEH/init EH))' date='

it most likely will break savegames and will force people to restart the mission.[/quote']

I am using it in MP, but thanks for the info. It all helps. :)

---------- Post added at 12:41 ---------- Previous post was at 12:40 ----------

Don't forget that once you active the addon all of the saves from there on will be "tainted" by it and you won't be able to load the save without the addon present.

Good point, though this is MP with savedisabled, so I'll keep that mind for other projects.

---------- Post added at 13:30 ---------- Previous post was at 12:41 ----------

I also note that Sickboy says elsewhere..

There is also the scripting command 'activateAddons', however this has several downsides, one of them is that every execution of the command, deactivates the previous activated addons :D

Does he mean you can only use the command once and that only the latest use counts? I've also read, (but can't find it) that this command overides the addon line at the top of the sqm?

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  

×