[Custom Achievement] Functions for counting kills
Avatar

Greetings,
I'm asking here because I didn't found a solution for this:
Since Beardlib got the Custom Achievement API, I wanted to do Weapons kills but the problem is I don't know what hooks, function and source hooks I have to use to count the kills.
If anyone have a tutoriel, a guide or know how to do, i'll be very grateful.

Avatar

Reuping the topic after a while.

Got my actuel function and it's working on a single weapon. but for multiples weapons, 1 kill on a weapon will count for all.


Hooks:PostHook( StatisticsManager, "killed", "firearmskills_achievement_package", function(self) local package = CustomAchievementPackage:new("firearmskills_achievement_package")

-- Pistols + Akimbos
if self._global.killed_by_weapon["lemming"] then -- Fiveseven
package:Achievement("s_ach_lemming_bronzekill"):IncreaseAmount(1)
package:Achievement("s_ach_lemming_silverkill"):IncreaseAmount(1)
package:Achievement("s_ach_lemming_goldkill"):IncreaseAmount(1)
package:Achievement("s_ach_lemming_platinumkill"):IncreaseAmount(1)
end

-- Submachine Guns + Akimbos
if self._global.killed_by_weapon["tec9"] or self._global.killed_by_weapon["x_tec9"] then -- Blaster 9mm
package:Achievement("s_ach_tec9_bronzekill"):IncreaseAmount(1)
package:Achievement("s_ach_tec9_silverkill"):IncreaseAmount(1)
package:Achievement("s_ach_tec9_goldkill"):IncreaseAmount(1)
package:Achievement("s_ach_tec9_platinumkill"):IncreaseAmount(1)
end

-- Rifles
if self._global.killed_by_weapon["famas"] then -- Clarion Rifle
package:Achievement("s_ach_famas_bronzekill"):IncreaseAmount(1)
package:Achievement("s_ach_famas_silverkill"):IncreaseAmount(1)
package:Achievement("s_ach_famas_goldkill"):IncreaseAmount(1)
package:Achievement("s_ach_famas_platinumkill"):IncreaseAmount(1)
end
end)


I really don't want to go for the alternative one file for each gun solutions, It's really bad x') Any ideas how to fix it ? I'll really appreciate that.
34 982