Results 1 to 10 of 10

Thread: I just want an AI recon helicopter to hover in one spot...

  1. #1

    I just want an AI recon helicopter to hover in one spot...

    • Arma 2 Combined Ops v1.60 beta 88027 (latest beta I could get working)
    • ACE Mod v1.13.0.522 (+ACEX/RU/USNavy/SoundMod/CBA)
    • RKSL Mod


    I'm trying to make a mission where an AI recon helicopter acts as a spotter for a player-controlled artillery. But I'm having a very hard time getting the helo to stay in the air. It starts out at the preset altitude just fine, but then it decides to slowly land. I've given it a "hold" waypoint at its own location, as well as the following script in its init line:

    Code:
    this flyInHeight 600;                                           //tell AI to aim for an alt of 600
    this setPos [getPos this select 0, getPos this selec 1, 600];   //set helo's alt to 600
    this action ["autoHover", this];                                //for when player switches to helo for spotter's view
    (driver this) disableAI "MOVE";                                 //supposed to stop the AI from going anywhere
    These are also in order of which ones I tried first: IE originally I tried just flyInHeight, then I combined that with SetPos, then I added AutoHover, then I put disableAI on top of all that. So I know that the code issue isn't something I need to remove. The helo appears to land just as if the player had selected "autohover on" and released the throttle: IE a very gentle and slow landing, I have to speed up the game to 4x just to view it.

    And if possible, I would like this helo to be in the same group as my player-controlled arty so that the helo can relay the positions of spotted targets to the arty; I believe only grouped units can do this?

    Any suggestions or help would be greatly appreciated!

  2. #2
    Master Gunnery Sergeant twirly's Avatar
    Join Date
    Sep 13 2010
    Location
    Gods Own (NZ)
    Posts
    1,302
    Well.... if the helicopter sees enemy it's not going to just sit there... it's going to attack or evade. I'm not sure if what you want is possible.

    "Learn by doing!" - Quoted from a post by Imutep

    OUTERRA - OUTERRA - OUTERRA - OUTERRA - BLOWMIND!

  3. #3
    Master Sergeant sxp2high's Avatar
    Join Date
    Jul 16 2009
    Location
    nearestLocation [(getPos player), "nameCity"];
    Posts
    607
    Hello,

    disableAI "Move"; is the wrong command for this, it won't affect the Pilot as long as he's in a vehicle. The command only prevents men (on foot) from moving.

    You can either use:
    PHP Code:
    (driver thisdisableAI "Target";
    (
    driver thisdisableAI "Autotarget"
    This will make him ignore targets.


    Or this (which I recommend):
    PHP Code:
    (driver thissetBehaviour "Careless"// He stays relaxed, even if enemies are around
    (driver thissetCombatMode "Blue"// He won't attack anything, anymore 


    flyInHeight needs a move command in order to work. Like this:
    PHP Code:
    this doMove (getPosATL this);
    this flyInHeight 600
    It doesn't have to be doMove, a waypoint should be working as well. Just make sure to issue the move/waypoint before flyInHeight.



    The action "autoHover" is not working (obsolete) with AI controlled vehicles, they are in auto hover automatically. The action only affects human controlled vehicles.


    I hope this helps.

  4. #4
    Private First Class
    Join Date
    Jun 28 2012
    Location
    moeburn
    Posts
    20
    Author of the Thread
    Quote Originally Posted by sxp2high View Post
    Hello,

    disableAI "Move"; is the wrong command for this, it won't affect the Pilot as long as he's in a vehicle. The command only prevents men (on foot) from moving.

    You can either use:
    PHP Code:
    (driver thisdisableAI "Target";
    (
    driver thisdisableAI "Autotarget"
    This will make him ignore targets.


    Or this (which I recommend):
    PHP Code:
    (driver thissetBehaviour "Careless"// He stays relaxed, even if enemies are around
    (driver thissetCombatMode "Blue"// He won't attack anything, anymore 


    flyInHeight needs a move command in order to work. Like this:
    PHP Code:
    this doMove (getPosATL this);
    this flyInHeight 600
    It doesn't have to be doMove, a waypoint should be working as well. Just make sure to issue the move/waypoint before flyInHeight.



    The action "autoHover" is not working (obsolete) with AI controlled vehicles, they are in auto hover automatically. The action only affects human controlled vehicles.


    I hope this helps.
    All of those sound great, but won't the AI pilot stop reporting target locations if it stops targeting them altogether? I need it to still be able to report targets.

    Also, I know autohover is for a player-controlled helicopter only, I shouldnt have mentioned it. I'm using it for when the player switches to the pilot's view.

  5. #5
    Master Gunnery Sergeant twirly's Avatar
    Join Date
    Sep 13 2010
    Location
    Gods Own (NZ)
    Posts
    1,302
    Something I ran into lately... try this... http://community.bistudio.com/wiki/forceSpeed

  6. #6
    The above will still allow the gunner to see and fire on targets he just won't do it as often and the pilot won't turn to engage the enemy.

    I did this script a while back but never finished it.

    if you place this in a waypoint or trigger nul=[heli] execvm "hold.sqf" it will slow a chopper and have him hold position. He is however free to turn and engage the enemy when he sees it. If you give him heli domove getpos targetpos commands you have control of his direction, he will turn to that direction. Maybe not in battle, I haven't checked.

    To cancel the action just use halt_heli=false placed in a trigger and he will return to normal flying.
    There is more you could add such as adjust his height so he could pop up and down.

    save as "hold.sqf"
    PHP Code:
    //nul=[heli] execvm "hold.sqf";
    halt_heli true ;// heli will stop when script is run
    _plane _this select 0;

    _pitchbank _plane call BIS_fnc_getPitchBank;
    _pitch     _pitchbank select 0;
    _bank      _pitchbank select 1;

    //hint format ["Pitch %1  Bank %2",_pitch,_bank];

    _nspeed_x 0;
    _nspeed_y 0;

    while {
    alive _plane and halt_heli} do 
    {
        
    if (
    _pitch > -then {_pitch _pitch 0.1} else {_pitch _pitch 0.1};// slight nose down for better response
    if (_bank  0  then {_bank _bank 0.1} else {_bank _bank 0.1};

    _speed_Veh =  velocity _plane;
    _speed_x _speed_Veh select 0;
    _speed_y _speed_Veh select 1;
    _speed_z _speed_Veh select 2;

    if (
    _speed_x 0then {_nspeed_x _speed_x 1.01;};
    if (
    _speed_y 0then {_nspeed_y _speed_y 1.01;};
    if (
    _speed_z 0then {_nspeed_z _speed_z 1.0001;};
    //

    [_plane_Pitch,_Bankcall BIS_fnc_setPitchBank;
    _plane setVelocity [_nspeed_x,_nspeed_y,_speed_z];
    sleep 0.001;
    }; 

    I don't think forcespeed works on chopper or planes.
    Last edited by F2k Sel; Jul 5 2012 at 12:50.

  7. #7
    Private First Class
    Join Date
    Jun 28 2012
    Location
    moeburn
    Posts
    20
    Author of the Thread
    Thanks, f2k! Now is there a way to allow the helo to target and report enemies, without firing on them? I think I might just have to remove the chopper's ammunition...

  8. #8
    If your grouped to the chopper it will report positions with or without ammo, it will also hold position if you tell it to.

    If it's not in your group then I'm not sure how you'd broadcast the choppers messages.

  9. #9
    Private First Class
    Join Date
    Jun 28 2012
    Location
    moeburn
    Posts
    20
    Author of the Thread
    Ok I got it working by removing the helo's ammo and using a hold waypoint. Now I have a new problem.

    In order to get the helo to report targets, it has to be in the same group as the player. If the helo is the leader, then the player can't enter a vehicle. The moment I try, the helo says "2, dismount!" and my player is automatically kicked out of the vehicle. If the player is the leader, then the helo starts "in formation" (even though I made sure to change the player's status to 'none' and the helo's status to 'flying') right above my player's head, regardless of the helo's editor placement position.

    So can I make the helo report targets, keep the helo in the editor's placement position, AND allow my player to enter a vehicle without immediately getting kicked out?

  10. #10
    Could you use attachto to root it to something unseen on the ground, and then let it try to follow you so the rotor would be turning?
    My Chernarussian Civil War SP missions:
    Enfilade Ambush
    Autumn Siege

Similar Threads

  1. how to hover
    By twisted in forum TAKE ON HELICOPTERS - COMMUNITY PREVIEW
    Replies: 10
    Last Post: Jul 21 2011, 02:20
  2. How do I make a helicopter auto-hover when I'm the gunner?
    By p75 in forum ARMA : CONFIGS AND SCRIPTING (addons)
    Replies: 2
    Last Post: Nov 28 2009, 05:06
  3. How do I make a helicopter auto-hover when I'm the gunner?
    By p75 in forum ARMA 2 & OA : ADDONS - Configs & Scripting
    Replies: 9
    Last Post: Jul 26 2009, 07:17
  4. Need help on having a helicopter hover upwards
    By Airwolf in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 1
    Last Post: Jul 7 2003, 03:14
  5. Helicopter hover drop off
    By Karlos in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 24
    Last Post: Nov 10 2002, 20:37

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •