Home   Help Search Login Register  

Author Topic: Construction Module Help  (Read 5284 times)

0 Members and 1 Guest are viewing this topic.

Offline monty67t

  • Members
  • *
Construction Module Help
« 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

Thanks,
Monty

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Construction Module Help
« Reply #1 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)...
try { return true; } finally { return false; }

Offline monty67t

  • Members
  • *
Re: Construction Module Help
« Reply #2 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!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Construction Module Help
« Reply #3 on: 13 Jun 2009, 22:15:43 »
Armatec has made a nice class list with pictures, if that helps.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline monty67t

  • Members
  • *
Re: Construction Module Help
« Reply #4 on: 13 Jun 2009, 22:21:55 »
Damn! I knew that. Thanks for reminding me.

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Construction Module Help
« Reply #5 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!
];

...

try { return true; } finally { return false; }

Offline Dazakiwi

  • Members
  • *
Re: Construction Module Help
« Reply #6 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
« Last Edit: 29 Nov 2012, 02:40:15 by Dazakiwi »

Offline Dazakiwi

  • Members
  • *
Re: Construction Module Help
« Reply #7 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?

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Construction Module Help
« Reply #8 on: 01 Dec 2012, 06:17:41 »
There is. It's called a "moveingunner" command.