Jump to content
Sign in to follow this  
McGlazd

How to create Modules via a script ?

Recommended Posts

Hello,

I am not even sure if this is possible. But since modules are Logic class, they must have the same behaviour. I'm trying to find a solution to use SOM in multiplayer missions. To make the module local, I create it from a trigger activated by radio.

And it doesn't work, that's why I'm asking for help! :yay:


// creating SOM
_socom = "SecOpManager" createVehicle (position player);
_socom synchronizeObjectsAdd [player];

hint "Init starting...";

// Wait until SOM is initialized
waitUntil { not isNil { _socom getVariable "initDone"} };
waitUntil { _socom getVariable "initDone" };

// activate arty
[["artillery_barrage"], player, [[ARTY, [1,2,3,4,5,6,7,8,9]]]] call BIS_SOM_addSupportRequestFunc;

hint "Arty initialized";

I do get the message "Arty initialized", which means the SOM has been actually created. I believe. But for some reason it doesn't work. Maybe because of the synchro things, I don't know... :confused:

Thank you !

Edited by McGlazd

Share this post


Link to post
Share on other sites

SOM doesnt work in MP as is?

Oh and here i thaught "wow how easy to setup a randomized game for me and a mate when we got nothing else to do". :) Well ok i hope you come up with a solution to it. ;)

Good luck!

Alex

Share this post


Link to post
Share on other sites

This is just a guess but:

As soon as you create the vehicle, the socom init will run and find no synched objects -> exit.

Share this post


Link to post
Share on other sites

I'd try using createUnit for logics. Run the sync right after creating it. Do not use createVehicle.

Share this post


Link to post
Share on other sites

According to DH topic, you can't use createVehicle for logics, but can use either:

- createVehicleLocal, or

- createGroup sideLogic, plus createUnit

Share this post


Link to post
Share on other sites
According to DH topic, you can't use createVehicle for logics, but can use either:

- createVehicleLocal, or

- createGroup sideLogic, plus createUnit

Thank you, I'll give a try and send here a feedback this evening.

Share this post


Link to post
Share on other sites

It is not stable. Sometime I can get the support menu from Communications but only briefly...

Share this post


Link to post
Share on other sites

DnA sayed that there are issues with the com-menue in MP and that this will be fixed with the next patch. I realy hope so :) Maby we should wait till then. If there is a code problem with it, we can test as much as we want and wount get real results. Think this patch should be released at 19th June!?!?!? Dount want to give bad informations in the early morning, so im not shure.

Where ist the editingguid :rolleyes: ...

So a question abaout your script. You have created the SOM with:

_socom = "SecOpManager" createVehicle (position player);

But this is still local namespace. isnt it? the "_" means you creat a local variable. this is only held by the system as long the script is being executed. Maby im wrong. But i think you have to creat it in global namespace... !? so without "_" Like the variable "player" is a global variable.

Share this post


Link to post
Share on other sites

Ok if taken this script and played a little bit around, here my edited version:

hint "calling script...";

// creating SOM
_group = createGroup sideLogic;
"SecOpManager" createUnit [position player, _group, "socom = this"];//<---Working in editor, singleplayer, IngameServer
//socom = "SecOpManager" createVehicleLocal getPos player; //<---not working
socom synchronizeObjectsAdd [player];

hint "Init starting...";

// Wait until SOM is initialized
waitUntil { not isNil { socom getVariable "initDone"} };
waitUntil { socom getVariable "initDone" };

hint "Init done... Adding ArtySupport";

// activate arty
//YOu can only call one barrage with this. After you fired the arty once, you have to call it again.
[["artillery_barrage"], player, [[ARTY, [1,2,3,4,5,6,7,8,9]]]] call BIS_SOM_addSupportRequestFunc;

hint "Arty initialized";

This is working in Editor, SinglePlayer and On the IngameServer, taht is started form the multiplayer menu with the "new" button. Nut it is not working on a dedicated server. Then the socom will not get initialized. Last hint is "Init starting...". So maby im still doing somethig wrong for a Dedicated Server!??

Edit:

Now iv tried this:

// creating SOM
_group = createGroup sideLogic;
"SecOpManager" createUnit [position P1, _group, "socom = this"];//<---Working in editor, singleplayer, IngameServer
//socom = "SecOpManager" createVehicleLocal getPos P1;// <---not working
socom synchronizeObjectsAdd [P1];

P1 is the name of the Player in the Editor. Now the SOM will be initialized on the dedicated server, and provides Missions! But still no ComMenu-Entrys for calling support :)

It is nesecary to call the BIS_SOM_addSupportRequestFunc again if you have fired the barrage once!

Edited by ENONIC

Share this post


Link to post
Share on other sites

Doesnt work on a dedicated but that could be fixed by next patch as someguy just said soo wait and see best bet! only a week and a bit to go

Share this post


Link to post
Share on other sites
DnA sayed that there are issues with the com-menue in MP and that this will be fixed with the next patch. I realy hope so :) Maby we should wait till then. If there is a code problem with it, we can test as much as we want and wount get real results. Think this patch should be released at 19th June!?!?!? Dount want to give bad informations in the early morning, so im not shure.

Where ist the editingguid :rolleyes: ...

So a question abaout your script. You have created the SOM with:

_socom = "SecOpManager" createVehicle (position player);

But this is still local namespace. isnt it? the "_" means you creat a local variable. this is only held by the system as long the script is being executed. Maby im wrong. But i think you have to creat it in global namespace... !? so without "_" Like the variable "player" is a global variable.

The "_" is only a convention. It doesn't force this variable to be local. Actually, in this script _socom is the name of the created object. Not the object itself.

Thank you for your remarks in your second post. I was blocked to the same point. I don't feel alone anymore ;)

Share this post


Link to post
Share on other sites

Am I to understand that SOM is still porked in MP and that is why it generates a single mission for myself and the players joining my (non dedicated) server?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×