• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Minion of Gaz'haragoth teleport script

strix seran

New Member
Joined
Feb 23, 2017
Messages
6
Reaction score
0
Hello,

I'm trying to implement the script so that the minion of gaz'haragoth turns into a teleport when it dies, but nothing happens. Can someone help me? Follows the script:

creaturescripts.xml:

C++:
<event type="kill" name="TpGaz" script="tpgaz.lua" />

/creaturescripts/scripts/tpgaz.lua:

Lua:
local teleportToPosition = Position(33544, 32418, 15)

local function remove teleport(position)
local teleportItem = Tile(position):getItemById(24109)
if teleportItem then
teleportItem:remove()
position:sendMagiceEffect(CONST_ME_POFF)
end
end

function onKill(creature, target)
local targetMonster = target:getMonster()
if not targetMonster or targetMonster:getName():lower() ~= 'minion of gaz haragoth' then
return true
end

local position = targetMonster:getPosition()
position:sendMagicEffect(CONST_ME_TELEPORT)
local item = Game.createItem(24109, 1, position)
if item:isTeleport() then
item:setDestination(teleportToPosition)
end

addEvent(removeTeleport, 2 * 60 * 1000, position)

return true
end

monster/dreamhaunters/minion of gaz'haragoth.xml:

C++:
<script>
    <event name="TpGaz" />
  </script>
 
Would probably better off with onDeath()
XML:
<event type="death" name="TpGaz" script="tpgaz.lua" />
tpgaz.lua
Lua:
local toPos = Position(100,100,7) -- location to teleport
local timer = 3 -- minutes till teleport poff

function onDeath(cid, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    corpse:remove()
    local teleport = Game.createItem(1387,1,cid:getPosition())
    teleport:setDestination(toPos)
    addEvent(function()
        teleport:remove()
    end,timer*60*1000)
end

Make sure you have:
XML:
<script>
        <event name="TpGaz"/>
    </script>
in your monster xml
 
Last edited:

Similar threads

Back
Top