Created
September 30, 2015 09:06
-
-
Save dbjorkholm/9a255001e5211b934368 to your computer and use it in GitHub Desktop.
[TFS 1.X] - CreatureEvent - Deathlist?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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