Space Ship Wrapper Help

Hello i am making a space ship wrapper because the game engine has a Character wrapper and a vechicle wrapper
i have made the basic setup but heres my problem:
my problem is that i cant drive more than one ship at a time.
when i put 2 ships in a scene all that hapens is the last ship i put in the scene works but the first doesnt.
how would i Modify it so that it can support mutiple ships at once?
blend file is attached
thanks for your help in advance

Attachments

SpaceShipWrapper.blend (109 KB)

The problem is that you’ve made the sensors a module-level variable. If you put them inside the function it should work.

Also, did you play Descent using the default controls? (A and Z for forwards backwards?) There are much more established control schemes for 6DOF games these days. I fly with WSAD being strafe forward, backward, up, down, space is accelerate forwards, shift is accelerate downwards. Arrow keys for pan and yaw, Q and E for roll.


import bge




def Full(cont):
    ####Setup Speed Values
    ForwardSpeed = own['Forward']
    ReverseSpeed = own['Reverse']
    WarpSpeed = own['Warp']
    RollLeftSpeed = own['Roll Left']
    RollRightSpeed = own['Roll Right']
    PitchUpSpeed = own['Pitch Up']
    PitchDownSpeed = own['Pitch Down']
    YawLeftSpeed = own['Yaw Left']
    YawRightSpeed = own['Yaw Right']
    GateMode = own['GateMode']
    ####Setup keyboard Input Sensors For Full Control
    ####And Gate Control


    Gas = cont.sensors['Gas']
    Reverse = cont.sensors['Reverse']
    Warp = cont.sensors['Warp']
    RollLeft = cont.sensors['Roll Left']
    RollRight = cont.sensors['Roll Right']
    PitchUp = cont.sensors['Pitch Up'] 
    PitchDown = cont.sensors['Pitch Down']
    YawLeft = cont.sensors['Yaw Left']
    YawRight = cont.sensors['Yaw Right']
    GasG = cont.sensors['GasGate']
    ReverseG = cont.sensors['ReverseGate']    



    if Gas.positive:
        own.applyForce((ForwardSpeed, 0, 0), 1)
    ####Check If Reverse Is True
    if Reverse.positive:
        own.applyForce((ReverseSpeed, 0, 0), 1)   
    ####Check If Warp Is True
    if Warp.positive:
        own.applyForce((WarpSpeed, 0, 0), 1)
    ####Check If RollLeft Is True
    if RollLeft.positive:
        own.applyTorque((RollLeftSpeed, 0, 0), 1)
    ####Check If RollRight Is True
    if RollRight.positive:
        own.applyTorque((RollRightSpeed, 0, 0), 1)
    ####Check If PitchUp Is True
    if PitchUp.positive:
        own.applyTorque((0, PitchUpSpeed, 0), 1)
    ####Check If PitchDown Is True
    if PitchDown.positive:
        own.applyTorque((0, PitchDownSpeed, 0), 1)
    ####Check If YawLeft Is True
    if YawLeft.positive:
        own.applyTorque((0, 0, YawLeftSpeed), 1) 
    ####Check If YawRight Is True
    if YawRight.positive:
        own.applyTorque((0, 0, YawRightSpeed), 1)
            
    if GateMode == 'TRUE':
        ####Check If Gas Is True
        if GasG.positive:
            own.applyForce((ForwardSpeed, 0, 0), 1)
        ####Check If Reverse Is True
        if ReverseG.positive:
            own.applyForce((ReverseSpeed, 0, 0), 1)

ok so it didnt work all that hapens is the same thing as before.
i first applied this script to ship A then i played the game expecting for both to work at the same time,but i didnt realize that the other ship had the old wrapper still hooked up to it(i havent had my coffee yet)so i applied the script to ship B then when i played it Ship A stoped working but Ship B started working.
but i have developed a therory:
i thought mabey if i first put all the objects in the scene that have a game property named ship into a list
and then i would check what current object the script is runing on and apply force to that ship in the list
heres my therory in practice:


import bge
from bge import logic
logic = bge.logic
cont = logic.getCurrentController()
own = cont.owner
scene = logic.getCurrentScene()
ShipList=[]
for objects in scene.objects:
    if 'Ship' in objects:
        ShipList=ShipList+[objects]
        
print(ShipList)
print(len(ShipList))




if own in ShipList:
    CurrntShip = ShipList["own"]


print(CurrntShip)   




def Full(cont):
    ####Setup Speed Values
    ForwardSpeed = own['Forward']
    ReverseSpeed = own['Reverse']
    WarpSpeed = own['Warp']
    RollLeftSpeed = own['Roll Left']
    RollRightSpeed = own['Roll Right']
    PitchUpSpeed = own['Pitch Up']
    PitchDownSpeed = own['Pitch Down']
    YawLeftSpeed = own['Yaw Left']
    YawRightSpeed = own['Yaw Right']
    GateMode = own['GateMode']
    ####Setup keyboard Input Sensors For Full Control
    ####And Gate Control




    Gas = cont.sensors['Gas']
    Reverse = cont.sensors['Reverse']
    Warp = cont.sensors['Warp']
    RollLeft = cont.sensors['Roll Left']
    RollRight = cont.sensors['Roll Right']
    PitchUp = cont.sensors['Pitch Up'] 
    PitchDown = cont.sensors['Pitch Down']
    YawLeft = cont.sensors['Yaw Left']
    YawRight = cont.sensors['Yaw Right']
    GasG = cont.sensors['GasGate']
    ReverseG = cont.sensors['ReverseGate']    






    if Gas.positive:
        ShipList["Whatever own is"].applyForce((ForwardSpeed, 0, 0), 1)
    ####Check If Reverse Is True
    if Reverse.positive:
        own.applyForce((ReverseSpeed, 0, 0), 1)   
    ####Check If Warp Is True
    if Warp.positive:
        own.applyForce((WarpSpeed, 0, 0), 1)
    ####Check If RollLeft Is True
    if RollLeft.positive:
        own.applyTorque((RollLeftSpeed, 0, 0), 1)
    ####Check If RollRight Is True
    if RollRight.positive:
        own.applyTorque((RollRightSpeed, 0, 0), 1)
    ####Check If PitchUp Is True
    if PitchUp.positive:
        own.applyTorque((0, PitchUpSpeed, 0), 1)
    ####Check If PitchDown Is True
    if PitchDown.positive:
        own.applyTorque((0, PitchDownSpeed, 0), 1)
    ####Check If YawLeft Is True
    if YawLeft.positive:
        own.applyTorque((0, 0, YawLeftSpeed), 1) 
    ####Check If YawRight Is True
    if YawRight.positive:
        own.applyTorque((0, 0, YawRightSpeed), 1)
            
    if GateMode == 'TRUE':
        ####Check If Gas Is True
        if GasG.positive:
            own.applyForce((ForwardSpeed, 0, 0), 1)
        ####Check If Reverse Is True
        if ReverseG.positive:
            own.applyForce((ReverseSpeed, 0, 0), 1)

but the problem with that is i need to asign a number to each ship in the scene and then be able to tell which i am currently using based upon that list(sounds complcaited righ?)
also in the end i am going to add a function for manging sheilds and a function for weapons
i am also attaching the blend
your script is Space.py
and yes i did play decent but i played the 2nd one and i was trying to model the controls based upon the game strike suit zero
thanks agian for all of your help

Attachments

SpaceShipWrapper.blend (91.4 KB)

oh and what would “strafe forward, backward, up, down,” be?
like i geauss add some force in all 2d directions and force on the z+ and z- axis?
i dont really understand what strafe means hehe sorry

Strafe means slide/move

so any other ideas anyone?