• 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 On kill a original copy

nefinoo

Carnage.flv
Joined
Sep 11, 2010
Messages
549
Solutions
1
Reaction score
58
Location
Lo Mochis, Sinaloa
Explanation of the script: It makes that when some of these bosses die, a green tp (id: 25417) appears replacing the blue one (id: 1387), and takes you to the destination (godbreakerPos).

Lua:
local bosses = {
    ['jadeite'] = {teleportPos = Position(16899, 16501, 7), godbreakerPos = Position(16893, 16502, 8)},
    ['nephrite'] = {teleportPos = Position(16893, 16499, 8), godbreakerPos = Position(16895, 16501, 9)},
    ['zoisite'] = {teleportPos = Position(16895, 16503, 9), godbreakerPos = Position(16905, 16497, 10)},
    ['kunzite'] = {teleportPos = Position(16906, 16498, 10), godbreakerPos = Position(16860, 16496, 10)},
    ['queen beryl'] = {teleportPos = Position(16868, 16495, 10), godbreakerPos = Position(16817, 16496, 10)},
    ['queen metalia'] = {teleportPos = Position(16825, 16495, 10), godbreakerPos = Position(16817, 16496, 10)}
}

local function revertTeleport(position, itemId, transformId, destination)
    local item = Tile(position):getItemById(itemId)
    if item then
        item:transform(transformId)
        item:setDestination(destination)
    end
end

function onKill(creature, target) 
    local targetMonster = target:getMonster()
    if not targetMonster or targetMonster:getMaster() then
        return true
    end

    local bossConfig = bosses[targetMonster:getName():lower()]
    if not bossConfig then
        return true
    end

    local teleport = Tile(bossConfig.teleportPos):getItemById(1387)
    if not teleport then
        return true
    end

    if teleport then
        teleport:transform(25417)
        targetMonster:getPosition():sendMagicEffect(CONST_ME_THUNDER)
        teleport:setDestination(bossConfig.godbreakerPos)
        addEvent(revertTeleport, 60 * 1000, bossConfig.teleportPos, 25417, 1387, teleport:getDestination())
    end
    return true
end

I have this script, and have 2 monsters name 'Zoisite' in the lua file, but on .xml file one name 'zoisite' and another 'zoisite2', and I want to make when killing zoisite (in this case the original) the teleport appears (id: 25417) and takes you to the destination (godbreakerPos = Position (16905, 16497, 10)).
but my problem is when u kill any 'zoisite' on the map, the tp appears.
 
After confirming that it is the correct creature name, confirm if the creature is within a specified area.
 
Back
Top