Home   Help Search Login Register  

Author Topic: DisableAI question.  (Read 1286 times)

0 Members and 1 Guest are viewing this topic.

Offline ONoSixIsDown

  • Members
  • *
DisableAI question.
« on: 26 Sep 2008, 09:57:10 »
I have a question about the DisableAI command in the comref.  I'm trying to keep soldiers in a group behind cover.  So far, the only way I've figured out how to do it was have every soldier in the group fighting from behind cover run a script when the group leader enters a trigger linked to him.  My current method is....
Code: [Select]
;scripted executed by activation in a trigger
;( [loon,marker] exec script.sqs
_loon = select 0
_marker = select 1

[_loon] join GrpNull
_loon doMove getMarkerPos "_marker"
once the loon reaches a very small trigger around the marker, I set them to crouching from the activation field with
Code: [Select]
unitname setUnitPos "Crouch"That works fine untill the enemy shows up then they begin to advance on a mechanized infantry platoon like lemming off a cliff.  I don't want to disableAI "Move" them because I need them to move again after all is said and done.  Any better ways to get them to retain AI and make them stay put?
CRIMSON REIGN COMMING..... eventually :/

Offline Kendo J

  • Members
  • *
  • Britain Has more varieties of cheese than France
Re: DisableAI question.
« Reply #1 on: 26 Sep 2008, 12:10:45 »
I am not sure about this but the DisableAi "Target" will make the guys hold their ground, it is that and not Move that stops them moving out to engage the enemy, they will still fire their weapons if presented with a target.

I know there is a command EnableAi "target" but What I don't know is if it is like "move" and the units are stuck for the rest of the mission?

Kendo

Walter_E_Kurtz

  • Guest
Re: DisableAI question.
« Reply #2 on: 26 Sep 2008, 14:02:45 »
Perhaps the setCombatMode command (check the FAQ).

Something that stops them from 'engaging at will':
unit_name setcombatmode "Green" - hold fire but defend self
unit_name setcombatmode "Yellow" - fire at will but not engage at will

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: DisableAI question.
« Reply #3 on: 26 Sep 2008, 16:37:08 »
In OFP, once you disableAI for either "Move" or "Target", it can not be reenabled. In the past people have gotten around this by spawning new units and deleting the old. There was a script or function that did this. Aha, I knew it!. There is also a Gen Barron script to keep units kneeling behind cover. It uses setUnitPos and disableAI. It is here. Golly Mr.Peanut! It is amazing what you can find in the Editors Depot (ED)!

Setting the combatMode should be an easier way of keeping units in place.
« Last Edit: 26 Sep 2008, 16:38:49 by Mr.Peanut »
urp!

Offline MakkaraTheMan

  • Members
  • *
  • Moikkuli from Finland :)
    • www.lifeline.fi
Re: DisableAI question.
« Reply #4 on: 08 Oct 2008, 11:02:02 »
Hello.

Maby this helps a bit:

Code: [Select]
;wait until the loon has reached the marker
@(unitready _loon)

;if you wat to temporarily stop the loon
#loop
dostop _loon
~1
;if you want to add a condition, when he is allowed to move again
?(getdammage _loon >0.5) : goto "RETREAT"
?!(Alive _loon) : goto "EXIT"
?(Alive _loon) : goto "loop"

#RETREAT
_loon domove getpos _retreatmarker
_loon setunitpos "UP"
_loon setcombatmode "GREEN" or "BLUE"
@(unitready _loon)

#EXIT
exit

Not tested, but I think this is the way, that you dont need to use -disable "MOVE"-command.

You should allso reinforce the script, w. fex:
Quote
Something that stops them from 'engaging at will':
unit_name setcombatmode "Green" - hold fire but defend self
unit_name setcombatmode "Yellow" - fire at will but not engage at will

and

Quote
DisableAi "TARGET"

and perhaps

Code: [Select]
_loon setunitpos "DOWN" or "CROUCH"
:good: