need help for a working script

hi i have here some script that i found on the internet for moving a character it works on 2.41 but not on the newest release 2.42a

speed = 4.0
jspeed = 5.0
sqrt2over2 = 0.70710678

cont = GameLogic.getCurrentController()
obj = cont.getOwner()
act = cont.getActuator(“move”)

onGround = cont.getSensor(“onGround”)

if onGround.isPositive():
jump = cont.getSensor(“jump”)
fwd = cont.getSensor(“fwd”)
back = cont.getSensor(“back”)
slft = cont.getSensor(“slft”)
srght = cont.getSensor(“srght”)
run = cont.getSensor(“run”)

if run.isPositive():
    speed = 6.0    

fspeed = speed * (fwd.isPositive() - back.isPositive())
sspeed = speed * (srght.isPositive() - slft.isPositive())

if fspeed and sspeed:
    fspeed *= sqrt2over2
    sspeed *= sqrt2over2

jump = jspeed * (jump.isPositive())

act.setLinearVelocity(sspeed, fspeed, jump, 1)
if [sspeed,fspeed, jump] == [0.0, 0.0, 0.0]:
    GameLogic.addActiveActuator(act,0)
else:
    GameLogic.addActiveActuator(act, 1)

else:
GameLogic.addActiveActuator(act,0)

SOS! i really need to get it working with 2.42a coz i dont want to use the logic bricks… Please…:slight_smile:

does it have any errors?

and is the indentation the same in the script s it is posted here?

I see your using z3r0 d’s script.

The problem is with the ray sensor “onGround”.

The “if onGround.isPositive():” statement is never satisfied, because the ray sensor doesn’t work with the bullet engine in 2.42. That’s why you can’t move, because all the code below that statement is never executed.

It’s another glitch I’m afraid.

You can replace the ray sensor with a collision sensor however, and that should get things working.

Thank you so much!..

YOU ARE A GENIUS SIR!.. :slight_smile: