peteralto
Member
- Joined
- Nov 1, 2020
- Messages
- 95
- Solutions
- 1
- Reaction score
- 19
I'm trying to get the script to check the death of the Orshabaal creature, and if it is killed, an item would be removed from a specific tile, the Apocalypse creature would be removed from the tilePosition2 position and would be created in the newPosition position.
There are no errors in the console and nothing happens after Orshabaal dies. TFS 1.3+
There are no errors in the console and nothing happens after Orshabaal dies. TFS 1.3+
Lua:
local LastFightDeath = CreatureEvent("LastFightDeath")
function LastFightDeath.onDeath(creature, corpse, killer, mostDamageKiller, lastHitUnjustified)
if creature:getName():lower() == "Orshabaal" then
local removeitem = Position(31520, 30251, 7)
local tilePosition2 = Position(31845, 30591, 7)
local newPosition = Position(31837, 30591, 7)
local itemId1 = 19050
local monsterName = "Apocalypse"
local tile = Tile(removeitem)
if tile then
local item1 = tile:getItemById(itemId1)
if item1 then
item1:remove()
end
end
local tile2 = Tile(tilePosition2)
if tile2 then
local monster = tile2:getTopCreature()
if monster and monster:getName():lower() == monsterName:lower() then
monster:remove()
Game.createMonster(monsterName, newPosition)
end
end
end
return true
end
LastFightDeath:register()