Home   Help Search Login Register  

Author Topic: AI CSAR Problem  (Read 1686 times)

0 Members and 1 Guest are viewing this topic.

Offline XCess

  • Former Staff
  • ****
AI CSAR Problem
« on: 31 May 2006, 16:46:20 »
I am currently working on a script for the second part of my Invasion series.
The script causes 3 hinds to randomly patrol Everon at all times. If the helo runs low on ammo it will rearm at base, and will refuel if running low on fuel. All of this is working fine.

The last part of the script runs combat search and rescue if the helo takes heavy damage. The helo will land, paratroopers will be sent to secure the area and finally a repair truck guarded by armour will be sent to reapair the helo so it can continue it's patrols.

Every aspect of the script is working perfectly, albeit in a very beta stage.
However, after the helo has been repaired (with setDammage 0) and the pilot get's back into the helo, it simply will not take off again. It works fine when the helo lands to refuel and rearm, and it works fine when the units get intothe helo and take off at the beginning of the mission; but not after being repaired.

As this script is an integral part of the mission, I cannot post the entire code here, so I will just post the eject and embark parts of the script. If you would like to know more please contact me on msn at xcess35@hotmail.com

disembark
Code: [Select]
unAssignVehicle _pilot
unAssignVehicle _gunner

[_pilot,_gunner] orderGetIn false

_gunner action ["EJECT",_helo]
_pilot action ["EJECT",_helo]

embark
Code: [Select]
_pilot assignAsDriver _helo
_gunner assignAsGunner _helo
~0.1
[_pilot,_gunner] orderGetIn true

....

_pilot flyInHeight 70
_pilot action ["engine on",_helo]

_pilot move _mpos

SgtSlick

  • Guest
Re: AI CSAR Problem
« Reply #1 on: 04 Jun 2006, 20:23:29 »
what happens instead of it taking off? go more in detail. from what i can see this would be my solution:

1) add a marker for a fallback point
2) command the helo to move there
3) resume/restart the patrol

that's all I can tell you right now

Offline XCess

  • Former Staff
  • ****
Re: AI CSAR Problem
« Reply #2 on: 05 Jun 2006, 22:38:57 »
All the move orders are working fine, whn testing as gunner of the helo I get move orders. The only problem is that after the helo is repaired and the pilot and gunner get back in the helo will not take off again. It will not even turn the egnines on, ven if I link back to the original takeoff point in th script.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: AI CSAR Problem
« Reply #3 on: 05 Jun 2006, 23:33:25 »
For disembark you only need:
Code: [Select]
;You dont need unassing/Eject/orderGetin, leaveVehicle do all that.
group _pilot leaveVehile vehicle _pilot

For embark you only need:
Code: [Select]
_pilot assignAsDriver _helo
_gunner assignAsGunner _helo
;Following line is not really necessary
@count crew _helo == 2
;NOTE: flyInHeight is for the vehicle, not for its driver.
_helo flyInHeight 70
_pilot doMove _mpos

But, if _mpos is closer than 100m from taking off position, helicopter will take off, will climb and will stay there without moving. If _mpos is too far from taking off position, the helicopter will not even take off (process to resolve path between origin and destination will timeout).

Offline XCess

  • Former Staff
  • ****
Re: AI CSAR Problem
« Reply #4 on: 06 Jun 2006, 00:22:08 »
So the problem may be the distance oof _mpos from the vehicle.. strangely it works fine everytime when taking off from the airfield (distance of _mpos will be a maximum of 1000m).
Will the pilot turn the enines on if the goto position is too far? They are getting the move orders.. just not turning engines on and flying, and this is 100% of the time.
« Last Edit: 06 Jun 2006, 00:24:02 by XCess »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: AI CSAR Problem
« Reply #5 on: 06 Jun 2006, 00:30:19 »
First, change the code for embark and disembark as indicated and see what happens (including the flyInHeight for the helicopter, not for the pilot).

1000m should not be an issue at all, usually you will get timeouts with travels of half the map or so (it also depends on how "free" is the CPU). And yes, if the destination is too far they will not even take off (if already inflight they will not even move). But, if destination is too close you may have a similar problem, in this case the helicopter should, at least, take off, but will not move.

If the destination is resolved in time, you dont need to issue any engine on action, the pilot will start the engine and take off without any more commands.

Offline XCess

  • Former Staff
  • ****
Re: AI CSAR Problem
« Reply #6 on: 06 Jun 2006, 00:53:29 »
I'll try all thes suggestion and get back to you tommorrow. Thanks for the help Mandoble
.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: AI CSAR Problem
« Reply #7 on: 06 Jun 2006, 00:58:46 »
Test the following:
Code: [Select]
;Arguments
;helicopter
;flyingheight
;radius of the patrol

_heli = _this select 0
_radius = _this select 1
_height = _this select 2
_center = getPos _heli
_ang = 0
_pilot = driver _heli
_gunner = gunner _heli
_grp = group _pilot
_heli switchCamera "EXTERNAL"
#move
_pos = [(_center select 0)+sin(_ang)*_radius, (_center select 1)+cos(_ang)*_radius]
_pilot doMove _pos
_heli flyInHeight _height
~1
@unitReady _pilot
_heli land "LAND"
@!isEngineOn _heli
_grp leaveVehicle _heli
@(count crew _heli == 0)
;We add damage to the helicopter
_heli setDamage 0.5
~10
;We repair the helicopter
_heli setDamage 0.0
_pilot assignAsDriver _heli
_gunner assignAsGunner _heli
@count crew _heli == 2
_ang = _ang + 90.0
?_ang == 360.0:_ang == 0.0
goto "move"

Place an helicopter landed with pilot and gunner, make sure the surrounding therrain is flat enough in a radius of 200m.

Code: [Select]
[heli1, 200, 70]exec"helipatrol.sqs"
The helicopter will takeoff, move to next waypoint, land (at this point I add damage and repair seconds later), the crew will get into again and move to next waypoint over and over and over.

Offline XCess

  • Former Staff
  • ****
Re: AI CSAR Problem
« Reply #8 on: 10 Jun 2006, 06:26:27 »
I tried your suggestions mandoble.. But strangely, without the eject command in my script the units will get back into the helo, and continue to the last waypoint. Even if I give them another move order. And if i do use the eject command they just wont take off. I am still, totally confused.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: AI CSAR Problem
« Reply #9 on: 10 Jun 2006, 08:05:08 »
If you tried my script, you will notice they do not get back into the helicopter until ordered. I cannot figure out which problem may be causing your script to fail unless you post it.

Offline XCess

  • Former Staff
  • ****
Re: AI CSAR Problem
« Reply #10 on: 23 Jun 2006, 20:40:08 »
If anybody is willing to help with this problem, please PM me or contact me on MSN and I will send the mission over.
Thanks  :)