Page 1 of 1

Help needed with helicopter global script

Posted: Mon Jul 23, 2007 10:11 pm
by erick
I am trying to make a global script for a driveable helicopter in a map that players could use but i dont no how to get the script models angles. :D
In my case the mapper would add a prefab of a helicopter made from script models and then execute the global script from the level script but in order for some certain things to happen i need to know the angles of the helicopter. Does anyone know the command to get the angles on a script object?

[0]

Posted: Tue Jul 24, 2007 12:02 am
by tltrude
The three xyz numbers in angles are called using [0], [1], and [2].

if the angles were ( 45 90 -30 )

$my_chopper.angles[0] // would be 45
$my_chopper.angles[1] // would be 90
$my_chopper.angles[2] // would be -30

Posted: Tue Jul 24, 2007 3:00 am
by erick
I have decided to hold off on the global script and am trying to make the helicopter fly. How would you do it so when the player presses a key something happens. ("w" to go forward)

Posted: Wed Jul 25, 2007 10:45 am
by jv_map
Hmm afaik that can only be done with statefile modding. Unfortunately that is insanely complicated, so I won't try to explain it all in one post. You could have a look at the flyable heli in MW1 or you can find a more elegant (but even harder to understand) implementation in skylimit.

Posted: Wed Jul 25, 2007 3:52 pm
by erick
I looked at your heli script in MW1 and that thing looks greek. I am not a scripting god like you jv. A lot of those commands I have never even seen. :?
I thought of doing something with t|trude's pointer and have a panel that the player clicks buttons to move, but I never did figure out how to get it so the helicopter would go. How do you do it so the helicopter moves when the player clicks something. Could you do it like this?

Code: Select all

 bla bla bla all the stuff before //////

 huey_standby: //this is a huey helicopter that I have made
 /////give all of the trigger clickitems setthreads

go_up:  //setthread for the helicopter to go up
$switch that i will have turn on

if (level.huey = 0) ///////checks to see it the huey is turned on before the 
end                          player can drive
level.go_up = 1 ///says that the helicopter is going up
while (level.go_up = 1)
{
$huey speed 150
$huey moveup 5
}
goto huey_stanby
end


go_down: //setthread to go down
level.go_up = 0 //turn this off
if (level.huey = 0)
end

level.go_down = 1
while (level.go_down = 1)
{
$huey speed 150
$huey movedown 5
}
goto huey_standby
end
I tried something like this before on a helicopter that the player stepped on tiles but something was wrong. The while command didnt loop.

ride

Posted: Wed Jul 25, 2007 6:05 pm
by tltrude
You should probably just make it a helicopter ride for now. It can move from point A to point B to point C etc... and back to point A all by itself. The player can then have the option to jump in or out at each point. Even that wont be simple because the game does not like it when you move a player around curves.

Posted: Wed Jul 25, 2007 7:31 pm
by wacko
I agree with Tom. It will be nearly impossible to get something satisfying like Jv's heli without scripting knowledge he has.
And I think u wanted to do it for SinglePlayer, where this ought to be perfect...

Reading ur script, I'd like to advise u to check for typos (like huey_stanby instead of huey_standby or like single equals in if-clauses)

If u were still determined, u can take a look at a map I once did where there is a steerable toy robot. It can't fly but it is controlled by Tom's pointer. U can find it here

For stuff following a path of waypoints, there are some examples out there. I've done a coal lore in snowhill, which u get in the recycling bin

Oops!

Posted: Wed Jul 25, 2007 8:02 pm
by erick
Oh there are no typos in the script because I look it over and not try to rush it. I was rushing and forgot a couple things :oops: . The map is a singleplayer airport. I will download the file and try your guy's suggestions. :D

Looked at the toy robot map Wacko. It is nice I could try something like that with a helicopter