eegore 11 Posted December 16, 2013 Ok so I can't get a running loop of aircraft to eject, reload and eject units but I figure a script that spawns the aircraft assigns units within and ejects them will work and I can just call the script as needed. What I need assistance with is ideas on how to get aircraft to drop troops over a city (Think Red-Dawn) as the player drives into it. I was thinking of calling the spawn/eject/delete script from a trigger. As long as the player is in the area the script will loop and drop units over the city. I've searched "spawn aircraft in air" "spawn plane in air" "spawn in sky" etc. but can't find a script that will create a plane in the sky flying at a set altitude. Once I have that I should be able to move a group into the plane's cargo and cut/paste the eject script I believe. Any ideas? Share this post Link to post Share on other sites
f2k sel 145 Posted December 17, 2013 Very basic but it does work for spawning an aircraft. place in trigger or init null=["start",west,"C130J_US_EP1",800,130,800,"plane_name"] execvm "Spawn_plane.sqf"; you will need three markers "start","move1" and "move2" The parameters can be seen in the script save script spawn_plane.sqf /////////////////////////////////////////////////////////////////////////// //null=["start",west,"C130J_US_EP1",800,130,800,"plane_name"] execvm "Spawn_plane.sqf"; /////////////////////////////////////////////////////////////////////////// ///////////////////////// parameters /////////////////////////// _pos = _this select 0; // spawn position and diretion of spawn _side = _this select 1; // side of unit east west guer civilian _type = _this select 2; // type of vehicle _height =_this select 3; // starting height _speed = _this select 4; // starting speed _altitude = _this select 5; // fly to given altitude _name = _this select 6; // name "plane_name" you choose _dir = markerdir _pos; _grpempty = createCenter _side;// create centre incase it doesn't exist _vehicle = [getmarkerPos _pos, _dir, _type, _side] call bis_fnc_spawnvehicle; _veh = _vehicle select 0;// vehicle _veh setVehicleVarName _name; call compile format["%1 = _veh", _name]; _vehgrp = _vehicle select 2 ;// group of vehicle _veh setpos (_veh modelToWorld [0,0,_height]); _vel = velocity _veh; _veh setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+ (cos _dir*_speed),(_vel select 2)]; _veh flyinHeight _altitude; /////////////////////////////////////////////////////////////////////////// _wp0 = _vehgrp addWaypoint [getMarkerPos "start", 0]; _wp0 setWaypointType "MOVE"; _wp0 setWaypointBehaviour "CARELESS"; //_wp0 setWaypointCombatMode "RED"; //_wp0 setWaypointFormation "Column"; _wp0 setWaypointSpeed "NORMAL"; _wp0 setWaypointStatements ["true", ""]; _wp1 = _vehgrp addWaypoint [getMarkerPos "move1", 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointBehaviour "CARELESS"; //_wp1 setWaypointCombatMode "RED"; //_wp1 setWaypointFormation "Column"; _wp1 setWaypointSpeed "NORMAL"; _wp1 setWaypointStatements ["true", ""]; _wp2 = _vehgrp addWaypoint [getMarkerPos "move2", 0]; _wp2 setWaypointType "CYCLE"; _wp2 setWaypointBehaviour "CARELESS"; //_wp2 setWaypointCombatMode "RED"; //_wp2 setWaypointFormation "Column"; //_wp2 setWaypointSpeed "NORMAL"; _wp2 setWaypointStatements ["true", ""]; Share this post Link to post Share on other sites
eegore 11 Posted December 17, 2013 (edited) This is great. I understand a lot of the script and it really helps to not have to try to chop out the parts from somebody else's mission. I have: null=["start",west,"C130J_US_EP1",800,130,800,"plane1"] execvm "Spawn_plane.sqf"; placed on a radio Alpha trigger and the above script placed in the mission file. I altered waypoint speed to LIMITED. I placed "Start" marker above my head and the "Move1, Move2" further down the map but nothing appears above me when I trigger Radio Alpha. I get no errors when I activate the trigger. Is it supposed to spawn at the "Start" marker? And is the bis_fnc_spawnvehicle taking the place of createVehicle? Thanks for the help. Edited December 17, 2013 by eegore Share this post Link to post Share on other sites
f2k sel 145 Posted December 17, 2013 (edited) I don't think you can have a space in the vehicle name "plane 1" yes it should start and spawn at the "start" marker as it's using function you may need a to place a function module on the map. to see errors you need to enable error reporting http://forums.bistudio.com/showthread.php?121163-Script-not-working-Use-the-showScriptErrors-parameter! Edited December 17, 2013 by F2k Sel Share this post Link to post Share on other sites
eegore 11 Posted December 17, 2013 (edited) It works with a function module synched to the player. The only issue now is I have to have all waypoints set to "LIMITED" or it will do mach 5 over the town spreading troops way too far. If the second waypoint is set to full (to speed up the cycle) then it runs full speed for every waypoint, I even set its starting speed to 30 just to make sure it didn't need to slow down. So if I want 10 aircraft to do this do I synch 10 modules to 10 separate units with 10 separate triggers? I'd need 10 markers as well so they aren't all in a perfect line. Seems like theres a more efficient way. Just as an FYI my terrible editing logic would have me create 10 of everything and have 1 unit run back and forth through 10 triggers to activate this cycle. Edited December 17, 2013 by eegore Share this post Link to post Share on other sites
f2k sel 145 Posted December 17, 2013 I just copied into a new mission the scripts I had posted above and the speed is fine, I suspect you have deleted one of the parameters and it's reading height 800 as the speed Make sure they are correct. 130 is the speed so it won't fall out the sky or go to fast at the start null=["start",west,"C130J_US_EP1",800,130,800,"plane_name"] execvm "Spawn_plane.sqf"; for multiple planes you only need to repeat the call with different height and name or a delay between them. null=["start",west,"C130J_US_EP1",800,130,800,"plane0"] execvm "Spawn_plane.sqf";null=["start",west,"C130J_US_EP1",600,130,700,"plane1"] execvm "Spawn_plane.sqf"; or this way using a delay just add a new name to the array for another plane. null=[] spawn {["start",west,"C130J_US_EP1",800,130,800,_x] execvm "Spawn_plane.sqf";sleep 3} foreach ["plane0","plane1","plane3","plane4"]} You only need one function module and it doesn't need to be synched to anything. Share this post Link to post Share on other sites
eegore 11 Posted December 17, 2013 (edited) This is the change I made: _wp0 = _vehgrp addWaypoint [getMarkerPos "start", 0]; _wp0 setWaypointType "MOVE"; _wp0 setWaypointBehaviour "CARELESS"; //_wp0 setWaypointCombatMode "RED"; //_wp0 setWaypointFormation "Column"; _wp0 setWaypointSpeed "FULL"; _wp0 setWaypointStatements ["true", ""]; _wp1 = _vehgrp addWaypoint [getMarkerPos "move1", 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointBehaviour "CARELESS"; //_wp1 setWaypointCombatMode "RED"; //_wp1 setWaypointFormation "Column"; _wp1 setWaypointSpeed "LIMITED"; _wp1 setWaypointStatements ["true", ""]; _wp2 = _vehgrp addWaypoint [getMarkerPos "move2", 0]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "CARELESS"; //_wp2 setWaypointCombatMode "RED"; //_wp2 setWaypointFormation "Column"; _wp2 setWaypointSpeed "FULL"; _wp2 setWaypointStatements ["true", ""]; _wp3 = _vehgrp addWaypoint [getMarkerPos "move3", 0]; _wp3 setWaypointType "CYCLE"; _wp3 setWaypointBehaviour "CARELESS"; //_wp3 setWaypointCombatMode "RED"; //_wp3 setWaypointFormation "Column"; _wp3 setWaypointSpeed "FULL"; _wp3 setWaypointStatements ["true", ""]; The plane moves at full speed killing men as they eject. I think maybe my problem is that the speed is for the upcoming waypoint so the first speed at the Start marker is irrelevant on the first cycle, I didn't see that marker2 had the waypoint speed deactivated. It makes sense now even though it seems to completely skip marker3 and just cycle between start and move1,move2 markers. I have them set in a large square. I will try to figure out how to post an example mission where I show an example of the effect I was looking for. I can get it to work with waypoints and triggers but since the units are already in the air when the mission begins I cant time the event correctly. If the player stops for 1 minute on the road then the paradrop wont happen as they drive towards the town it would have already happened or be between cycles. This is why I wanted a script to spawn them precisely when the truck is driving to the town. The question I have now is would it be better to spawn and delete planes and ejecting units on a random delay (so the event doesn't look exactly the same every minute) than to have the same planes just fly in circles. Thanks for taking the time to help me on this. Edited December 17, 2013 by eegore Share this post Link to post Share on other sites
f2k sel 145 Posted December 17, 2013 I don't have any time right now but I'll look at it later. It will probably be better to delete vehicle and crew rather than flying in circles and have the trigger go off when the truck is in the right place. When units eject they need to be away from the plane a little and with a delay between them or they can collide. Share this post Link to post Share on other sites
eegore 11 Posted December 17, 2013 I agree. I like the randomness of the planes flying in circles but I think that can be scripted with some variables. As for ejecting I have a working eject script, its just that this is a low jump and at full speed it literally slams the guys into buildings and such. At limited speed they do just fine. Share this post Link to post Share on other sites
f2k sel 145 Posted December 17, 2013 I have knocked up a little demo mission, it will spawn one chute and another plane will come in in a few mins later. http://www.sendspace.com/file/70ppnd Share this post Link to post Share on other sites
eegore 11 Posted December 18, 2013 (edited) Nothing happened. But since I am actually learning I knew to place a module in. I will play with the random timer in that script. Also is there a way to have the vehicle pawn behind the plane? They spawn n the front killing the plane a lot. In this mission I cant get the damn plane to use the 3rd waypoint. It is a mix of spawning an aircraft to arrive as needed, an then just flying in a cycle. Hopefully it wont cause to much mission lag to have 6 of these going at once. http://www.sendspace.com/file/nhh9nx Edited December 18, 2013 by eegore Share this post Link to post Share on other sites
eegore 11 Posted December 20, 2013 In the first demo mission I end up with a sea of crashing C-130s and LAV's coasting down unharmed. I tried altering the script to spawn the vehicles behind the lane but I cant figure it out. Share this post Link to post Share on other sites
f2k sel 145 Posted December 20, 2013 Yes I haven't had time to look at it again, I did notice the odd explosion usually at 4x speed. I think it needs to get the coords from modeltoworld, I notice in your demo the men hit the wing so that needs looking at. Share this post Link to post Share on other sites
eegore 11 Posted December 20, 2013 Yeah some jumps can be a disaster but they usually work. My primary concern on my mission is why the plane refuses to go to move3 marker. If you radio Alpha teleport in then 4x speed on the map you can see the intentional divert. Its come along a lot better with your help. Share this post Link to post Share on other sites
f2k sel 145 Posted December 20, 2013 IS 3 the cycle wp? Share this post Link to post Share on other sites
eegore 11 Posted December 20, 2013 Yeah, the move markers are in a square. Start, move1, move2, move3 but it will travel from move2 to start and skip the third waypoint altogether. All I did was copy/paste the text for the second waypoint in the script and rename the markerpos and the waypoint type. Share this post Link to post Share on other sites
f2k sel 145 Posted December 20, 2013 (edited) It may be an issue with cycle as it is usually placed near to the start waypoint, you may have to add an actual waypoint prior to it and then move the cycle to the start wp. Yes I was right the cycle waypoint needs to be close to the waypoint your trying to loop to.. I fixed my problem of the vehicle exploding with the plane. I've only left the one waypoint to eject the crew which isn't where you had them, also waypoint one opens ramp doors and wp2 closes them. http://www.sendspace.com/file/qxvl3b Edited December 21, 2013 by F2k Sel Share this post Link to post Share on other sites
eegore 11 Posted December 21, 2013 (edited) As I understood it the cycle waypoint is reached and then it cycles with the nearest other waypoint, but in my mission it skipped cycle altogether, never even tried to get there which I understand happens but don't know why. I tried adding: _dir = _this select 3; // direction of spawn When I place: null=["start",west,"C130J_US_EP1",180,800,130,800,"plane_name"] execvm "Spawn_plane.sqf"; the plane still faces North when spawned. I can work around this but I would prefer to be able to spawn aircraft in any given direction. This loop is easy to implement and while its less efficient than spawning and deleting aircraft and groups I think it should work for my intended effect. I see in the script an alternative to cycle waypoint that I think deletes the plane and sends a new one but I'm not sure. I double checked the ramp-bottom portion which is correct but the bottom stays open forever. No big deal but I don't know why that is. Thanks again for all the help. Edited December 21, 2013 by eegore Share this post Link to post Share on other sites
eegore 11 Posted December 22, 2013 (edited) This is my original mission. If you drive the truck at normal speed towards Berezino you see the general timing I was looking for. The issue was that the player could sit in that truck and completely miss the initial drop. Planes 11 and 12 are supposed to be there to cover some of the gap but its harder to time them appropriately. http://www.sendspace.com/file/kj7zs6 If you just let it run while you watch tv or something you will see planes eventually crash and men stop going top their waypoints etc. Takes about 6-10 minutes for it all to start to decay but this mission isn't supposed to be very long. Just some go here - go there type tasks. Edited December 22, 2013 by eegore Share this post Link to post Share on other sites