Home   Help Search Login Register  

Author Topic: Show "Friendly" on HUD  (Read 1372 times)

0 Members and 1 Guest are viewing this topic.

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Show "Friendly" on HUD
« on: 04 Apr 2003, 08:22:47 »
Hi!  This is a work in progress.  Wanted to know what you guys thought...

When you face towards a teammate this will display a "Friendly" on the screen (to help with reducing Friendly fire).

To set up all you do is name each soldier that is on your team, then for each soldier's init put westFriendly = westFriendly + ["W1"] where the W1 would be their name, for example.  Then make a trigger and have it run once:  Condition: local player  OnActivation: [] exec "friendly.sqs"..

friendly.sqs
Code: [Select]
;By Doolittle
_list = westFriendly
?side player == east : _list = eastFriendly
_count = count _list

#init
@alive player
_i = 0
_pdir = 90 - getDir vehicle player
_src = getPos player

~0.5
#target
_unit = call format ["%1", _list select _i]

?not alive _unit : goto "continue"
?_unit == player : goto "continue"

_dist = player distance _unit
?_dist < 25 or _dist > 2000 : goto "continue"

_fpos = getPos _unit
_dx = ((_fpos select 0) - (_src select 0))
_dz = ((_fpos select 1) - (_src select 1))
_dir = _dz atan2 _dx
_angle = _pdir - _dir
?_dir > 90 : _angle = _angle + 360
?abs _angle > 10 : goto "continue"

cutText ["Friendly", "PLAIN", 0.1]
@_pdir != 90 - getDir vehicle player
cutText ["", "PLAIN"]
goto "init"

#continue
_i = _i + 1
?_i < _count : goto "target"
goto "init"

East players would be eastFriendly = eastFriendly + ["E1"].  The very first east and west soldiers placed in the editor must be eastFriendly = ["E1"] or westFriendly = ["W1"].

Problems I see with the script so far: people might get annoyed by it.  Also I was hoping this would work when you were in a tank but it's impossible to tell which direction your tank's gun turret is facing, so I can only get information on which direction the vehicle is facing.  Anyways....what do you think of this whole idea??  I am also worried people would ONLY not fire when the "Friendly" showed up, and always fire otherwise...& this would not be a good habbit to get into as there is some tiny delay for detecting a teammate.

Doolittle

tankieboy

  • Guest
Re:Show "Friendly" on HUD
« Reply #1 on: 07 Apr 2003, 13:26:57 »
You should get this installed into real life A10's software.