OFPEC Forum

Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: dow on 29 Aug 2007, 19:41:51

Title: Help: building AddOn which adds action to Res and BAS units for ALL missions
Post by: dow on 29 Aug 2007, 19:41:51
Hello!
I'm working on AddOn for OFPR, which should add UserAction to all units of Man : Land : AllVehicles class and all it's descendants, including units added by other AddOns, like BAS, KEG etc.
The idea is to avoid patching all released AddOns and missions (too much work and authors' license problems).
This AddOn should be client-side and should work in SP and MP environment, including Human vs AI COOP missions.

As I can guess, this task needs custom config.cpp added to OFPR\my_addon folder. So I wanna put some questions about it.

I need to say, that I use this section of config.cpp to force OFP to add the action needed:

Code: [Select]
class CfgVehicles
{
access=1;
vehicleClass[]={"Men"};
class All {};
class AllVehicles:All {};
class Land:AllVehicles {};
class Man:Land
{
class UserActions
{
class MyAction
{
displayName="My Action";
position=ANY;
radius=0.1;
condition="alive this";
statement="this exec {\my_addon\my_script.sqs}";
};
};
};
};

Tiny URL of this post: http://tinyurl.com/2dxwkb
P.S.: plz sry for my bad english, my native language is russian :-[
Title: Re: Help: building AddOn which adds action to Res and BAS units for ALL missions
Post by: Planck on 01 Sep 2007, 19:22:29
Hello dow,

I will try to answer your questions the best I can from my understanding of them and of the way OFP deals with configs.

q1./  OFPR\Bin\config.bin ..... this is the main game config for loading OFP 1.46, so if you are going to play that version of the game this is the config that is loaded from Bin.

       OFPR\Res\Bin\config.bin ..... likewise this is the main config that is loaded to play OFP Resistance.
       OFPR\my_addon\Bin\config.bin ..... not too sure that an addon needs a bin folder at all, maybe a full mod could use one but I doubt an addon does.
       OFPR\my_addon\config.bin ..... This should actually read OFPR\Addons\my_addon\config.bin, ALL addon configs in the Addons folder are normally read at game start.

2./  For example....class Man in the main game config sets the base qualities for man units, it then goes on to overwrite some or all of those qualities for specific man units, sniper, black ops etc, so the base class man is just the foundation of properties which you can mostly leave and just redefine the ones you need to redefine for any particular unit in your addon.

3./  Adding Useractions to your addon will not add them also to the games base class man definitions, your man addon will inherit all the definitions from the games base man class except those which you specifically change.
BAS units for example DO inherit everything from soldierWB, which in turn inherits everything from class Soldier which itself inherits from class Man, however it only inherits those values that are not specifically changed in the BAS configs.
So copying the Res game config to your addon changes nothing as the above classes are already set by the game config and the copy you add changes nothing.

4./  As I said above, all Addon configs in the games Addon folder are read at game start.
The -mod folder thing is different.
Look at the Res folder, this is a mod folder, it has its own Addons folder, its own Bin folder etc etc.
If you made a mod folder and had all your own folders there, Addon, Bin,dta etc etc, and you start the game using a shortcut which uses your -mod switch to start the game with your mod, then, it should start the game normally and then read from your very own config in your very own Bin folder in your very own mod folder, I hope I didn't lose your there.

5./  I think this is answered as well if you are running your own mod from your own mod folder than I think the normal gabe config is not loaded and instead the config in your mod\Bin is loaded instead.
This must of course be a full config and not a small addon config, it must config everything the game needs like it does in the normal game config, it only changes those bits you want changed.
Addons folder should not contain a Bin folder, only a mod folder should have one of those.


Hope this has helped a bit.


Planck