Home   Help Search Login Register  

Author Topic: Casualty reports  (Read 2388 times)

0 Members and 1 Guest are viewing this topic.

Offline Kendo J

  • Members
  • *
  • Britain Has more varieties of cheese than France
Casualty reports
« on: 17 Oct 2008, 12:16:38 »
There was a guy on the BI forums asking about how to count over all casualties in a mission and have them reported during game play,  was already working on this at the time so I thought I would post it here...

The scripts readme....
Quote
Welcome to my collection of event handlers and scripts that allow you to count all the dead units during a mission. On this map are two ways of counting the dead units, one is directly writing the code in thier INIT line, second is from spawning troops for bigger missions. I have also included a delete script so that dead units are cleaned up to reduce lag.

it is possible to do this with a large trigger that adds the counter to all units in it's list... but i couldn't be bothered to do this. E.G. a large trigger with activation: west_units = thisList and in the INIT.sqs, {_x AddEventHandler [{killed}, {west_casualties = west_casualties + 1}]} forEach west_units

I added the action menu casualty report to you (player unit) so you can quickly see how it works, this script can be called anyway you like through radio or add the action to a friendly unit in your base.

the script works like this
INIT.sqs, sets all the casualty counters to 0, and sets all spawning the casualty limits to what ever you want.

Each unit has an eventhandler that adds +1 to the over all casualty count each time a unit is killed

[] exec "CASSITREP.sqs" adds the in-mission casualty numbers to the stringtable format.
----------

the delete script is in there just to show how you can manage lag in large missions.

In a current mission I have added the killed eventhandler to the player that will call a copy of the CASSITREP.sqs script that uses a HINTC instead of hint when you die. That way just before your body hits the ground and the death screen appears you can see all the casualties of the game.


the script also includes armour, vehicle and air casualty counters i.e. you kill a bmp with 3 crew the casualty report will be
Russian Casualties: 3
Russian Armour: 1

Enjoy
Kendo