Home   Help Search Login Register  

Author Topic: How to disable a Unit's target ability?  (Read 1695 times)

0 Members and 1 Guest are viewing this topic.

Offline ahmed117

  • Members
  • *
  • The 3d!t0R -=I.S.I=-
How to disable a Unit's target ability?
« on: 01 Feb 2012, 09:43:35 »
Hello Men,
             I have a very weird problem in making a cutscene, the problem is I wanna make my unit to sit on a chair straight, but it watches a man or something, although I have the azimut according to the chair, but still it is not sitting straight on that chair, check out the pic. I want to disable the unit's targeting ability, so that it can sit straight, please tell me if there is any command or any solution, for this...

I would be very thankful for any possible help.

Ahmed117 (A.rogers)
The 3d!t0R            -=O.F.P.E.C=-                                                         -=I.S.I=-

Re: How to disable a Unit's target ability?
« Reply #1 on: 01 Feb 2012, 09:58:49 »
Hi pal, it is very simple thing to do but, this time, I would like to invite you to have a peek at COMREF for "disableAI" and "stop" commands ;)
? (this == thinkable) : this = scriptable

Offline Gruntage

  • Missions Depot
  • Administrator
  • *****
  • How do I get outta this chickensh*t outfit?
Re: How to disable a Unit's target ability?
« Reply #2 on: 01 Feb 2012, 10:04:30 »
Although what Doktor said is true (the COMREF and the search feature are your best friends  :D) I will tell you that the way to disable a unit's targeting ability is through the use of:

Code: [Select]
unitname disableAI "autotarget"
You could also do this:

Code: [Select]
unitname disableAI "Move"
Both of these commands should work fine  :)

Next time though Ahmed, try using the search feature or the COMREF

Hope this helps

Gruntage
"But one thing I can tell you from not just OFP but life in general:  criticism is directly proportional to quality. The more criticism a mission receives, the better the outcome" - macguba

Offline ahmed117

  • Members
  • *
  • The 3d!t0R -=I.S.I=-
Re: How to disable a Unit's target ability?
« Reply #3 on: 01 Feb 2012, 15:29:16 »
Roger That, Thank you very much by the way.
The 3d!t0R            -=O.F.P.E.C=-                                                         -=I.S.I=-

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: How to disable a Unit's target ability?
« Reply #4 on: 24 Mar 2012, 23:13:34 »
Ahmed,

Both of the above replies will work, but there is a disadvantage also. Once an AI ability is disabled it cannot be re-enabled without killing and resurrecting the unit (unit setDamage 1; unit setDamage 0). Killing and resurrecting the unit will then prevent that unit from ever being targeted by another AI unless you first set him to captive before killing him
Code: [Select]
unit setCaptive true
~ .1
;delay needed to let the game engine have time to acknowledge the unit is captive
unit setDamage 1
unit setDamage 0
unit setCaptive false
Another way to make him not look at other units is to set his behavior to careless and command him to look at the position in front of him
Code: [Select]
unit setBehaviour "careless"
unit doWatch [(getPos unit select 0) + (100 * sin (getDir unit), (getPos unit select 1) + (100 * sin (getDir unit), 0]
To undo him from watching this position and make him behave properly toward enemies you would command him to watch nothing and set his behavior to safe or aware.
Code: [Select]
unit setBehaviour "safe"
unit doWatch objNull
« Last Edit: 24 Mar 2012, 23:17:02 by Raptorsaurus »