Jump to content
Sign in to follow this  
sfc.itzhak

some help with sqs...

Recommended Posts

hi am tried a simple script but the damm thing wont work .

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_chopper =_this select 0

#MainLoop

?(not alive _chopper): exit

; Human player gets manual control

?(player == driver _chopper): goto "MainLoop"

; Get the speed and height

_z = (GetPos _chopper) select 2

?(_z > 3): goto "closeramp"

?(_z < 2): goto "openramp"

goto "MainLoop"

#closeramp

_Chopper animate ["Ramp1",0]

~2

goto "MainLoop"

#openramp

_Chopper animate ["Ramp1",1]

~2

goto "MainLoop"

any thoghts??

thanks

itzhak

Share this post


Link to post
Share on other sites

The conditions work correctly for me, having changed the animate lines to hints and executing it using :

[testAir] exec "TEST_chopper.sqs"

where testAir = a BI mi24 hind

I suggest checking the animate lines. You may wish to use a variable to save the position of the ramp and some appropriate ifs, so that it is not constantly animated.

Add a wait into the mainloop so it's not checked every frame.

Share this post


Link to post
Share on other sites

i tried this to ..

Quote[/b] ]_chopper =_this select 0

_up = 0

#MainLoop

?(not alive _chopper): exit

~.5

; Human player gets manual control

?(player == driver _chopper): goto "MainLoop"

; Get the speed and height

_z = (GetPos _chopper) select 2

_spd = speed _chopper

?((_spd >= 6) && (_z >= 4) && (_up == 0)): goto "Raise"

?((_spd <= 5) && (_z <= 3) && (_up == 1)): goto "Lower"

goto "MainLoop"

#Raise

_up = 1

_chopper animate ["ramp1", 0]

~2

goto "MainLoop"

#Lower

_up = 0

_chopper animate ["ramp1", 1]

~2

goto "MainLoop"

no joy.

Share this post


Link to post
Share on other sites

Again, I've tested this version, changing only the animate lines :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">...

#Raise

_up = 1

hint "raise ramp now"

~2

goto "MainLoop"

#Lower

_up = 0

hint "lower ramp now"

~2

goto "MainLoop"

Hints are reported as would be expected. I'm not sure exactly what effect you want, but atm, the door will only shut when moving above a certain speed while above a certain height, ie even if AI flys 2km straight up, the door will stay open until he exceeds a certain forward speed. You may want to change it to OR?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(((_spd >= 6) or (_z >= 4)) && (_up == 0)): goto "Raise"

I would also change this condition around :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(player == driver _chopper): goto "MainLoop"

to

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(driver _chopper == player): goto "MainLoop"

Your current condition could be met in the case of their being no local player (dedicated server?), and the chopper having no pilot.

Can you make the ramp animate at all? Does just this command work as expected :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_chopper animate ["ramp1", 1]

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×