Author Topic: Jump seat script  (Read 2758 times)

0 Members and 1 Guest are viewing this topic.

Offline m!m

  • 211
This script is outdated!
Get the newest version here!


Original post:
Here's another neat script that tries to imitate jump seats for fighters. Currently it will create jump seats for every script but I'll change that...
The script uses a ship class of BP by default and it needs the mediavps for the trail effect.
Just paste this into a script table and there you go!
Code: (jumpSeat-sct.tbm) [Select]
#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 nil
end

function getShipclass(class)
local ship = tb.ShipClasses[class]
if (ship:isValid()) then
return ship
else
return nil
end
end

nulVector = ba.createVector(0, 0, 0)

jumpSeatClass = getShipclass("Spacesuit")

shipClassForwDecel = nil
shipClassSlideDecel = nil

jumpSeats = nil
jumpedShips = 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
end
end
]

$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
end
end

if (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
end
end

]

$Application: FS2_Open
$On Mission Start:
[
particleTexture = gr.loadTexture("capflash", true)
if (particleTexture ~= nil and particleTexture:isValid()) then
particleLifeTime = particleTexture:getFramesLeft() / particleTexture:getFPS()
end

jumpSeats = {}
jumpedShips = {}
]

$Application: FS2_Open
$On Mission End:
[
if (particleTexture ~= nil) then
particleTexture:unload()
particleTexture = nil
end

jumpSeats = nil
jumpedShips = nil
]

#End

I hope you enjoy it! :nod:
« Last Edit: September 30, 2011, 11:33:12 am by m!m »

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
By jump seats I assume you mean ejection seats?

This is awesome. The spacesuit model is unfortunately far too large for the job - we should get a better, smaller, pilot-sized model.

 

Offline Flipside

  • əp!sd!l£
  • 212
Normally, jump seats are seats for other members of the crew such as co-pilots, so I'm not sure.

 

Offline m!m

  • 211
I think ejection seat fits best and yes, we'd need a special model for the pilot.

 

Offline Rodo

  • Custom tittle
  • 212
  • stargazer
    • Minecraft
    • Steam
really?? I'll get to see a pilot eject??  :cool: :cool:
el hombre vicio...

 

Offline m!m

  • 211
So, did someone try it? :nervous:

 

Offline torc

  • 210
  • Diaspora SFX engineer
two question: the file goes to data folder or in the vp folder?  and what is the command for ejection?
indossare una divisa può avere un prezzo alto...ma a volte...è troppo alto!!! Bill Adama

 

Offline m!m

  • 211
The file goes into a file in data/tables/jumpSeat-sct.tbm and the ejection occurs automatically for all ships.

 

Offline torc

  • 210
  • Diaspora SFX engineer
yeah...thanks dude, it works!...  :yes:
there is no way to eject you anytime you want? you need to be destroyed before?
indossare una divisa può avere un prezzo alto...ma a volte...è troppo alto!!! Bill Adama

 

Offline Mobius

  • Back where he started
  • 213
  • The Lightblue Ribbon
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
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?

Normally, jump seats are seats for other members of the crew such as co-pilots, so I'm not sure.

More like makeshift seats for "unexpected" passengers, but the term if flexible enough to mean a lot of things.

 

Offline m!m

  • 211
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?

Currently it happens every time a ship explodes even for capships

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 420, Cutscenes: 10, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
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?

Currently it happens every time a ship explodes even for capships

 :lol: I just envisioned the guy at the helm hitting eject in the middle of the bridge...

I was going to rip a pilot straight out of our cockpit model along with his chair.. but he seems to be missing feet.. so nvm. (I thought it would be a quick and dirty task, but I was wrong.)
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 

Offline Droid803

  • Trusted poster of legit stuff
  • 213
  • /人 ◕ ‿‿ ◕ 人\ Do you want to be a Magical Girl?
    • Skype
    • Steam
Ejecting from capships?
LOL.
(´・ω・`)
=============================================================

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Could you try to make the ejected pilot launch from the coordinates of model's eye point?
BTW, There's an ejected pilot model in debris of UEF Kentauroi (he doesn't have a seat attached though). Also, pilot in the main model of Kent has feet.

 

Offline m!m

  • 211
Just wanted to ask if someone has a better model for a ejection seat as I'm currently working on an improved version of this script (it's ~95% done) and it would be great to have a model that has the right size as a reference. :nod:

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
I PMed you a pilot model, I hope it's good enough.

  

Offline Mobius

  • Back where he started
  • 213
  • The Lightblue Ribbon
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
What does this pilot model look like?

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
A modern fighter pilot on a seat, basically. I was unable to find an FS one.