OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Hauk on 12 May 2004, 18:32:11
-
Hey all,
Below is the script that i am using in the current mission i am working on.
This is what it is meant to do. He goes and sentrys around the 4 markers until you radio him. I have playerhasrequestedairlift=true in my radio trigger, but instead of picking me up, he just continues flying around.
Heres the script:
chopper move getmarkerpos "marker2"
@(unitready chopper)
#loop
chopper move getmarkerpos "marker3"
? (playerhasrequestedairlift) goto : "Evac"
@(unitready chopper)
chopper move getmarkerpos "marker4"
? (playerhasrequestedairlift) : goto "Evac"
@(unitready chopper)
chopper move getmarkerpos "paradrop"
? (playerhasrequestedairlift) : goto "Evac"
@(unitready chopper)
chopper move getmarkerpos "marker2"
? (playerhasrequestedairlift) goto : "Evac"
@(unitready chopper)
goto "loop"
#Evac
player sideChat "HOTEL ONE, DOURDAN IS CLEAR. REQUESTING AIRLIFT, OVER."
~3
chopper sideChat "ROGER THAT ALPHA. HOTEL INBOUND. ETA 10 SECONDS"
~3
chopper move getMarkerPos "setmove"
chopper action ["HOVER",chopper]
chopper move getpos player
chopper flyInHeight 20
~6
chopper flyInHeight 15
~6
chopper flyInHeight 10
~4
chopper flyInHeight 5
~3
chopper flyInHeight 0.2
@ (player in chopper)
chopper flyInHeight 20
chopper flyInHeight 40
chopper flyInHeight 45
chopper action ["HOVER_CANCEL",chopper]
chopper move getMarkerPos "marker"
exit
Please help if you can.
Cheers,
Hauk
-
Hi!
Firstly, this is just as good as telling the chopper to fly in height 45 straight away, because there's no delay between the commands.
chopper flyInHeight 20
chopper flyInHeight 40
chopper flyInHeight 45
Secondly, choppers and act funny in OFP m'kay. Imagine that the spot where the chopper has to go is the size of a needle's head. If the chopper misses that spot it will try to go around and hit it again. This sometimes makes the chopper spin around the "needle's head" never actually hitting it. I've noticed it with my own scripts where I've used the same technique as you're trying to use.
If that's the case here I would suggest you replace the markers with gamelogics and the @unitready chopper commands with @gamelogicname distance chopper < 50+the_height_the_chopper_is_flying_at. The wanted distance needs to be added with the height of the chopper from ground, because the gamelogics are on the ground level. If the chopper is flying at 100 meters and the distance to check is 50, the chopper can never reach that distance. Get me? :D
-
I don't really know what you mean by the condition:
would suggest you replace the markers with gamelogics and the @unitready chopper commands with @gamelogicname distance chopper < 50+the_height_the_chopper_is_flying_at. The wanted distance needs to be added with the height of the chopper from ground, because the gamelogics are on the ground level. If the chopper is flying at 100 meters and the distance to check is 50, the chopper can never reach that distance
Sorry about that, I just need to make sure I'm clear on it. :D
Cheers,
Hauk
-
With
@gamelogicname distance chopper < 200
the script will continue when the chopper is less than 200 meters away from a gamelogic which you have placed at the spot where the marker used to be. I don't know how to make my self more clear. Sorry :-\
-
The only problem with your script is that it is missing one line:
In the "Evac" section, after
chopper move getMarkerPos "setmove"
add another pause:
@ unitready chopper
I'm guessing that marker "setmove" is the LZ where the player meets the helo? If so, you can delete the line
chopper move getpos player
As it does nothing anyway since it is *after* the hover action has begun.
Assuming you have fixed any typos, adding the pause line above should fix the problem. Also make sure you have the marker names correct in both the editor and the script.
(I typed in your script (minus the typos) and made a sample mission to test it.)
Regarding using "@ unitready <heloobject>" I've not had any issues with that. I have a master helo script that I use for everything- pickups, dropoffs, paradrops, etc...and it uses that command in several places. The script has been run many many many times with no issues.
-
it's not that he won't sentry . He does that fine, but i got him to sentry using markers, and when I tried with the game logics he flew over the horizon with his own agenda (rebel without a cause ;))
If anyone would know how to make him come to my position when "playerhasrequestedairlift=true", then it would be much appreciated.
OR if anyone would be so kind as to write a small script using game logics for me i'd forever be indebted to you. :D
Please keep posting ideas I'm desperate :-\
P.S What's that little golden star below my name (Makes me feel sorta wanted :))
Cheers,
Hauk
-
The sentry part isn't where the problem is.
In the evac section, add the line I indicated above, and then it will work.
Better yet, explain what the marker "setmove" is - is that where the player meets the helicopter?
-
the marker "setmove" is a marker i put there so that when the chopper flies down to me he wont crash into buildings because of the flyInHeight command.
When he does move to that marker he is instructed to fly down to me.
Hope that has helped ???
Hauk
-
Did you add the line indicated above? What happens now when you run the script?
-
Heres the script as it is now. It worked for me perfect. I have a test mission made and you can see the script in action here.
Put it in your user/missions folder.
I think its right :)
I owe you a lot, thnx
Hauk
-
I've just come across another problem.
I tested the script on Desert Island and it worked perfectly, you can see by the test mission. But when i tried to use it in the mission I'm working on the chopper just flies around even though I've set the
"playerhasrequestedairlift=true".
Here's the script as it is nowchopper move getPos marker2
@(unitready chopper)
#loop
chopper move getPos marker3
? (playerhasrequestedairlift) : goto "Evac"
@marker3 distance chopper < 90
chopper move getPos marker4
? (playerhasrequestedairlift) : goto "Evac"
@marker4 distance chopper < 90
chopper move getPos paradrop
? (playerhasrequestedairlift) : goto "Evac"
@paradrop distance chopper < 90
chopper move getPos marker2
? (playerhasrequestedairlift) : goto "Evac"
@marker2 distance chopper < 90
goto "loop"
#Evac
player sideChat "HOTEL ONE, DOURDAN IS CLEAR. REQUESTING AIRLIFT, OVER."
~3
chopper sideChat "ROGER THAT ALPHA. HOTEL INBOUND. ETA 10 SECONDS"
~3
chopper move getPos setmove
@setmove distance chopper < 90
chopper setSpeedMode "LIMITED"
chopper move getpos player
chopper flyInHeight 20
~15
chopper flyInHeight 15
~6
chopper flyInHeight 10
~4
chopper flyInHeight 5
~6
chopper flyInHeight 0.2
@ (player in chopper)
chopper flyInHeight 20
~3
chopper flyInHeight 40
~3
chopper flyInHeight 45
chopper setSpeedMode "FULL"
chopper move getPos marker
exit
By the way, the mission is on Malden.
I'm sorry to have brought this up again but i need your help ;D
Thnx,
Hauk
-
Forgot to include in the above reply.
Do you have to set the combat mode of the chopper for him to comply with the script?
Im just trying to rattle my brains for any possibility :help:
Thnx Hauk
-
Please Help :-[ (Please read the last two replies and see what you can do) ;D
I know i keep updating this but I'm at the limits of my scripting knowledge and desperate to find out waht's wrong with it.
Thnx
Hauk