115820
Member
Hi, i need help to do a script. Who hit most the monster get storage.
i'm USE TFS 1.3
i'm USE TFS 1.3
<script>
<event name="BlackKnightDeath"/>
</script>
<event type="death" name="BlackKnightDeath" script="other/black_knight_death.lua" />
function onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
local player = mostDamageKiller:getPlayer()
if not player then
return true
end
player:setStorageValue(Storage.BlackKnightKill, 1)
return true
end
<script>
<event name="BlackKnightDeath"/>
</script>
<event type="death" name="BlackKnightDeath" script="other/black_knight_death.lua" />
function onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
local player = mostDamageKiller:getPlayer()
if not player then
return true
end
player:setStorageValue(Storage.BlackKnightKill, 1)
return true
end
Only who hit more get storage?This is what I did for monster "Black Knight" in my server
monster/black_knight.xml
Code:<script> <event name="BlackKnightDeath"/> </script>
creaturescripts/creaturescripts.xml
Code:<event type="death" name="BlackKnightDeath" script="other/black_knight_death.lua" />
creaturescripts/scripts/other/black_knight_death.lua
Code:function onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local player = mostDamageKiller:getPlayer() if not player then return true end player:setStorageValue(Storage.BlackKnightKill, 1) return true end
yes:Only who hit more get storage?
1 - to make it last for 5 minutes, you need to set the storage value as the current time.Hi @guiismiti it is posible to make the storage last only 5 minutes after killing the monster? And send a message when player receives the storage, thanks in advance
player:setStorageValue(Storage.BlackKnightKill, os.time())
local lastKill = player:getStorageValue(Storage.BlackKnightKill)
local interval = 5 * 60
if ((interval - (os.time() - lastKill)) > 0) then
-- 5 minutes have not passed yet
else
-- 5 minutes have passed
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have beaten the black knight.")
player:setStorageValue(Storage.BlackKnightKill, 1)