quensi130 10 Posted September 20, 2014 I am making a dogfighting mission with the F/A18-E and SU/35 and I can't find any script or page with a script to make us respawn in an F/A18-E already flying when we are blown up or crash. Can anyone help? Share this post Link to post Share on other sites
John Spartan 89 Posted September 20, 2014 (edited) Hi Quensi, idea to accomplish your goal is relatively simple. 1. create the aircraft you would like to respawn 2. add a eventhandler or a script to units init so it kick's in when the unit is killed 3. in the code that is executed once aircraft is killed you just need to add a few desieredd params and create a new vehicle and pilot [player/ai], move the pilot in the aircraft Take a look at this old mission I had made for A2 warfare. This will give you a basic idea how to start on this one. Also a good reference would be to look at A3 scripting commands list. createvehicle and moveindriver are two commands you will end up using + some conditions and setpos [setposasl/agl] to position the units via script. Or here is another small piece of code that can be useful: ////////////////////////////////////////////////////////////////// // Script for ArmA 3 dynamic dogfigt mission // Created by: John_Spartan ////////////////////////////////////////////////////////////////// //to execute/set up in mission //create a trigger activated by radio menu/or condition //in trigers onactivation put: spwan_blue_jets = [] execVM "SPAWN_BLUE_JETS.sqf"; //requires to have to gamelogic>location>base markers one named "blue_jet_spawnpos" //requires to have to gamelogic>location>base markers one named "opfor_base" //get the position of game logic before spwning BLUEFOR JET'S, based on game logic created in the mission _BLUE_JET_SPWAN_POS = getpos blue_jet_spawnpos; //_BLUE_JET_SPWAN_POS = getpos opfor_base; //decide what type of jets to spawn [in case player dont have F/A-18 mod installed] _BLUE_JET_TYPE = "JS_JC_FA18E"; if (isClass(configFile >> "CfgPatches" >> "JS_JC_FA18")) then {_BLUE_JET_TYPE = "JS_JC_FA18E";} else {_BLUE_JET_TYPE = "I_Plane_Fighter_03_AA_F";}; //create actual group of AI pilots and BLUE FOR jets _BLUEFOR_pilot_group = createGroup west; _BLUEFOR_pilot_1 = _BLUEFOR_pilot_group createUnit ["B_Pilot_F", [0,-25,5000], [], 0, "FORM"]; _BLUEFOR_pilot_2 = _BLUEFOR_pilot_group createUnit ["B_Pilot_F", [0,-25,5000], [], 0, "FORM"]; _BLUEFOR_jet_1 = createVehicle [_BLUE_JET_TYPE, [(_BLUE_JET_SPWAN_POS select 0), (_BLUE_JET_SPWAN_POS select 1), (_BLUE_JET_SPWAN_POS select 2)],[], 0, "FLY"]; _BLUEFOR_jet_2 = createVehicle [_BLUE_JET_TYPE, [(_BLUE_JET_SPWAN_POS select 0), (_BLUE_JET_SPWAN_POS select 1) - 100, (_BLUE_JET_SPWAN_POS select 2)],[], 0, "FLY"]; _BLUEFOR_pilot_1 moveinDriver _BLUEFOR_jet_1; _BLUEFOR_pilot_2 moveinDriver _BLUEFOR_jet_2; //add search and destry type waypoints to the newly spawned units _wp1 = _BLUEFOR_pilot_group addWaypoint [getpos opfor_base, 455]; [_BLUEFOR_pilot_group, 1] setWaypointType "SAD"; [_BLUEFOR_pilot_group, 1] setWaypointFormation "WEDGE"; [_BLUEFOR_pilot_group, 1] setWaypointCombatMode "RED"; [_BLUEFOR_pilot_group, 1] setWaypointBehaviour "COMBAT"; [_BLUEFOR_pilot_group, 1] SetWaypointSpeed "NORMAL"; hintsilent "Two BLUEFOR jets are incoming from South-East!!!"; Edited September 20, 2014 by John_Spartan Share this post Link to post Share on other sites
quensi130 10 Posted September 20, 2014 Sorry to be a pain im very new to the scripting and coding side of ArmA could you explain a little more, where do I put the large chunk of code your put in it and what do you mean by an eventhandler or script or a radio menu to start the script? Share this post Link to post Share on other sites
jshock 513 Posted September 20, 2014 Sorry to be a pain im very new to the scripting and coding side of ArmA could you explain a little more, where do I put the large chunk of code your put in it and what do you mean by an eventhandler or script or a radio menu to start the script? An eventhandler is basically a function that says: "When this happens, execute this code", the "this" in that statement can be a number of possibilities, two such possibilities are the "Killed" or "Respawn" eventhandlers. So when Mr.Spartan was referencing that he is saying to use an eventhandler so: "When the plane/pilot is shot down, do create a new plane at flying height with a pilot (being the player) in the new plane." So for my best example (without testing anything) would be below: The actual eventhandler (goes in the particular pilot's init field): this addEventHandler ["Respawn", {nul = [_this select 1] execVM "pilotRespawn.sqf";}]; pilotRespawn.sqf _pilot = (_this select 0); //creating the new jet _jet = createVehicle ["B_Plane_CAS_01_F", [0,2000,0], [], 0, "FLY"];//this may be incorrect in terms of flying height and position //moving the pilot into the new jet _pilot moveInDriver _jet; This should be all you would need, but I'm just kind of throwing it together so hopefully some of the other guys who also patrol this forum can help you out. Share this post Link to post Share on other sites
killzone_kid 1331 Posted September 20, 2014 Double click on the map in editor SIDE: BLUFOR FACTION: NATO CLASS: Air UNIT: A-164 SPECIAL: Flying Preview! Share this post Link to post Share on other sites
jshock 513 Posted September 20, 2014 Double click on the map in editorSIDE: BLUFOR FACTION: NATO CLASS: Air UNIT: A-164 SPECIAL: Flying Preview! He is wondering about on respawn Kid :p, or at least that's what I'm getting from it. Share this post Link to post Share on other sites
John Spartan 89 Posted September 20, 2014 Lets make a working example to illustrate this case.... wait for it.... Share this post Link to post Share on other sites
killzone_kid 1331 Posted September 20, 2014 (edited) He is wondering about on respawn Kid :p, or at least that's what I'm getting from it. Die, drop in the lobby and back and you're flying again. Edited September 20, 2014 by Killzone_Kid typo Share this post Link to post Share on other sites
quensi130 10 Posted September 20, 2014 Id like to say a quick thank you to everyone here, Id like to apologize for my skill or lack of. Share this post Link to post Share on other sites
jshock 513 Posted September 20, 2014 Id like to say a quick thank you to everyone here, Id like to apologize for my skill or lack of. It's all good we do what we do to help people better themselves, what would the point of the forums be without the "help" factor :). Share this post Link to post Share on other sites
benargee 20 Posted September 20, 2014 Die, drop in the lobby and back and you're flying again. Arma 3 has ingame multiplayer respawn built in. No need to lobby respawn like that. Sure its a start but it can be done a lot better. On respawn you should be able to script player into jet flying at a certain velocity. When i get some time i could put together a quick mission for you Quensi. You'll just have to change the jets in editor since i dont use those mods. Share this post Link to post Share on other sites
iceman77 18 Posted September 20, 2014 (edited) SIDE: BLUFOR FACTION: NATO CLASS: Air UNIT: A-164 SPECIAL: Flying Preview! . . . Die, drop in the lobby and back and you're flying again. Someone woke up in a bad mood. LOL Edited September 20, 2014 by Iceman77 Share this post Link to post Share on other sites
John Spartan 89 Posted September 20, 2014 ok, got carried away with some other stuff, here is the working example with all bit's of code explained to make the start easier. DOWNLOAD THIS SAMPLE MISSION Quensi welcome to mission editing and scripting - it's addictive :) hope this will help, have fun Spartan out Share this post Link to post Share on other sites
iceman77 18 Posted September 20, 2014 (edited) //Put anywhere in your init.sqf & change the jet's class name to the proper F18 classname [] spawn { if (isServer && {isDedicated}) exitWith {}; waitUntil {!isNull player}; private "_jet"; _xEHx = player addEventhandler ["respawn", { _jet = createVehicle ["B_Plane_CAS_01_F", getArray (configFile >> "CfgWorlds" >> worldName >> "centerPosition"), [], random 10000, "FLY"]; (_this select 0) moveInDriver _jet; }]; }; Edited September 20, 2014 by Iceman77 Share this post Link to post Share on other sites