Home   Help Search Login Register  

Author Topic: Creating Module during mission  (Read 2797 times)

0 Members and 1 Guest are viewing this topic.

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Creating Module during mission
« on: 01 May 2010, 13:35:56 »
How can I create/spawn a working module via script? I've been trying to add "AITalk" and "Radio Sounds"-ACEmodules with this script code, but I cant get them working:
Code: [Select]
_llog1 = creategroup LOGIC;
_c1 = _llog1 createUnit ["ACE_RadioTalk_Logic", [8350.36,7963.35,0], [], 0, "NONE"];
_llog2 = creategroup LOGIC;
_c2 = _llog2 createUnit ["ACE_AITalk_Logic", [8350.36,7966.35,0], [], 0, "NONE"];

Note that those modules dosent need to be synced when placed in editor.

Edit: Is the module spawning even possible anymore? I cant get anything working. Even the few samples from BISForum dosent work.

Edit2: I found out that LOGIC side dosent work, but its possible to use WEST as side. And some of the ACE modules cant be spawned. I enabled AItalk from init.sqs with:
Code: [Select]
ace_sys_AItalk_enabled=true;

 
« Last Edit: 02 May 2010, 20:10:27 by SaOk »

Offline Inkompetent

  • Members
  • *
Re: Creating Module during mission
« Reply #1 on: 03 May 2010, 19:47:19 »
Saw a reply to this elsewhere (think it was the dev-heaven ACE2 CIT), and it so happens that the ACE modules are nothing more than a variable-declaration that has to be run early on in the mission (within the first 5-10 seconds). After that ACE2 decides if the system in question should be used or not, and it doesn't check again for the rest of the mission.

If you are trying to create them by script at the very mission start however I don't have a clue why it doesn't work =/


Edit: Just realized what I wrote might not be relevant for your problem (so much for having read the thread before and thinking I remember what it's about). Might be nice info non the less though ^^
« Last Edit: 03 May 2010, 19:49:51 by Inkompetent »

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Re: Creating Module during mission
« Reply #2 on: 04 May 2010, 10:54:21 »
Yep, I heard about the variable-declaration in MOD's BIforum topic. I also found out that 5-10 seconds limit for ACE2 wounding system module, but its not bad. I am still using it in my "Black Forest"-mission. Player have only that 5 sec to decide if I he want to enable that from starting dialog. After that the choise it done by player or computer. But the current version I uploaded still have briefing at start which breaks the module. In next version the briefing isnt shown and the module works great everytime.

Offline Inkompetent

  • Members
  • *
Re: Creating Module during mission
« Reply #3 on: 04 May 2010, 21:28:55 »
Couldn't you make it a parameter in the Params class in description.ext instead in that case, so that the choice is made even before getting to the briefing screen?

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Re: Creating Module during mission
« Reply #4 on: 04 May 2010, 23:28:15 »
That could work, but not very good for my mission because I also want to give an option to choose BIS wounded system instead or even the orginal system. Once the ACE wounded system is enabled then it cant be disabled anymore.

Offline Inkompetent

  • Members
  • *
Re: Creating Module during mission
« Reply #5 on: 04 May 2010, 23:39:40 »
Well, you could just let the player make the choice. Like choosing between 'No wound system', 'ACE Wounds' and 'BIS Wounds'. You can then reference the selected choice and spawn medic modules depending on that.

Since the variables in teh Params array are choosen before the briefing screen they will be accessible for the engine when it starts spawning units, so there shouldn't be any worry about managing to spawn moduels (and in the BIS-case sync it) in the 5-10 second time-frame.

I tend to use the below in my init.sqf:
Code: [Select]
// class Params
if (!isNil "paramsArray") then
{
for [{_i = 0},{_i < (count paramsArray)},{_i = _i + 1}] do
{
call compile format ["PARAMS_%1 = %2",(configName ((missionConfigFile >> "Params") select _i)),(paramsArray select _i)];
};
};

So if you have a class Params entry called woundSys it'll end up becoming the variable PARAMS_woundSys

An example class Params entry in description.ext would be:
Code: [Select]
class Params
{
    class woundSys
    {
        title = "Wounding System:";
        values[] = {0,1,2};
        default = 1;
        texts[] = {"No wound system", "First Aid Module", "ACE Wounds"};
};


Should be noted that this needs to be high up in the init.sqf to be sure that the variable can do its job as fast as possible, since init.sqf doesn't run until after units are created and their init-lines have been run (which I guess you know already).
« Last Edit: 04 May 2010, 23:46:41 by Inkompetent »