Moderator
M
Moderator
17:39, 8th Mar 2014
PurgeandFire: Review:
https://www.hiveworkshop.com/forums/2496930-post27.html
PurgeandFire: Review:
https://www.hiveworkshop.com/forums/2496930-post27.html
KillCounterVariables

Events

Conditions

Actions


Set RCSGameTime = RCSGameTime


Set RCSGameTimeAccuracy = 0.00


Set RCSGameTimer = RCSGameTimer


Set RCSKillDeathCounterPlayer[0] = 0


Set RCSHashtable = (Last created hashtable)


Set RCSKillsUnitGroup = RCSKillsUnitGroup
RCSKillCounterSetup

Events


Map initialization

Conditions

Actions


-------- Notes: Each custom function below can use the RCSDeadUnit for the dead unit. The RCSKillerUnit for the killing unit. --------


-------- Notes: Unless marked in the comments on what you can use. --------


-------- --------


-------- If you want no kills to be counted for that player or for the individual unit go to the thing labeled Everything for Player Kills or Everything for Individual Kills --------


-------- and remove the ITE. It will then not allow anything to be counted. --------


-------- --------


-------- If you do not want a specific portion of the system to run like counting non hero player kills then remove the ITE. --------


-------- --------


-------- If you want to be able to stop a portion of the system like the non hero player kills put a boolean in the ITE. Then change that boolean to true --------


-------- when you want that portion to run and false when you do not want it to run. --------


-------- You can also use integers or reals or any other boolean comparison to stop the counting of player kills or individual kills. --------


-------- --------


-------- This boolean tells the system if you want to have the kills for the individual kills section to reset after a certain time. --------


Set RCSGameTimerBoolean = True


-------- --------


-------- This boolean tells the system if you want the individual kills for the non hero units to reset at the time limit. --------


-------- The boolean RCSGameTimerBoolean must be true or this does not matter. --------


Set RCSIndividualKillsBoolean[1] = True


-------- --------


-------- This boolean tells the system if you want the individual kills for the hero units to reset at the time limit. --------


-------- The boolean RCSGameTimerBoolean must be true or this does not matter. --------


Set RCSIndividualKillsBoolean[2] = True


-------- --------


-------- This lets you set the timeout time for when the kills counter gets reset for non hero units. --------


Set RCSGameTimeReset[1] = 2.00


-------- --------


-------- This lets you set the timeout time for when the kills counter gets reset for hero units. --------


Set RCSGameTimeReset[2] = 2.00


-------- --------


-------- This lets you set the game time accuracy. This is the counter used for the time between kills in the individual kills counter. --------


-------- For example this gives a delay of 0.03125 for the unit to kill another unit. --------


-------- Example: Game starts. Unit A kills a unit. Unit A kills a new unit. If time elapsed is more than 2 seconds it will reset and that kill will be kill one. --------


-------- If that first unit killed was right before the timer went off at 0.03124 that unit will actually have 2.00001 seconds before his counter is reset. --------


-------- But if that unit killed the other unit right after the timer went off at 0.00001 That unit will have 2.03124 seconds till his kills get reset. --------


-------- lowering the timer is possible but may start to cause lag. So be careful how much you change it by. It should be able to go very low without a problem but just in case. --------


-------- --------


Custom script: set udg_RCSGameTimeAccuracy = 0.03125


-------- --------


Custom script: endfunction


-------- --------


-------- In these multiboard functions. This is where you add actions for adding player kills to a multiboard. Use the variable RCSInteger for kills / deaths depending on the function --------


-------- Use the variable RCSPlayerInteger to get the killing player for the player kills functions. And for the player whose the dying player for the death functions. --------


-------- They are returned as GUI player numbers. Player 1 red = 1 --------


-------- --------


-------- MULTIBOARD DEATHS --------


-------- This is where you register The players Non Hero Deaths to a Multiboard. --------


-------- --------


Custom script: function RCSNonHeroDeathsCounterActions takes nothing returns nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




RCSPlayerInteger Less than 4



Then - Actions




Multiboard - Set the text for myMultiboard item in column MbIntegerColumnArray[RCSPlayerInteger], row MbIntegerRowArray[(((RCSPlayerInteger - 1) x 6) + 4)] to (String(RCSInteger))



Else - Actions


Custom script: endfunction


-------- --------


-------- --------


-------- This is where you register The players Hero Deaths to a Multiboard. --------


-------- --------


Custom script: function RCSHeroDeathsCounterActions takes nothing returns nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




RCSPlayerInteger Less than 4



Then - Actions




Multiboard - Set the text for myMultiboard item in column MbIntegerColumnArray[RCSPlayerInteger], row MbIntegerRowArray[(((RCSPlayerInteger - 1) x 6) + 5)] to (String(RCSInteger))



Else - Actions


Custom script: endfunction


-------- --------


-------- --------


-------- This is where you register The players Total Deaths to a Multiboard. --------


-------- --------


Custom script: function RCSTotalDeathsCounterActions takes nothing returns nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




RCSPlayerInteger Less than 4



Then - Actions




Multiboard - Set the text for myMultiboard item in column MbIntegerColumnArray[RCSPlayerInteger], row MbIntegerRowArray[(((RCSPlayerInteger - 1) x 6) + 6)] to (String(RCSInteger))



Else - Actions


Custom script: endfunction


-------- --------


-------- --------


-------- MULTIBOARD KILLS --------


-------- This is where you register The players Non Hero Kills to a Multiboard. --------


-------- --------


Custom script: function RCSNonHeroKillsCounterActions takes nothing returns nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




RCSPlayerInteger Less than 4



Then - Actions




Multiboard - Set the text for myMultiboard item in column MbIntegerColumnArray[RCSPlayerInteger], row MbIntegerRowArray[(((RCSPlayerInteger - 1) x 6) + 1)] to (String(RCSInteger))



Else - Actions


Custom script: endfunction


-------- --------


-------- --------


-------- This is where you register The players Hero Kills to a Multiboard. --------


-------- --------


Custom script: function RCSHeroKillsCounterActions takes nothing returns nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




RCSPlayerInteger Less than 4



Then - Actions




Multiboard - Set the text for myMultiboard item in column MbIntegerColumnArray[RCSPlayerInteger], row MbIntegerRowArray[(((RCSPlayerInteger - 1) x 6) + 2)] to (String(RCSInteger))



Else - Actions


Custom script: endfunction


-------- --------


-------- --------


-------- This is where you register The players Total Kills to a Multiboard. --------


-------- --------


Custom script: function RCSTotalKillsCounterActions takes nothing returns nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




RCSPlayerInteger Less than 4



Then - Actions




Multiboard - Set the text for myMultiboard item in column MbIntegerColumnArray[RCSPlayerInteger], row MbIntegerRowArray[(((RCSPlayerInteger - 1) x 6) + 3)] to (String(RCSInteger))



Else - Actions


Custom script: endfunction


-------- --------


-------- --------


-------- This function filters out units that you want to not count toward kills for non-hero / hero / total kills. --------


-------- If you add a unit to this it will not count for kills for any of the kill counters. --------


-------- --------


-------- EVERYTHING FOR PLAYER DEATHS --------


Custom script: function RCSEveryDeathsCounterFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Player number of (Owner of RCSDeadUnit)) Not equal to (Player number of (Owner of RCSKillerUnit))



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for units that get counted in the non-hero kills portion. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- NON-HERO PLAYER DEATHS --------


Custom script: function RCSNonHeroDeathsCounterFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for units that get counted in the hero kills portion. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- HERO PLAYER DEATHS --------


Custom script: function RCSHeroDeathsCounterFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for all units that get counted in the all kills portion. Note: this can be used to count units count / not counted above. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- TOTAL PLAYER DEATHS --------


Custom script: function RCSTotalDeathsCounterFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Unit-type of RCSDeadUnit) Not equal to Knight



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- This function filters out units that you want to not count toward kills for non-hero / hero / total kills. --------


-------- If you add a unit to this it will not count for kills for any of the kill counters. --------


-------- --------


-------- EVERYTHING FOR PLAYER KILLS --------


Custom script: function RCSEveryKillsCounterFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Player number of (Owner of RCSDeadUnit)) Not equal to (Player number of (Owner of RCSKillerUnit))



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for units that get counted in the non-hero kills portion. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- NON-HERO PLAYER KILLS --------


Custom script: function RCSNonHeroKillsCounterFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for units that get counted in the hero kills portion. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- HERO PLAYER KILLS --------


Custom script: function RCSHeroKillsCounterFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for all units that get counted in the all kills portion. Note: this can be used to count units count / not counted above. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- TOTAL PLAYER KILLS --------


Custom script: function RCSTotalKillsCounterFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Unit-type of RCSDeadUnit) Not equal to Knight



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- This function filters out units that you want to not count toward kills for non-hero / hero / total kills. Also allows you to filter out certain players. --------


-------- Example: Below in the condition i stop players from counting kills of their own units --------


-------- If you add a unit to this it will not count for kills for any of the individual kill counters. --------


-------- --------


-------- EVERYTHING FOR INDIVIDUAL KILLS --------


Custom script: function RCSEveryKillsIndividualFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Unit-type of RCSDeadUnit) Equal to Footman




(Owner of RCSDeadUnit) Not equal to (Owner of RCSKillerUnit)



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for units that get counted in the non-hero kills portion. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- NON-HERO KILLS INDIVIDUAL --------


Custom script: function RCSNonHeroKillsIndividualFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Unit-type of RCSDeadUnit) Equal to Footman



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for units that get counted in the hero kills portion. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- HERO KILLS INDIVIDUAL --------


Custom script: function RCSHeroKillsIndividualFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Unit-type of RCSDeadUnit) Equal to Peasant



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- --------


-------- The below function is the filter for all units that get counted in the all kills portion. Note: this can be used to count units count / not counted above. --------


-------- Filter out all units in the ITE that you do not want to count the kills for. In the example peasants will not be counted for kills. --------


-------- --------


-------- TOTAL KILLS INDIVIDUAL --------


Custom script: function RCSTotalKillsIndividualFilter takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Unit-type of RCSDeadUnit) Equal to Knight



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- This function below tells the system whether or not to remove all info from that unit in the hashtable. --------


-------- If all conditions in the ITE are true it will reset the dead units kills in the hashtable. --------


-------- This function should also be use to check for upgrades for that unit like every 5 kill streak that unit gains a bonus. It should be applied here with the RCSKillerUnit --------


-------- Note: If you want those streak bonuses to be more efficient every so many times you should check to see if they should be removed. --------


-------- Example: Every so many seconds use a timer and put this in it to regularly check each units kills. Custom script: call RCSForceIndividualKills() --------


-------- --------


Custom script: function RCSKillsResetKills takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Unit-type of RCSDeadUnit) Equal to Peasant



Then - Actions




Custom script: return true



Else - Actions


Custom script: return false


Custom script: endfunction


-------- --------


-------- This function should also be use to check for upgrades for that unit like every 5 kill streak that unit gains a bonus. It should be applied here with the RCSKillerUnit --------


-------- Note: If you want those streak bonuses to be more efficient every so many times you should check to see if they should be removed. --------


-------- Example: Every so many seconds use a timer and put this in it to regularly check each units kills. Custom script: call RCSForceIndividualKills() --------


-------- This will only return the units with kills of 0. So like below i check if unit has zero kills. Then i check if unit has the ability. Then if that unit does i remove the ability. --------


-------- I checked the ability to see if the unit has the ability above 0. If it does then i set it to 0. --------


-------- For this you can only use. RCSKillerUnit and RCSKillsInteger. Do Not use RCSDeadUnit --------


-------- --------


Custom script: function RCSKillStreakCheckKills takes nothing returns boolean


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




RCSInteger Equal to 0




(Level of Acid Bomb for RCSKillerUnit) Greater than 0



Then - Actions




Unit - Remove Acid Bomb from RCSKillerUnit




Custom script: return true



Else - Actions


Custom script: return false
// Kill Streak / Player Kills Counting System
// version 1.1.0 by deathismyfriend
// Function List
//
//
// This function pauses the game timer.
// This is the timer that tells when to reset the individual kills of that unit.
// function RCSPauseGameTimer takes nothing returns nothing
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: call RCSPauseGameTimer()
//
//
// This function starts the timer if you have paused it. ( It is on to start the game)
// This is the timer that tells when to reset the individual kills of that unit.
// function RCSStartGameTimer takes nothing returns nothing
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: call RCSStartGameTimer()
//
//
// This function allows users to retrieve the individual kills from that unit.
// function RCSGetIndivKillsFromUnit takes unit u returns integer
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: call RCSGetIndivKillsFromUnit( udg_tempUnit)
//
//
// This function allows users to retrieve the total individual kills from that unit.
// The total kills are the kills that unit got from the start of the game.
// function RCSGetIndivTotalKillsFromUnit takes unit u returns integer
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: call RCSGetIndivTotalKillsFromUnit( udg_tempUnit)
//
//
// This function checks each unit to see if that unit has gotten a kill
// within the desired time limit set by the user.
// This function takes each unit and checks against the limit.
// Since the normal method of my system only checks the time limit when that unit kills a new unit.
// This function corrects that inaccuracy. This should be called everytime that you want to get
// the kills for that unit for a purpose like a damage boost or something else like that.
// function RCSForceIndividualKills takes nothing returns nothing
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: call RCSForceIndividualKills()
//
//
// This function checks each unit to see if that unit has gotten a kill
// function RCSGetPlayerTotalKills takes player p returns integer
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: set udg_tempInteger = RCSGetPlayerTotalKills( udg_tempPlayer)
//
//
// function RCSGetPlayerNonHeroKills takes player p returns integer
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: set udg_tempInteger = RCSGetPlayerNonHeroKills( udg_tempPlayer)
//
//
// function RCSGetPlayerHeroKills takes player p returns integer
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: set udg_tempInteger = RCSGetPlayerHeroKills( udg_tempPlayer)
//
//
// function RCSGetPlayerTotalDeaths takes player p returns integer
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: set udg_tempInteger = RCSGetPlayerTotalDeaths( udg_tempPlayer)
//
//
// function RCSGetPlayerNonHeroDeaths takes player p returns integer
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: set udg_tempInteger = RCSGetPlayerNonHeroDeaths( udg_tempPlayer)
//
//
// function RCSGetPlayerHeroDeaths takes player p returns integer
// To use this use the custom script below. ( You can Copy and Paste it.)
// Custom script: set udg_tempInteger = RCSGetPlayerHeroDeaths( udg_tempPlayer)
//
//
function RCSGetPlayerTotalKills takes player p returns integer
return udg_RCSKillDeathCounterPlayer[ GetPlayerId( p)]
endfunction
function RCSGetPlayerNonHeroKills takes player p returns integer
return udg_RCSKillDeathCounterPlayer[ GetPlayerId( p) + 16]
endfunction
function RCSGetPlayerHeroKills takes player p returns integer
return udg_RCSKillDeathCounterPlayer[ GetPlayerId( p) + 32]
endfunction
function RCSGetPlayerTotalDeaths takes player p returns integer
return udg_RCSKillDeathCounterPlayer[ GetPlayerId( p)+ 48]
endfunction
function RCSGetPlayerNonHeroDeaths takes player p returns integer
return udg_RCSKillDeathCounterPlayer[ GetPlayerId( p) + 64]
endfunction
function RCSGetPlayerHeroDeaths takes player p returns integer
return udg_RCSKillDeathCounterPlayer[ GetPlayerId( p) + 80]
endfunction
function RCSGetIndivKillsFromUnit takes unit u returns integer
local boolean b = IsUnitType( u, UNIT_TYPE_HERO)
local real time = udg_RCSGameTime + udg_RCSGameTimeAccuracy
local integer id = GetHandleId( u)
if not b and RCSNonHeroKillsIndividualFilter() then
if udg_RCSGameTimeReset[1] > ( udg_RCSGameTime - LoadReal( udg_RCSHashtable, id, 0)) then
return LoadInteger( udg_RCSHashtable, id, 1)
else
call SaveInteger( udg_RCSHashtable, id, 1, 0)
return 0
endif
elseif b and RCSHeroKillsIndividualFilter() then
if udg_RCSGameTimeReset[2] > ( udg_RCSGameTime - LoadReal( udg_RCSHashtable, id, 0)) then
return LoadInteger( udg_RCSHashtable, id, 1)
else
call SaveInteger( udg_RCSHashtable, id, 1, 0)
return 0
endif
endif
return 0
endfunction
function RCSGetIndivTotalKillsFromUnit takes unit u returns integer
return LoadInteger( udg_RCSHashtable, GetHandleId(u), 3)
endfunction
function RCSForceGroupEnumIndKills takes nothing returns nothing
local unit u = GetEnumUnit()
local integer id = GetHandleId(u)
local boolean b = IsUnitType( u, UNIT_TYPE_HERO)
if not b and udg_RCSIndividualKillsBoolean[1] and RCSNonHeroKillsIndividualFilter() then // This filter out the non hero kills
if udg_RCSGameTimeReset[1] < ( udg_RCSGameTime - LoadReal( udg_RCSHashtable, id, 0)) then
call SaveInteger( udg_RCSHashtable, id, 1, 0)
set udg_RCSKillerUnit = u
set udg_RCSInteger = 0
call RCSKillStreakCheckKills()
set udg_RCSKillerUnit = null
endif
elseif b and udg_RCSIndividualKillsBoolean[2] and RCSHeroKillsIndividualFilter() then // This filter out the hero kills
if udg_RCSGameTimeReset[1] < ( udg_RCSGameTime - LoadReal( udg_RCSHashtable, id, 0)) then
call SaveInteger( udg_RCSHashtable, id, 2, 0)
set udg_RCSKillerUnit = u
set udg_RCSInteger = 0
call RCSKillStreakCheckKills()
set udg_RCSKillerUnit = null
endif
endif
set u = null
endfunction
function RCSForceIndividualKills takes nothing returns nothing
call ForGroup( udg_RCSKillsUnitGroup, function RCSForceGroupEnumIndKills)
endfunction
function RCSRegisterIndividualKills takes unit dead, unit killer, integer id, integer childKey returns integer
local integer i = LoadInteger( udg_RCSHashtable, id, childKey)
set i = i + 1
call SaveInteger( udg_RCSHashtable, id, childKey, i)
if RCSKillsResetKills() then
call FlushChildHashtable( udg_RCSHashtable, id)
if not IsUnitInGroup( killer, udg_RCSKillsUnitGroup) then
call GroupRemoveUnit( udg_RCSKillsUnitGroup, dead)
endif
endif
return i
endfunction
function RCSResetIndividualKills takes unit dead, unit killer, integer id, integer childKey, integer kills returns nothing
call SaveInteger( udg_RCSHashtable, id, childKey, kills)
if RCSKillsResetKills() then
call FlushChildHashtable( udg_RCSHashtable, id)
if not IsUnitInGroup( killer, udg_RCSKillsUnitGroup) then
call GroupRemoveUnit( udg_RCSKillsUnitGroup, dead)
endif
endif
endfunction
function RCSKillCounterActions takes nothing returns boolean
local unit dead = GetTriggerUnit()
local unit killer = GetKillingUnit()
local integer pId = GetPlayerId( GetOwningPlayer( killer))
local boolean b = IsUnitType( killer, UNIT_TYPE_HERO)
local integer id
local integer i
local integer pId2 = GetPlayerId( GetOwningPlayer( dead))
local real time
set udg_RCSDeadUnit = dead
set udg_RCSKillerUnit = killer
if RCSEveryKillsIndividualFilter() then // This counts individual kills.
if not IsUnitInGroup( killer, udg_RCSKillsUnitGroup) then
call GroupAddUnit( udg_RCSKillsUnitGroup, killer)
endif
set time = udg_RCSGameTime + udg_RCSGameTimeAccuracy
set id = GetHandleId( killer)
// This checks the timeout for that unit.
if udg_RCSGameTimerBoolean then
if not b and udg_RCSIndividualKillsBoolean[1] and RCSNonHeroKillsIndividualFilter() then // This filter out the non hero kills
if udg_RCSGameTimeReset[1] > ( udg_RCSGameTime - LoadReal( udg_RCSHashtable, id, 0)) then
call RCSRegisterIndividualKills( dead, killer, id, 1)
else
call RCSResetIndividualKills( dead, killer, id, 1, 1)
endif
call SaveReal( udg_RCSHashtable, id, 0, time)
elseif b and udg_RCSIndividualKillsBoolean[2] and RCSHeroKillsIndividualFilter() then // This filter out the hero kills
if udg_RCSGameTimeReset[1] > ( udg_RCSGameTime - LoadReal( udg_RCSHashtable, id, 0)) then
call RCSRegisterIndividualKills( dead, killer, id, 2)
else
call RCSResetIndividualKills( dead, killer, id, 2, 1)
endif
call SaveReal( udg_RCSHashtable, id, 0, time)
endif
if udg_RCSIndividualKillsBoolean[3] and RCSTotalKillsIndividualFilter() then // This filter out the total kills
call RCSRegisterIndividualKills( dead, killer, id, 3)
endif
else
if RCSNonHeroKillsIndividualFilter() and not b then // This filter out the non hero kills
call RCSRegisterIndividualKills( dead, killer, id, 1)
elseif RCSHeroKillsIndividualFilter() and b then // This filter out the hero kills
call RCSRegisterIndividualKills( dead, killer, id, 2)
endif
if RCSTotalKillsIndividualFilter() then // This filter out the total kills
call RCSRegisterIndividualKills( dead, killer, id, 3)
endif
endif
endif
set udg_RCSPlayerInteger = pId + 1
if RCSEveryKillsCounterFilter() then // This filter out the kills that are the same for all kills.
if RCSNonHeroKillsCounterFilter() and not b then // This filter out the non hero kills
// Increase for non-hero units.
set i = pId + 16
set udg_RCSKillDeathCounterPlayer[ i] = udg_RCSKillDeathCounterPlayer[ i] + 1
set udg_RCSInteger = udg_RCSKillDeathCounterPlayer[ i]
call RCSNonHeroKillsCounterActions()
elseif RCSHeroKillsCounterFilter() and b then // This filter out the hero kills
// Increase for hero units.
set i = pId + 32
set udg_RCSKillDeathCounterPlayer[ i] = udg_RCSKillDeathCounterPlayer[ i] + 1
set udg_RCSInteger = udg_RCSKillDeathCounterPlayer[ i]
call RCSHeroKillsCounterActions()
endif
if RCSTotalKillsCounterFilter() then // This filter out the total kills
// Increase for all units.
set udg_RCSKillDeathCounterPlayer[ pId] = udg_RCSKillDeathCounterPlayer[ pId] + 1
set udg_RCSInteger = udg_RCSKillDeathCounterPlayer[ pId]
call RCSTotalKillsCounterActions()
endif
endif
set b = IsUnitType( dead, UNIT_TYPE_HERO)
set udg_RCSPlayerInteger = pId2 + 1
if RCSEveryDeathsCounterFilter() then // This filter out the kills that are the same for all kills.
if RCSNonHeroDeathsCounterFilter() and not b then // This filter out the non hero kills
// Increase for non-hero units.
set i = pId2 + 64
set udg_RCSKillDeathCounterPlayer[ i] = udg_RCSKillDeathCounterPlayer[ i] + 1
set udg_RCSInteger = udg_RCSKillDeathCounterPlayer[ i]
call RCSNonHeroDeathsCounterActions()
elseif RCSHeroDeathsCounterFilter() and b then // This filter out the hero kills
// Increase for hero units.
set i = pId2 + 80
set udg_RCSKillDeathCounterPlayer[ i] = udg_RCSKillDeathCounterPlayer[ i] + 1
set udg_RCSInteger = udg_RCSKillDeathCounterPlayer[ i]
call RCSHeroDeathsCounterActions()
endif
if RCSTotalDeathsCounterFilter() then // This filter out the total kills
// Increase for all units.
set i = pId2 + 48
set udg_RCSKillDeathCounterPlayer[ i] = udg_RCSKillDeathCounterPlayer[ i] + 1
set udg_RCSInteger = udg_RCSKillDeathCounterPlayer[ i]
call RCSTotalDeathsCounterActions()
endif
endif
set dead = null
set killer = null
set udg_RCSDeadUnit = null
set udg_RCSKillerUnit = null
return false
endfunction
function RCSGameTimerEventEnd takes nothing returns nothing
set udg_RCSGameTime = udg_RCSGameTime + udg_RCSGameTimeAccuracy
endfunction
function RCSPauseGameTimer takes nothing returns nothing
call PauseTimer( udg_RCSGameTimer)
endfunction
function RCSStartGameTimer takes nothing returns nothing
call TimerStart( udg_RCSGameTimer, udg_RCSGameTimeAccuracy, true, function RCSGameTimerEventEnd)
endfunction
function RCSGameTimerSetup takes nothing returns nothing
local timer t = GetExpiredTimer()
call TimerStart( udg_RCSGameTimer, udg_RCSGameTimeAccuracy, true, function RCSGameTimerEventEnd)
set udg_RCSKillsUnitGroup = CreateGroup()
call DestroyTimer(t)
set t = null
endfunction
//===========================================================================
function InitTrig_RCSKillCounterCode takes nothing returns nothing
local trigger t = CreateTrigger()
if udg_RCSHashtable == null then
set udg_RCSHashtable = InitHashtable()
endif
call TimerStart( CreateTimer(), 0.01, false, function RCSGameTimerSetup)
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition( t, Condition( function RCSKillCounterActions))
set t = null
endfunction