OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect on 20 Jul 2008, 00:09:43
-
How would I go about creating a body count script.
Something that would appear at the end of a mission, preferably in a radio message, telling the player how many bad guys had been killed in the mission.
-
I would place a massive trigger, which covered all OPFOR:
Activation: OPFOR PRESENT ONCE
{ [_x] execVM "addDeathCounter.sqf" } forEach thisList; totalEnemies = count thisList
(if you add more OPFOR during the mission, then you'd have to run addDeathCounter.sqf for each of them too).
_enemy = _this select 0;
if (isNil "numKilled") then { numKilled = 0 };
_enemy addEventHandler ["KILLED", {
numKilled = numKilled + 1;
}];
I don't know how you end your mission, so I can't help you with knowing when to use this (sadly, you can't put dynamic text into the debriefing):
[playerSide, "HQ"] sideChat format ["Well done, %1! You neutralised %2 OPFOR out of %3.", name player, numKilled, totalEnemies];
-
I don't know how to use .sqf files. I'm a bit retarded like that.
Also, didn't there used to be a bit of syntax you could put into a radio message that gave a number. The % symbol maybe?
-
Well, you don't actually need to use the sqf file in this example. Just create it in notepad and copy in the text! Here it is in SQS if it makes your life bearable ;P
{ [_x] exec "addDeathCounter.sqs" } forEach thisList; totalEnemies = count thisList
_enemy = _this select 0
? isNil "numKilled" : numKilled = 0
_enemy addEventHandler ["KILLED", {numKilled = numKilled + 1;}]
Erm, I used the % syntax in the format command for the final message (last code snippet in previous post). ::)