Jump to content
Sign in to follow this  
sakura_chan

Spawning a module

Recommended Posts

For whatever reason I need to spawn a module (military symbols) from a script. I need it to be on the same side as "gamelogic", but this has to be completely dynamic ie there can't be a need for any existing modules or logics. I tried createvehiclelocal to make a gamelogic and then createunit the module, attaching it to its group, but it doesn't work. I used (group player) with createvehicle and then "_module joinsilent grpnull" to get it off my team, but it then shows up on the map as an infantry unit. Can any one help me load this module correctly?

---------- Post added at 04:03 PM ---------- Previous post was at 03:35 PM ----------

_martahq = createCenter sideLogic;
_group = createGroup sideLogic;
_marta = (_group) createunit ["MartaManager",position player,[],0,"none"];

done and done!

Share this post


Link to post
Share on other sites

Can it be synced with a unit as well without the editor (by sript)?

I am trying to spawn mortars, but I have no success in syncing them with Artillery module, which is needed for proper working.

Share this post


Link to post
Share on other sites
Can it be synced with a unit as well without the editor (by sript)?

I am trying to spawn mortars, but I have no success in syncing them with Artillery module, which is needed for proper working.

You've obviously have tried this already?

Share this post


Link to post
Share on other sites

Yes, I have, but I don't really know how should I do it, and what does the function do.

This doesn't work though:

_artyhq = createCenter sideLogic;
_group = createGroup sideLogic;
_arty = (_group) createunit ["BIS_ARTY_Logic ",position player,[],0,"none"];

_m = "M252" createvehicle getMarkerPos "w";

_arty synchronizeObjectsAdd [_m];
[_m] call BIS_ARTY_F_initVehicle;

I have tried it with pre-placed, named ARTY module,

I have tried without synchronizeObjects,

I have tried the different combinations of _arty and _m

nothing...

empty M252 (manned later by AI) synced to Arty module in the editor works okay.

Share this post


Link to post
Share on other sites

Well, the first problem I see is that createvehicle doesnt create the AI/operator, just the vehicle/tube.

Share this post


Link to post
Share on other sites

If I spawn the arty module like Shakura Chan did with Marta, I get a Null-object...

So this method works for marta, but doesn't work for Artillery.

Anyways: If I put and sync an empty mortar in the editor, and man it later it works.

But: if I put an Arty module called arty in the editor, and sync it with an empty mortar in the editor I get the same synchronizedObjects, when I synchronise the pre-placed arty via a script. So sync happens with the script, but then the ExecuteTemplateMissiion doesn't work although I use BIS_ARTY_F_initVehicle too.

The effect is the same if I use a manned mortar. The synced unit will be the operator, not the mortar itself: works okay in the editor, doesn't work via script.

Edited by zapat

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  

×