Skip to content

Instantly share code, notes, and snippets.

@dbjorkholm
Created September 30, 2015 09:06
Show Gist options
  • Save dbjorkholm/9a255001e5211b934368 to your computer and use it in GitHub Desktop.
Save dbjorkholm/9a255001e5211b934368 to your computer and use it in GitHub Desktop.
[TFS 1.X] - CreatureEvent - Deathlist?
local storage = 3100 -- storageID to use.
local maxPoints = 1 -- maximum amount of saved points a player can have
local givePoints = 1 -- amount of points to give player
local creatureName = '[b] willow' -- creaturename (must be lowercase letters)
function onKill(creature, target)
if not target:isMonster() or target:getMaster() then
return true
end
local targetName = target:getName():lower()
if targetName ~= creatureName then
return true
end
for attackerId, damage in pairs(target:getDamageMap()) do
local tmpPlayer = Player(attackerId)
if tmpPlayer then
local tmpStorage = math.max(0, tmpPlayer:getStorageValue(storage))
if tmpStorage < maxPoints then
tmpPlayer:setStorageValue(storage, tmpStorage + givePoints)
end
tmpPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'You have defeated ' .. targetName .. '.')
end
end
return true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment