OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: monty67t on 13 Jun 2009, 09:51:07

Title: Construction Module Help
Post by: monty67t on 13 Jun 2009, 09:51:07
I'm trying to get this construction module setup properly. Basically what I'm trying to do is set it up so the player can build defenses without worrying about money. I don't want the buildings to cost anything or I need the player to have enough money so he can build whatever he wants. I've read the information on the biki and I just don't understand it. I understand how to synch the module with the player and that works and I get the construction interface, but there is nothing there to select to build. You have to list it in these optional parameters for the module somehow. Any help is greatly appreciated.

LINK TO BIKI INFO:
http://community.bistudio.com/wiki/Construction_Interface (http://community.bistudio.com/wiki/Construction_Interface)

Thanks,
Monty
Title: Re: Construction Module Help
Post by: Worldeater on 13 Jun 2009, 20:57:00
create a new script:

Code: ("coin_init.sqf") [Select]
private ["_callbackOnPurchase"];

_callbackOnPurchase = {
    // deal with the money here...
    hintSilent format ([
        "Module:\n%1\n\n" +
        "???:\n%2\n\n" +
        "Building:\n%3\n\n" +
        "Position:\n%4\n\n" +
        "Direction:\n%5"] +
        _this);
};


_this setVariable ["BIS_COIN_fundsDescription",
    ["Foos ", "Bars "]
];

_this setVariable ["BIS_COIN_funds",
    ["100","200"]
];

_this setVariable ["BIS_COIN_categories",
      ["Base","Defence"]
];

_this setVariable ["BIS_COIN_items",
    [
        ["USMC_WarfareBBarracks",   "Base",   [1,200]], // 1 == costs Bars
        ["USMC_WarfareBMGNest_M240","Defence",[0, 50]]  // 0 == costs Foos
    ]
];

_this setVariable ["BIS_COIN_onPurchase",
      _callbackOnPurchase
];

Then put this in the init field of the module:
Code: [Select]
dummy = this execVM "coin_init.sqf";
It looks like the module doesn't do the accounting for you. If this is correct you'll have to do it yourself from the "BIS_COIN_onPurchase" callback.

For further information unpbo the warfare2.pbo and analyze it (sorry, I don't feel like doing it for you at the moment :P)...
Title: Re: Construction Module Help
Post by: monty67t on 13 Jun 2009, 21:45:41
Thanks so much, that's got me started. I really appreciate you posting that.

In this section, where you name the buildings that can be built and what they cost. How do you get the proper classnames for all the different things to build?

Code: [Select]
_this setVariable ["BIS_COIN_items",
    [
        ["USMC_WarfareBBarracks",   "Base",   [1,200]], // 1 == costs Bars
        ["USMC_WarfareBMGNest_M240","Defence",[0, 50]]  // 0 == costs Foos
    ]

Are they listed somewhere or just unpbo and search?

Thanks again!
Title: Re: Construction Module Help
Post by: Spooner on 13 Jun 2009, 22:15:43
Armatec has made a nice class list with pictures (http://www.armatechsquad.com/ArmA2Class/), if that helps.
Title: Re: Construction Module Help
Post by: monty67t on 13 Jun 2009, 22:21:55
Damn! I knew that. Thanks for reminding me.
Title: Re: Construction Module Help
Post by: Worldeater on 14 Jun 2009, 07:13:41
I just saw the thread on the BIF. Gaia provided some useful information there: the module actually does the accounting for you!

Code: [Select]
...

myFoos = 100;
myBars = 200;

_this setVariable ["BIS_COIN_funds",
    ["myFoos","myBars"] // mind the quotes!
];

...

Title: Re: Construction Module Help
Post by: Dazakiwi on 22 Nov 2012, 22:41:28
Thanks so much, that's got me started. I really appreciate you posting that.

In this section, where you name the buildings that can be built and what they cost. How do you get the proper classnames for all the different things to build?

Code: [Select]
_this setVariable ["BIS_COIN_items",
    [
        ["USMC_WarfareBBarracks",   "Base",   [1,200]], // 1 == costs Bars
        ["USMC_WarfareBMGNest_M240","Defence",[0, 50]]  // 0 == costs Foos
    ]

Are they listed somewhere or just unpbo and search?

Thanks again!

The example script works but if i add another line, nothing shows up..

["TOW_TriPod_US_EP1", "Defence",[1,60]] // 1 == costs Bars

I got the classname from link provided in this thread. Debug isn't showing any errors...any thoughts?


I have tried to unpbo a warfare mission to see how its done, but cant seem to find the .sqf which lists all these.

Cheers

Daza
Title: Re: Construction Module Help
Post by: Dazakiwi on 29 Nov 2012, 05:53:11
I Solved this problem.  :)

When added extra lines for more defense items, make sure the very last line does NOT have a , after the brackets and every new line before it does ie. ]], Otherwise it will give a missing bracket error in the debug
which is misleading.

Now only if there was a way to have Static items that comes with a soldier occupying the gunner position?
Title: Re: Construction Module Help
Post by: savedbygrace on 01 Dec 2012, 06:17:41
There is. It's called a "moveingunner (http://ofpec.com/COMREF/index.php?action=details&id=225&game=All)" command.