Jump to content
Sign in to follow this  
bboy

Spawn plane from different direction and height?

Recommended Posts

Hi people! I have a simple script that via radio calls me a air support, spawned plane..

groupF35 = CreateGroup West;

F35CAS1 = createVehicle ["F35B", [(getMarkerPos "F35Spawn") select 0,(getMarkerPos "F35Spawn") select 1, 100], [], 0, "FLY"];

F35Pilot1 = GroupF35 createUnit ["USMC_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"];

F35Pilot1 moveInDriver F35CAS1;

wp1 = groupF35 addWaypoint [(getMarkerPos "F35Target"), 0];

wp1 setWaypointSpeed "NORMAL";

wp1 setWaypointType "MOVE";

nul = F35CAS1 Spawn { while {alive F35CAS1} do { "eagleMark" setMarkerPos getPos F35CAS1; sleep 0.0001 } };

it works great.

But now i want to use the same script who can spawn enemy planes from diferent direction and height. I tryed to use commands like:

this setPos [(getPos this select 0),(getPos this select 1), 1000]

this setDir 180

no succes, when i used this setDir 180, the plane spawned but was flying in reverse!!!

Any help? Thank you...

Share this post


Link to post
Share on other sites
You might try using setVelocity on your plane in question to get it traveling in the right direction.

I will try it, thank you... But i know how to make him traveling in the right direction, i want him to SPAWN in right direction...

Edited by bboy

Share this post


Link to post
Share on other sites

Simply setDir on the aircraft right after it's spawned. I use a function I wrote for my own stuff that does it just like that:

       _obj = createVehicle [_unitObj, [_posx, _posy, _posz], [], 0, _special];
_obj setDir _heading;
if (_special == "FLY") then { _obj engineOn true; };
_obj setVelocity [_velx, _vely, _velz];
       [_obj, _grp] call BIS_fnc_spawnCrew;

As you can see, I also setVelocity as mentioned above. Then I create the crew last. That code is part of a much larger generic function, but you should get the idea from that snippet. Spawned aircraft work great.

Share this post


Link to post
Share on other sites

...heading and moving to specific direction,

example:

_direction = 180;
_vel = 200;
_planeName = MyPlane;

_planeName setvelocity [0,0,0];
_planeName setdir _direction;
_planeName setVelocity [_vel *sin(_direction), _vel *cos(_direction), 0];

Share this post


Link to post
Share on other sites

Thank you people! I found something, i think on Armaholic forum.. so i experimented. It's enough to put function module on the map. The direction of the spawn and flight depends where you put "markerEnd". It's easy, great and fully functional! Thank you in any case!

su25 = [getMarkerPos "markerStart", [getMarkerPos "markerStart", getMarkerPos "markerEnd"] call BIS_fnc_dirTo, "Su25_ins", EAST] call BIS_fnc_spawnVehicle;

su25_1 = su25 select 0;

su25_1 setPosATL [getPosATL su25_1 select 0, getPosATL su25_1 select 1, 300];

su25_1 flyInHeight 300;

groupSu25 = su25 select 2;

wp1 = groupSu25 addWaypoint [(getMarkerPos "markerEnd"), 0];

wp1 setWaypointSpeed "NORMAL";

wp1 setWaypointType "SAD";

for AZCoder:

Eagerly waiting for your campaign... Dark Tides... ;)

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  

×