OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Hauk on 02 Aug 2004, 17:14:00
-
Afternoon everybody,
I haven't posted in about a month and it feels good to be doing it again, but anyway, to the problem.
Right, what i have is a chopper that lands when i radio him and when all my men are aboard he is meant to go back to the airport on Malden.
First I'll give you the code so you can see what i'm talking about:
_chopper = _this select 0
_player = 1
_marker = 2
_pilot = 3
_airlift = 4
player sideChat "HOTEL ONE, DOURDAN IS CLEAR. REQUESTING AIRLIFT, OVER."
~3
chopper sideChat "ROGER THAT ALPHA. HOTEL INBOUND. ETA 10 SECONDS"
~3
chopper setBehaviour "SAFE"
chopper move getpos airlift
@airlift distance chopper < 400
_chopper LockWP true
chopper action ["HOVER", chopper]
#for1
~0.1
chopper land "GET IN"
_player = leader player
_playerArr = units group _player
_num = count _playerArr
_incount = 0
_tmp = 0
#for2
? vehicle (_playerArr select _tmp) == _chopper : _incount = _incount + 1
? _tmp < (_num - 1) : _tmp = _tmp + 1; goto "for2"
? _incount != _num : goto "for1"
? _incount == _num : goto "Continue"
#Continue
_chopper LockWP = false
chopper flyInHeight 100
chopper action ["CANCEL_HOVER", chopper]
chopper flyInHeight 60
chopper move getPos marker
@marker distance chopper < 65
chopper action ["HOVER", chopper]
chopper land "TRANSPORT UNLOAD"
~5
chopper flyInHeight 0.3
chopper action ["Engine Off", chopper]
exit
I've tried absolutely everything and am feeling lost.
If anybody has any input at all it would be much appreciated.
cheers,
Hauk
P.S. Poland is a cool country!!!
-
hmmm, my first suggestion would be to try it with only the player unit and see if it goes, if not that would point you in one direction. If it goes after the one player unit is in then it would point you in another, not elegant but sometimes needed to debug..........
-
Hmmm... my hunch is that the chopper isn't moving because of the "GET IN" command you gave it to land.
That command will generally make it sit there until all the units assigned to it are on board. If none are assigned to it before it lands, it sits there forever! (Or at least that's what I've found).
I'll try some things when I get home from work and see if I can get you an update to your code ;)
-
Cheers Sui, I owe you one
Hauk
-
Hey Hauk... sorry, got a bit waylaid there ;)
Does the chopper have waypoints in this scenario?
If so we can completely ditch the script and do it through those (it doesn't matter about the player's waypoints, we can do it through the choppers).
Otherwise, I'd change your script to look more like this:
[size= 0.5]
_chopper = _this select 0
_player = 1
_marker = 2
_pilot = 3
_airlift = 4
player sideChat "HOTEL ONE, DOURDAN IS CLEAR. REQUESTING AIRLIFT, OVER."
~3
_chopper sideChat "ROGER THAT ALPHA. HOTEL INBOUND. ETA 10 SECONDS"
~3
_chopper setBehaviour "SAFE"
_chopper move getpos airlift
@airlift distance _chopper < 400
_chopper LockWP true
chopper action ["HOVER", chopper]
#for1
"_x assignascargo _chopper" foreach units player
(units player) ordergetin true
~0.1
_chopper land "GET IN"
_player = leader player
_playerArr = units group _player
_num = count _playerArr
_incount = 0
_tmp = 0
#for2
? vehicle (_playerArr select _tmp) == _chopper : _incount = _incount + 1
? _tmp < (_num - 1) : _tmp = _tmp + 1; goto "for2"
? _incount != _num : goto "for1"
? _incount == _num : goto "Continue"
#Continue
_chopper LockWP = false
@ "_x in _chopper" count (units player) == west countside (units player)
_chopper flyInHeight 100
chopper action ["CANCEL_HOVER", chopper]
_chopper flyInHeight 60
_chopper move getPos marker
@marker distance chopper < 65
chopper action ["HOVER", chopper]
chopper land "GET OUT"
~5
_chopper flyInHeight 0.3
_chopper action ["Engine Off", _chopper]
exit
[/size]
See if that works...
I'm not sure how you're executing the script. I changed a number of global variables (chopper) to local variables (_chopper) in there. Be sure you know which one you're using ;)
Anyway, let me know how you go...
-
Hey Sui,
I ran the script and when i radioed the chopper to come down all he does is go into a circle of the area and doesn't land. I had that problem before with the script and used the chopper land "GET IN" command, any other ways of getting it?
Also I was wondering if you forgot to delete the delay in the script.
~0.1
I'll keep messing with it and hopefully we can get the problem solved nice and quickly ;D
Cheers,
Hauk
-
Ahh ok.
Try adding an invisible Helipad into the extraction zone.
I was using that delay when I was testing the assignas... code. It may or may not be necessary ;)
Leave it in or take it out. Up to you.
-
Right I'll give that a shot, this is taking a lot longer than expected, I have to get the mission completed!!
Cheers,
Hauk
-
Hey Sui,
Just a small request. Could you re-write the code that you wrote in the altered script without the underlines cos I don't know where the underscores are and I think that might be my problem. ;D
Also I got the chopper to come down but he only touches the ground then takes off again, I think I need to put a condition in there.
Cheers,
Hauk
-
Hahaha... you know I thought about that when I saw it posted...
that'll bloody teach me for trying to be clever...
[size= 0.5]
_chopper = _this select 0
_player = 1
_marker = 2
_pilot = 3
_airlift = 4
player sideChat "HOTEL ONE, DOURDAN IS CLEAR. REQUESTING AIRLIFT, OVER."
~3
_chopper sideChat "ROGER THAT ALPHA. HOTEL INBOUND. ETA 10 SECONDS"
~3
_chopper setBehaviour "SAFE"
_chopper move getpos airlift
@airlift distance _chopper < 400
"_x assignascargo _chopper" foreach units player
(units player) ordergetin true
~0.1
_chopper land "GET IN"
@ "_x in _chopper" count (units player) == west countside (units player)
_chopper flyInHeight 100
_chopper flyInHeight 60
_chopper move getPos marker
@marker distance chopper < 65
_chopper land "GET OUT"
~5
_chopper flyInHeight 0.3
_chopper action ["Engine Off", _chopper]
exit
[/size]
There we go... got rid of the lines I took out as well...
-
Thanks Sui, I'll mess with that and see what happens ;D
Thanks again,
Hauk