OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: laggy on 08 Jul 2010, 12:45:04
-
Hi all,
In a mission I want the player to be able to teamSwitch between pilot and gunner in a AH-64D named "apache", the group is called "heloheroes". The idea is to control the helo as a pilot and get it in a good scouting position. Then you should switch to the gunner and use the weapons view (FLIR) to scout the terrain.
However, when flying as pilot and keeping a certain height, I want to be able to switch to the gunner and keeping the helo at the same altitude and position. But, the AI pilot keeps returning to standard height (50m ?) despite my scripting commands.
Trigger, repeatedly
Condition:
isPlayer apacheg AND ! isPlayer apached
On activation:
heloheroes selectLeader apacheg; apache flyInHeight (getpos apache select 2); hint format ["%1", getpos apache select 2]
Hint works, you become leader, but the helo doesn't "flyInHeight".
Does anyone have any ideas?
Thanks,
Laggy
EDIT:
This works:
apache flyinheight heloHeight;
sleep 1;
heloheroes move getpos apache;
-
try:
(driver (vehicle player) action ["autoHover", apache] ;
-
It may take a while for the AI to understand that they have "switched" positions inside a vehicle. I assume that this may also be the case when you switch playable unit. In this case the order to flyInHeight X is given on the exact millisecond that you are switching units. But the AI doesn't understand that it is controlling the aircraft until a split second later. Hence it ignores the command.
Suggested solution: Delay the flyInHeight command for 0.1 seconds or something like that. Perhaps with a waituntil player !(isNil) command.
-
Thanks guys!
HMMMMM... None of that worked, I'm gonna try with a gamelogic and attachTo the apache to that.
EDIT:
Tried with a game logic called "heloLogic":
heloLogic setpos (apache modelToWorld [0,0,0]); apache attachTo [heloLogic,[0,0,0]]
Didn't work.
Also tried:
apache stop true;
And:
apache flyInHeight (getpos apache select 2); apache stop true;
Nothing works so far :weeping:
EDIT 2 After reading the height and naming it "heloHeight"...
Condition:
isPlayer apacheg AND ! isPlayer apached AND getpos apache select 2 <= heloHeight
On Activation:
apache setVelocity [0,0,11]
This almost works, the helo keeps the height for a while, but it bumps up and down, making it hard to aim. I also don't know why it stops working after a while :scratch: