Home   Help Search Login Register  

Author Topic: Helo AI flyInHeight issues [SOLVED]  (Read 2932 times)

0 Members and 1 Guest are viewing this topic.

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Helo AI flyInHeight issues [SOLVED]
« 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:
Code: [Select]
isPlayer apacheg AND ! isPlayer apached
On activation:
Code: [Select]
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:

Code: [Select]
apache flyinheight heloHeight;

sleep 1;

heloheroes move getpos apache;
« Last Edit: 08 Jul 2010, 16:04:13 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: Helo AI flyInHeight issues
« Reply #1 on: 08 Jul 2010, 12:53:18 »
try:
Code: [Select]
(driver (vehicle player) action ["autoHover", apache] ;

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Helo AI flyInHeight issues
« Reply #2 on: 08 Jul 2010, 12:59:59 »
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.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Helo AI flyInHeight issues
« Reply #3 on: 08 Jul 2010, 13:06:42 »
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":
Code: [Select]
heloLogic setpos (apache modelToWorld [0,0,0]); apache attachTo [heloLogic,[0,0,0]]
Didn't work.

Also tried:
Code: [Select]
apache stop true;
And:
Code: [Select]
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:
Code: [Select]
isPlayer apacheg AND ! isPlayer apached AND getpos apache select 2 <= heloHeight
On Activation:
Code: [Select]
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:
« Last Edit: 08 Jul 2010, 14:00:47 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.