HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Items - Favourite/Most used Items per player?

08-07-2008, 07:51 AM#1
Fulla
I'm currently working on one of those big endgame multiboards, that give lots of detailed & interesting information about the overall game played.

I'd like to display the item (Guns) that was most used per player.
You can only wield one Gun at a time, but can freely exchange it at anytime at a shop.

So basically with a timer I need to count how long each player holds each gun. Then at the end tally the figures & get the highest value.
The simplest method I can think of in doing this is like this:
  • A size 12 integer array per Gun (A slot per player)
  • Every second check which Gun each player is wielding & increase the corresponding Gun integer array value by +1.
    So e.g. if player 3 is carrying a Sniper, Increase Sniper Array[3] by + 1
  • At the end of the game, loop through each gun array, seeing which integer is the highest of a player's id & make that = Favourite Gun/Most used Gun.

So basically what I'm asking is, is there a simpler and/or more efficient method of accomplishing this without needing so many arrays?

thx for any advice/help
08-07-2008, 10:19 AM#2
Pyrogasm
Structs.
08-07-2008, 10:33 AM#3
Fulla
Could you give a few more details plz?
08-07-2008, 11:19 AM#4
d07.RiV
Structs are actually arrays as well but they look better, they are implemented by vJass.

If you need less arrays, you can have one array with 0..99 for player 0, 100..199 for player 1 and so on. It would actually fit better because this way you don't need a zillion IF's and can do it in a few lines if your weapons are numbered.