Jump to content
Sign in to follow this  
almaniak

Spawning an artillery piece, Support Artillery and SupportRequester in script, syncing them and making it work.

Recommended Posts

I've been trying to get a script working that spawns an artillery piece, support Artillery and support request module in script and sync them up with each other to make it work. The idea is that at a random place a ship (from CUP) is spawned and an artillery piece placed on top of that (and made invisible and attachedTo). Then I want this arty piece to be usable with BIS' support module stuff.

 

Now I've tried replacing "SupportProvider_Artillery" with "SupportProvider_Virtual_Artillery" and that actually works (Support available even pops up on the side of the screen), yet the normal non virtual variant does not want to start up. Do I need to perform any extra steps to kickstart the support framework?


// Frig and Arty
_pos = getMarkerPos "bs";
frig = createVehicle ["CUP_B_Frigate_ANZAC", _pos, [], 0, "NONE"];
arty = createVehicle ["B_MBT_01_arty_F", position frig, [], 0 ,"NONE"];
_az =  getDir frig;
_gopos = [position frig, 35, -_az] call BIS_fnc_relPos;
_gopos = [_gopos select 0, _gopos select 1, (_gopos select 2) + 13];
arty setpos _gopos;
arty attachTo [frig];

// Support
_logicGroup = createGroup sideLogic;
SupportReq = _logicGroup createUnit ["SupportRequester",getpos player, [], 0, "FORM"];
ArtySupport = _logicGroup createUnit ["SupportProvider_Artillery", _pos, [], 0, "FORM"];
ArtySupport synchronizeObjectsAdd [arty];
arty synchronizeObjectsAdd [ArtySupport];

//Setup requestor limit values
{
	[SupportReq, _x, 0] call BIS_fnc_limitSupport;
}forEach [
	"Artillery",
	"CAS_Heli",
	"CAS_Bombing",
	"UAV",
	"Drop",
	"Transport"
];


//Setup provider values
{
	ArtySupport setVariable [(_x select 0),(_x select 1)];
}forEach [
	["BIS_SUPP_vehicles",[]],        //types of vehicles to use
	["BIS_SUPP_vehicleinit",""],    //init code for vehicle
	["BIS_SUPP_filter","SIDE"]        //whether default vehicles comes from "SIDE" or "FACTION"
];

[a, SupportReq, ArtySupport] call BIS_fnc_addSupportLink;

//Set our limit on the requester for artillery to 1
[SupportReq, "Artillery", 1] call BIS_fnc_limitSupport;

Thanks in advance!

 

EDIT: I've tested it with a preplaced editor unit instead of one made by script and that one does seems to work. Is there anything special I should to on my scrip added vehicle to make that work as well?

  • Like 1

Share this post


Link to post
Share on other sites

Make sure your  arty vehicle has crew.

createVehicleCrew arty;

Share this post


Link to post
Share on other sites

 

Make sure your  arty vehicle has crew.

createVehicleCrew arty;

 

Thank, for helping me and making me feel smaller than the first single celled organism that came out of our primordial soup.  :P

I can't believe I forgot that of all things, thanks a bunch!

Share this post


Link to post
Share on other sites

There also mod called @atlas_lhd which of you can be interested.

Share this post


Link to post
Share on other sites

That does like nice, I'll keep that addon in mind if we need an expansion to our fleet base  :D

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  

×