Editors Depot - Mission Editing and Scripting > OFP - Editing/Scripting Multiplayer

Script for calculating accuracy of fire?

(1/1)

Jakro:
I am basically making a mission which is very straightforward, just shooting a lot at enemies to train our beginner guys to become better at it.

I thought it would be a cool to have sort of an end statistic that shows for each player how many shots they fired and how many hit. However I dont know much about scripting so I would not know how to do it. Does such script already exist and if not, how would you go about creating it?

Actually just a counter for shots fired by each player would be enough to get an idea since the multiplayer automatically gives you the number of kills you have got.

SoldierEPilot:
I'm not a MP scripter but anyway :D


--- Code: ---code = "if (local player) then {player addRating 0.001}"
player addEventHandler ["fired", code]
--- End code ---

To see statistics:

--- Code: ---hint format ["%1 fired %2 times", name player, 1000*((rating player) %1)]
--- End code ---

For chopper attack mission u can use

--- Code: ---vehicle player addEventHandler ["fired", code]
--- End code ---

Another way is to compare ammo counts of all weaps before
and after the fight
For M2 hmg:

--- Code: ---ammoCount =  mg ammo (weapons ms select 0)
shotsHMG = 500 - ammoCount
--- End code ---

Navigation

[0] Message Index

Go to full version