Home   Help Search Login Register  

Author Topic: Modules - is it addonable?  (Read 3853 times)

0 Members and 1 Guest are viewing this topic.

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Modules - is it addonable?
« on: 07 Jul 2009, 09:00:36 »
Is it possible to create a user made addons as Module?

I'm not a classic addon maker (3D models and configs), but I really want to create a new Module for ArmA2. This is the Info Sharing Module:-[
If the player syncronize this to different (but same side) groups, they share the info with each other.

But I don't know how I start...
I can create the scripts, but how the scripts will be a Module?
Fix bayonet!

Offline i0n0s

  • Former Staff
  • ****
Re: Modules - is it addonable?
« Reply #1 on: 07 Jul 2009, 11:04:12 »
You create a game logic (inside the config.cpp). Then you use the eventhandler to activate your scripts when the game logic will get created.

That's it. As soon as the player place the game logic/module and starts the map, your scripts will take control :)

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: Modules - is it addonable?
« Reply #2 on: 07 Jul 2009, 11:56:01 »
In line with what i0n0s said, here's a little sample from a test module I made the other day:
Code: (config.cpp) [Select]
#define _ARMA_
class CfgPatches
{
    class HMM_TestModules
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 0.1;
        requiredAddons[] = {};
    };
};

class CfgVehicles
{
    class Logic;
    class HMM_WorkingModule: Logic
    {
        displayName = "Working Test Module";
        icon = "\HMM\test\icon";
        picture = "\HMM\test\icon";
        vehicleClass = "Modules";
        class Eventhandlers
        {
            init = "private [""_ok""]; _ok = _this execVM ""HMM\test\init.sqf""";
        };
    };
};

Code: (init.sqf) [Select]
hint "My module is working!";
If you want to handle synchronisation, etc. then you just need to use synchronizedObjects.  Groups are, of course, handled in the normal fashion.

Offline bardosy

  • Honoured Contributor
  • ***
  • campaign designer
    • CartooDiv
Re: Modules - is it addonable?
« Reply #3 on: 07 Jul 2009, 12:07:41 »
WOW! It's a huge help to me! Thanks!

And when I finished everything, the script and this cpp and maybe the icons (is it in paa format?) I just make a BPO and put it in Addons folder and it will works from the Editor?
Fix bayonet!

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: Modules - is it addonable?
« Reply #4 on: 07 Jul 2009, 12:12:27 »
Yup, PAA for the icon... then PBO, and you're done.  The icon itself is simply a plain white image, and the icon design itself is the alpha channel.