Home   Help Search Login Register  

Author Topic: How to check casualties?  (Read 1572 times)

0 Members and 1 Guest are viewing this topic.

Serial Killer

  • Guest
How to check casualties?
« on: 28 Oct 2005, 00:33:46 »
How can I check casualties on the team by a script or trigger, and how can I show it to the player when trigger activates?

Also, how do I show player how many enemies are left in a certain area?
« Last Edit: 28 Oct 2005, 16:43:22 by Serial Killer »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How to check casualties?
« Reply #1 on: 28 Oct 2005, 08:23:39 »
At the start of the mission:

GrpSize = {alive _x} count units Grpname

Later:

Casualties = GrpSize - {alive _x} count units Grpname

Show the player:

hint format ["casualties = %1",Casualties]


Enemies in an area.

Trigger condition west (or East) depending on who is the enemy.  Give the trigger an name.

Run a script that contains:

hint format ["Enemies in the area = %1",count list triggername]

Not tested but you get the idea?

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:How to check casualties?
« Reply #2 on: 28 Oct 2005, 08:33:19 »
one of the easier questions ;)

well, two actually. i shall answer the second first. make a trigger, covering the whole map, activated by east, 'on activation' =

Code: [Select]
all_east = thislist
then place markers at the centres of the areas you wish to check. then, in a script, use something like this

Code: [Select]
in_area = {(_x distance getmarkerpos "marker_name") <=200} count all_east
that will give a total of the number of east loons within 200 metres of the marker given.

the first question, reporting on the status of a squad, is a simple matter of combining getdammage and canstand. those two commands will give the general health of the unit. if you also wish to check the unit's ammo status, use magazines.

then you just need to loop it through the number of units in the squad, wrap that up in a hint and ping it back at the player.

simple ;)
« Last Edit: 28 Oct 2005, 08:34:18 by bedges »

Serial Killer

  • Guest
Re:How to check casualties?
« Reply #3 on: 28 Oct 2005, 15:46:04 »
the first question, reporting on the status of a squad, is a simple matter of combining getdammage and canstand. those two commands will give the general health of the unit. if you also wish to check the unit's ammo status, use magazines.

then you just need to loop it through the number of units in the squad, wrap that up in a hint and ping it back at the player.

simple ;)

Not for me. :-\ Could you write an example script for me, please?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How to check casualties?
« Reply #4 on: 28 Oct 2005, 19:34:31 »
Excuse me, but is my post invisible?
« Last Edit: 28 Oct 2005, 19:34:40 by THobson »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:How to check casualties?
« Reply #5 on: 28 Oct 2005, 19:35:14 »
m'kay...

*bedges cracks his knuckles and warms his typing fingers*

call the script using [group_name] exec "status_check.sqs"

copy/paste the following and save it as "status_check.sqs"

Code: [Select]
;report on status of given group

_squad = _this select 0
_units = units _squad
_howmany = count _units
_i = 0
_perc = "%"

#loop

_dam = getdammage (_units select _i)
_dam = _dam * 100
?canstand (_units select _i) : _also = "and can stand."
?not (canstand (_units select _i) ): _also = "and cannot stand."

hint format ["Unit %1 (%2) is %3%4 wounded, %5",_i,name (_units select _i), _dam,_perc,_also]

~2

_i = _i + 1
?not (_i==_howmany):goto "loop"

exit

alright? get the idea? see if you can add magazines to that... ;)
« Last Edit: 28 Oct 2005, 19:40:26 by bedges »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:How to check casualties?
« Reply #6 on: 28 Oct 2005, 20:09:17 »
Yes TH, it seems all your posts are invisible....hmmm......what am I talking about, what posts.   :-\


Planck
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:How to check casualties?
« Reply #7 on: 28 Oct 2005, 21:04:44 »
I feel like I am talking to myself.  I wouldn't mind but I only had a few minutes in my hotel this morning between getting up and going to my meetings - I will spend my time differently in future.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:How to check casualties?
« Reply #8 on: 28 Oct 2005, 22:43:56 »
nownow... if someone chooses to sidestep your excellent advice, that's their loss. noobies around here may very well not recognise your skills, but those of us in the know hold you in appropriately high esteem, have no fear.

i think the fact that you're on the staff speaks for itself, mmm?  8)

*bedges cracks himself on the back of the head*

now keep it on topic!

Serial Killer

  • Guest
Re:How to check casualties?
« Reply #9 on: 29 Oct 2005, 00:21:54 »
Thanks bedges. Now I got the idea, and I also learned a few new things. :P

@THobson
Sorry. I DID use your advice first, but bedges' advice seemed to be more... advanced...