Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Counting kills  (Read 914 times)

0 Members and 1 Guest are viewing this topic.

Hfarl

  • Guest
Counting kills
« on: 15 Jul 2006, 19:40:04 »
This is probably a rather simple question, but how do I keep track of how many of a given side the player has killed?
I want to add numerical values to different variables when the player whacks people.
Like, "if player killed 1 east, then add 1 to variable x"
Thanks in advance!

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re: Counting kills
« Reply #1 on: 15 Jul 2006, 21:26:52 »
For multiplayer this would require

a) Use of a killed eventhandler on each unit on the map
b) The killed eventhandler would need to broadcasting the killer's identitiy to all clients
c) a receiving script on the client would check if the killer was himself and then increment a count to a variable
(Use of CoC_Ns would help here, although it is doable without)

For single player, this would be easier, no need for networking


When a unit dies that has a killed event handler attached too it, the eventhandler passes 2 variables to for example a script

this addEventHandler ["killed", {_this exec "unitkilled.sqs"}]


unitkilled.sqs
_u = _this select 0     (the unit that got killed)
_killer = _this select 1    (the killer unit)

then to broadcast it

tx_Killer = _killer
Publicvariable "tx_killer"


the receiving script would look something like the following


#start
@ !isnull tx_killer
? (tx_killer == player): goto "I_AM_KILLER"
tx_Killer = objnull
goto "START"

#I_AM_KILLER
tx_myscore = tx_myscore + 1
tx_Killer = objnull
goto "START"


Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123