OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Wildebeest on 11 Feb 2004, 14:40:55

Title: Damage of each guy in a group?
Post by: Wildebeest on 11 Feb 2004, 14:40:55
Hi, how can I check the damage of the guys in a whole group?

One way is to give them names and check their damage that way but I don't want to do that.

I've tried stuff like:   "getdammage _x < 1" foreach units groupName
and stuff but can't get it to work :/

Plz help, yet da best :)
Title: Re:Damage of each guy in a group?
Post by: Marvin on 11 Feb 2004, 14:48:26
You can do this by:
[groupname] exec "check.sqs"

In the check.sqs type

_group = _this select 0
_cnt = 0
_units  = units _group
_count = count _units

#lop

_dammage = getdammage _units select _cnt

_cnt = _cnt + 1
?(_cnt == _count) : goto "out"
goto " lop"


#out
exit





then each time you can do with your _dammage all what you need


example :
after _dammage = getdammage _units select _cnt
type
?(_dammage > 0.8) :  _units select _cnt sidechat "I`m hit"
Title: Re:Damage of each guy in a group?
Post by: Wildebeest on 11 Feb 2004, 15:25:05
Thanks a bunch....
however I get an error at the line:

_dammage = getdammage _units select _cnt

Hmmm..
Title: Re:Damage of each guy in a group?
Post by: macguba on 11 Feb 2004, 15:30:32
Well, what's the error message?    Where in the error code is the #?
Title: Re:Damage of each guy in a group?
Post by: Marvin on 11 Feb 2004, 15:33:16
maybe try  _dammage = getdammage (_units select _cnt)
Sometimes it`s helps
Title: Re:Damage of each guy in a group?
Post by: Welshmanizer on 11 Feb 2004, 19:29:22
You will need to use:

?(_cnt == _count - 1) : goto "out"

not

?(_cnt == _count) : goto "out"


If you have 10 units they will be referred to as 0 to 9 in the array.  ;)