mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 14:44:55 +02:00
Full Distribution
This commit is contained in:
29
data/spells/scripts/runes/animate dead.lua
Normal file
29
data/spells/scripts/runes/animate dead.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
local humanBodies = {
|
||||
4240, 4241, 4247, 4248
|
||||
}
|
||||
|
||||
function onCastSpell(creature, variant)
|
||||
local position = Variant.getPosition(variant)
|
||||
local tile = Tile(position)
|
||||
if tile then
|
||||
local corpse = tile:getTopDownItem()
|
||||
if corpse then
|
||||
local itemType = corpse:getType()
|
||||
if not table.contains(humanBodies, itemType:getId()) then
|
||||
if itemType:isCorpse() and itemType:isMovable() then
|
||||
local monster = Game.createMonster("Skeleton", position)
|
||||
if monster then
|
||||
corpse:remove()
|
||||
monster:setMaster(creature)
|
||||
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
|
||||
creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
|
||||
return false
|
||||
end
|
Reference in New Issue
Block a user