Home   Help Search Login Register  

Author Topic: Script for calculating accuracy of fire?  (Read 2978 times)

0 Members and 1 Guest are viewing this topic.

Offline Jakro

  • Members
  • *
Script for calculating accuracy of fire?
« on: 15 Mar 2018, 13:16:00 »
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.

Offline SoldierEPilot

  • Members
  • *
Re: Script for calculating accuracy of fire?
« Reply #1 on: 17 Mar 2018, 12:36:24 »
I'm not a MP scripter but anyway :D

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

To see statistics:
Code: [Select]
hint format ["%1 fired %2 times", name player, 1000*((rating player) %1)]
For chopper attack mission u can use
Code: [Select]
vehicle player addEventHandler ["fired", code]
Another way is to compare ammo counts of all weaps before
and after the fight
For M2 hmg:
Code: [Select]
ammoCount =  mg ammo (weapons ms select 0)
shotsHMG = 500 - ammoCount