Home   Help Search Login Register  

Author Topic: AI group leaders call out Coords of enemies  (Read 925 times)

0 Members and 1 Guest are viewing this topic.

Ironman

  • Guest
AI group leaders call out Coords of enemies
« on: 05 Aug 2006, 02:46:06 »
ok I saw part of the code done in a tutorial... I will give you the info

How to get leaders of AI groups to call out Coords for detected enemies:

contact.sqs by SelectThis  <----Author

This script makes the group leaders of AI controlled groups
(named GroupA, GroupB, GroupC, GroupD)
call out the coordinates for any enemy units they detect.

Setup in mission editor:

-the parameter to pass to this script is the unit list created by a detection trigger
-Create a trigger that covers the map and set it as follows:
           -East Detected by West
           -Repeatedly
           -Type: None
           -Name: Detected
           -Text: Detected
           -Condition: This
           -On Activation: [this] exec "contact.sqs"


Create the player character, then create the groups and name the groups by placing the following in
the leader's init field:
      - ex: for group A:
                       GroupA = Group this; GroupA SetGroupID ["Alpha","GroupColor1"]

       do the same for each group

-grab a copy of the "position.sqs" by Fishion             (numbers by Jerommeke) from OFP Editing Center
in the Snippets section, Easy-Display Map Coordinates

add the following line to "position.sqs":
_speaker = _this select 2
and replace "Hint format ["%1%2",MapLetter,MapNumber]" with
_speaker sidechat format ["Contact %1%2",MapLetter,MapNumber]


I then renamed the position.sqs to contactposition.sqs to avoid confusion

Script code
start of code---------------------------------------------------------------

***get the list of detected units from the trigger***

_triggerlist = list detected

***select the list and get the X, Y coords of the first unit detected***

_tgt1=_triggerlist select 0
_tgt1posx = getpos _tgt1 select 0
_tgt1posy = getpos _tgt1 select 1

***choose the which group detected the enemy and select the leader of that group as the sidechatter***

?(leader GroupA knowsabout _tgt1>0): _speaker= leader GroupA
?(leader GroupB knowsabout _tgt1>0): _speaker= leader GroupB
?(leader GroupC knowsabout _tgt1>0): _speaker= leader GroupC
?(leader GroupD knowsabout _tgt1>0): _speaker= leader GroupD

***pass the information to contact position.sqs (another script. must be edited to receive these parameters)***

[_tgt1posx, _tgt1posy,_speaker] exec "contactposition.sqs"

exit


end of code -------------------------------------------------------------

So, I need to know how to finish this.... or if anyone is willing to give me an easier way to complete what I am trying to do I will be appreciative.  I don't care if it requires a script or not just give me a way to callout enemy positions in global radio.