--------------------------------------------------------------------------------------------------------------- Vehicle Ejection Seats --------------------------------------------------------------------------------------------------------------- This tutorial will allow players to eject from a vehicle by hitting 6 on thier keypad (dismount plus impulse for quick getaway). It also allows a pilot to eject anyone in the vehicle based upon the keys 1 through 6 on the keyboard as such: 1 = node(0) pilot(self) 2 = node(1) turreteer (on turret vehicles, passenger on others) 3 = node(2) passenger 4 = node(3) passenger 5 = node(4) passenger 6 = node(5) passenger The only downside to this method is passengers who have 6 weapons, won't be able to directly select thier 6th weapon without ejecting. They will still be able to cycle to it, though. Step #1 // ------------------------------------------ // Inventory.cs // ------------------------------------------ 1a) add this to function serverCmdSelectWeaponSlot if (%client.player) if (%client.player.getObjectMount()) callEject(%client.player, %data); 1b) Add this function below the other: function callEject(%player, %num) { %veh = %player.getObjectMount(); if (!(%veh.getType() & $TypeMasks::VehicleObjectType)) return; if (%veh.getMountNodeObject(0) == %player) { %obj = %veh.getMountNodeObject(%num); if(%obj) { if (%obj.getType() & $TypeMasks::PlayerObjectType) { %obj.getDataBlock().doDismount(%obj, 0, 1); } } } else if(%num == 5) %player.getDataBlock().doDismount(%player, 0, 1); } The 'else if(%num == 5)' part allows anyone to eject themselves by hitting 6 on thier keyboard. The if above that is the pilots eject anyone part. Step #2 // ------------------------------------------ // Player.cs // ------------------------------------------ This part will modify the Armor::doDismount function to apply a larger impulse away from the vehicle when players eject. 2a) Find the name of the function: function Armor::doDismount(%this, %obj, %forced) and change it to: function Armor::doDismount(%this, %obj, %forced, %Eject) //<-Added %Eject All I did was add an extra variable at the end that keeps track of if it's an eject, so it knows to apply a greater impulse 2b) Now, in the same function just above the line: // Position above dismount point add this: if (%Eject) %push = 30; else %push = 1; Adjust %push = 30 to control how hard they eject. 2c)Finially at the bottom of the function, change: %obj.applyImpulse(%pos, VectorScale(%impulseVec, %obj.getDataBlock().mass * 3)); to %obj.applyImpulse(%pos, VectorScale(%impulseVec, %obj.getDataBlock().mass * 3 * %push)); Step #3 Optional // ------------------------------------------ // ControlDefaults.cs // ----------------------------------------- NOTE: You only need to add this step if your mod allows pilots to use the vehicle weapon cycling in ControlDefaults.cs, such as multiweapon Shrikes. It will replace directly calling vehicle weapons by hitting numbers 1-3 with the function for ejecting self and others (does it only for pilots, won't mess with turreteers directly calling weapons). 3a) in function serverCmdSwitchVehicleWeapon, change this line: serverCmdSetVehicleWeapon(%client, %weaponNum); to this: serverCmdSetVehicleWeapon(%client, %weaponNum, 1); 3b) change this function's name: function serverCmdSetVehicleWeapon(%client, %num) to this: function serverCmdSetVehicleWeapon(%client, %num, %notEject) All I did was add another variable to the function called %notEject. 3c) In function serverCmdSetVehicleWeapon, below this line: %turret = %client.player.getControlObject(); add this %veh = %turret.getDataBlock().getName(); if(%notEject == 0) { if (%veh $= "ScoutFlyer"). { if (%client.player) { if (%client.player.getObjectMount()) { callEject(%client.player, %num - 1); return; } } } } Where it says if(%veh $= "ScountFlyer"), add the datablock names of any vehicle that use weapon cycling like so if (%veh $= "ScoutFlyer" || %veh $= "BomberFlyer" || %veh $= "ScoutVehicle")