RonnieJ 10 Posted January 14, 2010 Hey guys... when I try to create an enemy plane group they most of the times go into the ground and crash... and sometimes get in the air... any ideas? Is there any way of getting them higher in the air with BIS_fnc_spawnGroup? Share this post Link to post Share on other sites
shuko 45 Posted January 14, 2010 Setpos & flyinheight them after spawning. Did you try BIS_fnc_spawnVehicle as well? Share this post Link to post Share on other sites
RonnieJ 10 Posted January 14, 2010 Nop im doing some totally random spawning by using BIS_fnc_spawnGroup ... and aparently sometimes when it is a group of enemy fighters they go into the ground :S _grpx = count(configFile >> "CfgGroups" >> "East" >> "RU" >> _type);_grps = []; for "_x" from 1 to _grpx - 1 do { _grps = _grps + [(configFile >> "CfgGroups" >> "East" >> "RU" >> _type) select _x]; }; Could you please give me your input on it SHK ... Share this post Link to post Share on other sites
TRexian 0 Posted January 14, 2010 Ah, I've used BIS_fnc_spawnVehicle - it spawns the necessary crew and such. The syntax: /* File: spawnVehicle.sqf Author: Joris-Jan van 't Land Description: Function to spawn a certain vehicle type with all crew (including turrets). The vehicle can either become part of an existing group or create a new group. Parameter(s): _this select 0: desired position (Array). _this select 1: desired azimuth (Number). _this select 2: type of the vehicle (String). _this select 3: side or existing group (Side or Group). Returns: Array: 0: new vehicle (Object). 1: all crew (Array of Objects). 2: vehicle's group (Group). */ The spawning is something like this: // create aircraft _spawn = [_pos,_azim, _unit, _side] call BIS_fnc_spawnVehicle; Share this post Link to post Share on other sites
RonnieJ 10 Posted January 14, 2010 Im not sure the problem is missing pilots... otherwise BIS_fnc_spawnGroup would be FUBAR... the problem must be that the default start height and speed not always is high enough to get into the air :) Share this post Link to post Share on other sites
TRexian 0 Posted January 14, 2010 As I recall, though, they are spawned with no velocity. :) In fact, I think their engines are off. ;) Share this post Link to post Share on other sites
shuko 45 Posted January 14, 2010 (edited) From my experience, all I can say is that you need to setpos/flyinheight planes and choppers. There is some code in the function that should do it, but yet to see it actually work. Edit: Actually it seems that you need to specify their starting height already in the position you pass as parameter. Function only sets it to 50, if only x and y are given, but not z. _sim = getText(configFile >> "CfgVehicles" >> _type >> "simulation"); if (_sim in ["airplane", "helicopter"]) then { //Make sure aircraft start at a reasonable height. if ((count _pos) == 2) then { _pos = _pos + [50]; }; _veh = createVehicle [_type, _pos, [], 0, "FLY"]; //Set a good velocity in the correct direction. _veh setVelocity [50 * (sin _azi), 50 * (cos _azi), 0]; Edited January 14, 2010 by Shuko Share this post Link to post Share on other sites
RonnieJ 10 Posted January 14, 2010 Okay makes sence then... thx... could any of you help me out to implement the part you are talking about SHK? _grpx = count(configFile >> "CfgGroups" >> "East" >> "RU" >> _type);_grps = []; for "_x" from 1 to _grpx - 1 do { _grps = _grps + [(configFile >> "CfgGroups" >> "East" >> "RU" >> _type) select _x]; }; I surpose _grps is the array containing the array of vehicles? And I need to somehow identify it and set speed/height if the type is heli or plane ---------- Post added at 11:03 PM ---------- Previous post was at 10:56 PM ---------- I get some part of you example SHK but im not 100% sure.. what is the "simulation" bit about? shouldnt that be my _x var? :S Share this post Link to post Share on other sites
shuko 45 Posted January 14, 2010 That was just a cut&paste from BIS' code. Try passing [x,y] position instead of [x,y,z] when spawning. If that fails. Try (when spawning), check if the group type is air, replace the z in the position with 100 or something. Share this post Link to post Share on other sites
Rick01 10 Posted January 15, 2010 HI all I have use the BIS_fnc_spawnVehicle and BIS_taskpatrol when spawing air vehicle and that works every well. I have a small script that I will post when I get home tonight Share this post Link to post Share on other sites
RonnieJ 10 Posted January 15, 2010 Great Rick01 would be much appreciated Share this post Link to post Share on other sites
Rick01 10 Posted January 19, 2010 Sorry that I have not gotten back to you sooner Try this out it is a script that I posted under a dif name,(one for work and one for home). I have not tryed it but it should work // ///////////////////////////////////////////////////////////////////////////// // / Random spawn Generator // This SQF Function created using Script Edit v0.7 on 2010-01-18 17:35:20Z // // OzeRick // RandomSpawnGen.sqf // version 1.0. // // this script allows you to spawn any side and number of unit in a random area around a central point // to use //1.} place a Functions Module onto map //2.) place a game logic/Objects/Game logic on map and name it i.e. t1 //3.) You can place the below in the logic or a trigger its up to you // // parameters //nul = [position,area,Number,Distance,Side,] execvm"RandomSpawnGen.sqf"; //nul = [t1,500,20,150,east] execvm "RandomSpawnGen.sqf"; // // you can change _units = ........ // to // ["MOL_Officer","MOL_Rifleman","MOL_Medic","MOL_Sold eir_AA","MOL_Soldier_AT","MOL_Soldier_MG"]; // or any other units that you like // //////////////////////////////////////////////////////////////////////////////////////////////// _pos = _this select 0; _area = _this select 1; _Num = _this select 2; _dist = _this select 3; _side = _this select 4;; _skill = [0.6,1]; _a = "SkeetDisk";// obj to use as spawn place. _b = “A10â€;// or what every plane you may won’t for [{_i = 0},{_i < _Num},{_i = _i + 1}] do { _newpos = GetPos _pos; _posX = _newpos select 0; _posY = _newpos select 1; if ( isNil "ob_u" ) then { ob_u = 0 }; ob_u = ob_u+ 1; _mar = format["ob%1", ob_u ]; _mar = _a createVehicle[(_posX + random _area)-_area/2, (_posY + random _area)-_area/2,0]; _unit = [getpos _mar,0,_b,_side] call bis_func_spawnvehicle [_unit, ( getPos _mar), _dist] call BIS_fnc_taskPatrol; sleep 0.8; }; Share this post Link to post Share on other sites