I'm testing a new forum search which hopefully works better than the existing one. It currently only indexes public posts. Feedback welcome-- ngld
0 Members and 1 Guest are viewing this topic.
#Conditional Hooks$Application: FS2_Open$On Game Init:[function indexOf(t,val) for k,v in ipairs(t) do if v == val then return k end end return nilendfunction getShipclass(class) local ship = tb.ShipClasses[class] if (ship:isValid()) then return ship else return nil endendnulVector = ba.createVector(0, 0, 0)jumpSeatClass = getShipclass("Spacesuit")shipClassForwDecel = nilshipClassSlideDecel = niljumpSeats = niljumpedShips = nil]$On Ship Collision:[if (jumpSeats ~= nil) then if (indexOf(jumpSeats, hv.Ship) ~= nil) then if (hv.Ship.Parent:isValid() and hv.Ship.Parent ~= hv.Object) then if (shipClassForwDecel ~= nil and shipClassSlideDecel ~= nil) then jmp.Physics.ForwardDecelerationTime = shipClassForwDecel jmp.Physics.SlideDecelerationTime = shipClassSlideDecel else jmp.Physics.ForwardDecelerationTime = 1 jmp.Physics.SlideDecelerationTime = 1 end table.remove(jumpSeats, indexOf(jumpSeats, hv.Ship)) end endend]$State: GS_STATE_GAME_PLAY$On Frame:[for i=1, #mn.Ships do local ship = mn.Ships[i] if (ship:isValid()) then if (ship:hasShipExploded() == 2) then if (not indexOf(jumpedShips, ship.Name)) then local pos = ship.Position local orient = ship.Orientation:unrotateVector(ba.createVector(0, 1, 0)):getOrientation() local name = "Jump Seat (" .. ship.Name .. ")" if (name:len() < 32) then -- avoiding to run over that 32 Byte limit for ship names... local jmpSeat = mn.createShip(name, jumpSeatClass, ship.Orientation, pos) jmpSeat.Parent = ship jmpSeat.Team = ship.Team jmpSeat.Physics.Velocity = (ship:getuvec(true) * 80) + ship.Physics.Velocity if (shipClassForwDecel == nil or shipClassSlideDecel == nil) then shipClassForwDecel = jmpSeat.Physics.ForwardDecelerationTime shipClassSlideDecel = jmpSeat.Physics.SlideDecelerationTime end jmpSeat.Physics.ForwardDecelerationTime = 40 jmpSeat.Physics.SlideDecelerationTime = 40 jmpSeat:clearOrders() jmpSeat:giveOrder(ORDER_PLAY_DEAD) table.insert(jumpSeats, jmpSeat) table.insert(jumpedShips, ship.Name) -- Thank you for keeping names unique FS :-) end end end endendif (jumpSeats ~= nil) then local done = false local index = 1 while (not done) do for i = index, #jumpSeats do local jmp = jumpSeats[i] if (jmp ~= nil and jmp:isValid()) then ts.createParticle(jmp.Position, nulVector, particleLifeTime, jmp.Class.Model.Radius / 2, PARTICLE_BITMAP, -1, false, particleTexture) if (jmp.Physics.Velocity:getMagnitude() < 10) then if (shipClassForwDecel ~= nil and shipClassSlideDecel ~= nil) then jmp.Physics.ForwardDecelerationTime = shipClassForwDecel jmp.Physics.SlideDecelerationTime = shipClassSlideDecel else jmp.Physics.ForwardDecelerationTime = 1 jmp.Physics.SlideDecelerationTime = 1 end table.remove(jumpSeats, i) index = i break end end end done = true endend]$Application: FS2_Open$On Mission Start:[particleTexture = gr.loadTexture("capflash", true)if (particleTexture ~= nil and particleTexture:isValid()) then particleLifeTime = particleTexture:getFramesLeft() / particleTexture:getFPS()endjumpSeats = {}jumpedShips = {}]$Application: FS2_Open$On Mission End:[if (particleTexture ~= nil) then particleTexture:unload() particleTexture = nilendjumpSeats = niljumpedShips = nil]#End
Normally, jump seats are seats for other members of the crew such as co-pilots, so I'm not sure.
How it's possible to determine the chance that a given pilot will eject? Does it happen by default, or is it possible to set the probability that a pilot will eject, perhaps depending on AI levels?
Quote from: Mobius on June 01, 2011, 09:25:00 amHow it's possible to determine the chance that a given pilot will eject? Does it happen by default, or is it possible to set the probability that a pilot will eject, perhaps depending on AI levels?Currently it happens every time a ship explodes even for capships