Jump to content
Sign in to follow this  
Howard

Spawning an active flying aircraft with a trigger..

Recommended Posts

Put it in the 'On Act' field of a trigger. For tesing make it a radio trigger so you can activate it using your radio (press 0-0-radio trigger number). Should appear above your markers position fer shizzle.

Share this post


Link to post
Share on other sites
Put it in the 'On Act' field of a trigger. For tesing make it a radio trigger so you can activate it using your radio (press 0-0-radio trigger number). Should appear above your markers position fer shizzle.

Thank you, now it spawns.. but it's still at ground level. Have you got a clue why, or perhaps even a solution to this?

And also, thank you for replying this fast :)

Share this post


Link to post
Share on other sites
Before you guys do more rocket science to just spawn a plane and a pilot... :)

Place the functions module in the editor.

_vec_array = [markerPos "some_marker", random 360, "A10", west] call BIS_fnc_spawnVehicle;

That's it. Paramters and return values:

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 function will add the correct crew members, fill up all crew positions and will spawn aircrafts in the air, aka flying.

Xeno

*****************

Forgive me - I am totally new to this. How do I "Place the functions module in the editor."

Also, how do I then call the Function.

I have read over and over where people give functions and name stuff like a noobie to scripting for ARMA knows where to even put the stuff they talk about.

Thanks...

Share this post


Link to post
Share on other sites

Could someone help me fix this? I don't know if it just doesn't spawn the unit ,or if the unit spawns and doesn't get moved in, someone lend me a hand?

planeGroup = CreateGroup West;
AN2CAS = createVehicle ["An2_1_TK_CIV_EP1", [(getMarkerPos "AN2Create") select 0,(getMarkerPos "AN2Create") select 1,100], [], 0, "FLY"];
_pilot = planeGroup createUnit ["US_Pilot_Light_EP1", AN2Create, [], 0, "NONE"];
_pilot assignAsDriver AN2CAS;
_pilot moveInDriver AN2CAS;

I know that AN2Create is a valid marker, and AN2CAS is also valid(the plane).

Share this post


Link to post
Share on other sites
getMarkerPos "AN2Create"

instead of just AN2Create in the pilot createUnit string. You're not creating a pilot, so the plane is crashing. :)

Share this post


Link to post
Share on other sites
getMarkerPos "AN2Create"

instead of just AN2Create in the pilot createUnit string. You're not creating a pilot, so the plane is crashing. :)

Nevermind, it was the position the stuff was spawning in that was malfunctionining, the 1000,1000,1000 i changed that to getpos AN2CAS, and it worked :yay:

Now to make the plane face the waypoint it's heading to when it spawns :mad:

Share this post


Link to post
Share on other sites

This is the code I used when I needed to do that, the line in blue sets the direction. I had to create something, a shiny ball in this case, because relativeDirTo works on objects not just positions sadly.

// Create a little shiny ball we can use to get the direction from start to caller with
_blinky = "Sign_sphere10cm_EP1" createVehicle _start;
[color="BLUE"][b]_flightPath = [_blinky, _unit] call BIS_fnc_relativeDirTo;[/b][/color]

// Spawn the helo, facing the user, in the air at the start location.
_ch = [[_start select 0, _start select 1, 50], _flightPath, _chopperType, side _unit] call BIS_fnc_spawnVehicle;

Share this post


Link to post
Share on other sites

Sorry can you delete this post thx

Edited by DarkEclip

Share this post


Link to post
Share on other sites

I too want to do something similar to the original poster. I want to spawn in some flying objects once the trigger's been activated. Do I need a script to do this or do I input a line of code in the init box of a trigger from the in-game editor?

Edited by Mach2Infinity

Share this post


Link to post
Share on other sites
;1905098']Thanks Buliwyf' date=' for actually being helpful. :)[/quote']

Although you may think I was not helpful, doesnt mean I actually wasnt, all you need to create objects/units is in my post.

Also, you may think I was too harsh on what I said, sorry, but its the same thing that asking what can you do to ride a bike, you have to learn first how to do it, am I wrong? :)

_neo_

Share this post


Link to post
Share on other sites
Although you may think I was not helpful, doesnt mean I actually wasnt, all you need to create objects/units is in my post.

Also, you may think I was too harsh on what I said, sorry, but its the same thing that asking what can you do to ride a bike, you have to learn first how to do it, am I wrong? :)

_neo_

You were helpful, although your response seemed a little curt. I'm usually patient but as I'm editing a video, which will be the first proper trailer for a mod I want to do. Time is of the essence for me. I'd appreciate if you or anyone would tell me how I can implement a script/code to do it. To refresh, I want flying objects, in my case meteors (you'll see when my video is done!) to spawn when activated by a trigger.

Do I write a script with a line such as this one?

_veh = createVehicle ["A10",getMarkerPos "marker1",["marker2","marker3"], 0, "FLY"]

Regards,

[Topgun]

Edited by Mach2Infinity

Share this post


Link to post
Share on other sites

Hey,

Yes, you could create a object and then just disable the simulation so it stays on the air, but you need the height too, for example using a marker to get the position and then set the height:

_height = 150;
_pos = getMarkerPos "marker_1";
_pos set [2, _height];
_veh = createVehicle ["A10", _pos, [], 0, "CAN_COLLIDE"];
_veh enableSimulation false;

You could use init.sqf to use the code, also, A10 is not an actual class name, search for it here.

_neo_

Share this post


Link to post
Share on other sites

I created a init.sqf file and put it in the mission folder. I created a marker in the editor and named it meteor and I made sure the marker was named meteor in the init.sqf. As for the "vehicle". I un-pbo'd the asteroid pbo and looked in the config.bin file and found its class name; ice_flying_asteroid (there's a second one - ice_flying_asteroid2). I input ice_flying_asteroid in the init.sqf and I loaded the mission. There it was, hanging in the sky haha. Thank you very much Neokika. However, before I can rejoice fully. I wanted to see if I could make it fall from the sky. So I changed _veh enableSimulation false; to _veh enableSimulation true;. It hasn't made a difference and it still hangs there. Furthermore, is there a way to trigger the vehicle spawn? I tried to synchronise a trigger but it wouldn't connect.

Share this post


Link to post
Share on other sites
;1906036']I created a init.sqf file and put it in the mission folder. I created a marker in the editor and named it meteor and I made sure the marker was named meteor in the init.sqf. As for the "vehicle". I un-pbo'd the asteroid pbo and looked in the config.bin file and found its class name; ice_flying_asteroid (there's a second one - ice_flying_asteroid2). I input ice_flying_asteroid in the init.sqf and I loaded the mission. There it was' date=' hanging in the sky haha. Thank you very much [b']Neokika[/b]. However, before I can rejoice fully. I wanted to see if I could make it fall from the sky. So I changed _veh enableSimulation false; to _veh enableSimulation true;. It hasn't made a difference and it still hangs there. Furthermore, is there a way to trigger the vehicle spawn? I tried to synchronise a trigger but it wouldn't connect.

Hi TopGun,

Well, what may be happening is that the objects youre using (community made) may not have simulation at all, so they will always stay static.

Your best option is to go to the Addons Maker's thread and ask what can you do.

_neo_

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  

×