Jump to content
Sign in to follow this  
avibird 1

Can't get the fighters to spawn in the air "FLY" with this command why?

Recommended Posts

I am using this codeline to spawn my units

_pos = [(getPosATL Player select 0) + (4000 * sin(180)), (getPosATL Player select 1) + (4000 * cos(180)), 0];

GroupJET = CreateGroup West;

This is my script to spawn my fighters

_pos = [(getPosATL Player select 0) + (6000 * sin(180)), (getPosATL Player select 1) + (6000 * cos(180)), 0];

GroupJET = CreateGroup West;

JetA = createVehicle ["A10", _pos, [], 0, "FLY"];

JetAPilot1 = GroupJET createUnit ["USMC_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"];

JetAPilot1 moveInDriver JETA;

JetA FlyInHeight 600;

I don't know why the fighters are on the ground. Using this code with choppers works fine. I know how to spawn the jets in the air using markers or using this codeline JetA = createVehicle ["A10", [(getpos player) select 0,(getpos player) select 1, 0], [], 6000, "FLY"];

What did I NOT DO CORRECT! I know it must be a simple thing. Thanks AVIBIRD.

---------- Post added at 02:13 ---------- Previous post was at 01:21 ----------

The issue is that the A10 will crash right to the ground once the game starts. It has no time to start flying in the air but the AV88 does. The A10 works fine with the other two ways above but why does this happen with the A10. How can you get the units that spawn in using this way _pos = [(getPosATL Player select 0) + (4000 * sin(180)), (getPosATL Player select 1) + (4000 * cos(180)), 0];

not to spawn on top of eachother like there are having an orgy lol. Is there a way to space them out better using this code. AVIBIRD

Share this post


Link to post
Share on other sites

You need to setPosATL the vehicle after you create it - create vehicle seems to use a 2D array:

JetA = createVehicle ["A10", _pos, [], 0, "FLY"];
JetA setPosATL [(getPosATL Player select 0) + (100 * sin(180)), (getPosATL Player select 1) + (100 * cos(180)), 1000];

Any reason why you don't use BIS_fnc_spawnVehicle?

Share this post


Link to post
Share on other sites

@ Mattar_Tharkari

I know it will be less work using BIS_fnc_spawnVehicle? but right now I need the practice looking and attempting to write codes/scripting. I feel it's like doing long division over short division. I want to see the work right now becuase I am starting to see the matrix lol in other words starting to understand the format of scripting for ARMA. I have no formal computer language or scripting knowledge just the love of this game and F around in the editor to see what I can make happen.

After this script/mission that I am working on is done. I will look into using the BIS_fnc_spawnVehicle for the next project.

What is the 100 in this (100 * sin(180) line and what is the 1000 in this (100 * cos(180)), 1000] line.

Why does the units spawn on top of eachother when using this codeline above _pos = [(getPosATL Player select 0) + (4000 * sin(180)), (getPosATL Player select 1) + (4000 * cos(180)), 0];

Share this post


Link to post
Share on other sites

As said before the line is a position [x,y,z]

x - is a position element - east - west axis

y - is a position element - north - south axis

I changed your 4000metres to 100metres so you could see what was happening above your head,

z - height is 1000metres.

They all spawn on top of each other because you are giving them the same position in space to spawn at.

Share this post


Link to post
Share on other sites

I know, you have said that a few times to me about the [x,y,z] (: I get it but sometimes it looks different to me lol.

Are you saying if change the 0 in this code JetA = createVehicle ["A10", _pos, [], 0, "FLY"]; for all the jets they will not be on top of each other! lol or the 100 in your example.

If I use the JetA setPosATL [(getPosATL Player select 0) + (100 * sin(180)), (getPosATL Player select 1) + (100 * cos(180)), 1000]; for each jet in the group then I don't need the line of this _pos = [(getPosATL Player select 0) + (4000 * sin(180)), (getPosATL Player select 1) + (4000 * cos(180)), 0];

at the top of my script.

Hey mate thanks again for all the help. AVIBIRD

Edited by AVIBIRD 1

Share this post


Link to post
Share on other sites

What I would do is this, creates 4 A10s in 1 group 400m from the player at separate positions within a 300m radius at 1000m altitude.

Sets direction east (90degrees) towards a waypoint 4000m east of player at a velocity of 150m per second.

GroupJET = CreateGroup West;
{
_pos = [(getPosATL Player select 0) + (400 * sin(180)), (getPosATL Player select 1) + (400 * cos(180)), 1000];
_x = createVehicle ["A10", _pos, [], 300, "FLY"];
_x setPosATL [getPosATL _x select 0, getPosATL _x select 1, 1000];
_x setDir 90;
_x setVelocity [(sin (getDir _x)) * 150, (cos (getDir _x)) * 150, 0];
_Pilot = GroupJET createUnit ["USMC_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"]; 
_Pilot moveInDriver _x;
_x FlyInHeight 600;
} forEach [JetA,JetB,JetC,JetD];

wp1 = GroupJET addWaypoint [[(getPosATL Player select 0) + (4000 * sin(90)), (getPosATL Player select 1) + (4000 * cos(90)), 1000], 0];

Edited by Mattar_Tharkari

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  

×