[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.

Replies
Avatar

Uping the subject since I made my own research and tried something.

I found the Lua for those achievement.
"statisticsmanager.lua"

And I think, I need to use these functions:
"StatisticsManager:killed", "StatisticsManager:_add_to_killed_by_weapon" and "StatisticsManager:_get_name_id_and_throwable_id"

In this case, I don't know where to place them in the "statisticsmanager.lua" in my custom achievements' hook.
Can someone help for this ?
Thank you.

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.
Avatar

Reuping the thread, hoping to have some help, I'm being stuck a really long time now :c

32 890