• 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!

help script to summon X monster instead of X object.

thefrancis

New Member
Joined
Apr 16, 2010
Messages
22
Reaction score
1
Hello, good evening. I wonder if someone could help me with this script that at first served me for tibia 12.72, the thing is to modify it and make it work but then I wanted to add something else and mess it up, the idea is to summon a monster in X place with X object. about X items. Attached script and console error.


Lua:
-------------THIS SCRIPT WAS MADED BY VANKK AT 15TH DECEMBER 2016 AT 4 P.M (GMT - 3) -------------

local config = {
    [7636] = {
        targetId = 38834, -- Target ID.
        bossName = 'Goshnar Greed', -- boss name
        keyPlayerPosition = Position(33608, 32394, 11), -- Where the player should be.
        bossPosition = Position(32355, 32272, 7), -- Boss Position
    }
}


local keys = Action()

function keys.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tmpConfig = config[item.itemid]
    if not tmpConfig then
        return true
    end
    
    if target.itemid ~= tmpConfig.targetId then
    return true
    end

    local monster = Game.createMonster(tmpConfig.bossName, tmpConfig.bossPosition)
    if not monster then
        return true
    end
    
        -- Send message
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Cuidado! un Boss ha sido convocado!')
    
        item:remove()
    return true
end

bosskeys:id(7636)
bosskeys:register()
Captura.PNG
 
@thefrancis

You named the action as "keys" like here:
Lua:
local keys = Action()

But in the end register as "bosskeys":
Lua:
bosskeys:id(7636)
bosskeys:register()

Instead of only "keys":
Lua:
keys:id(7636)
keys:register()

Simply change wheres is "keys" to "bosskeys" or "bosskeys" to "keys"
 
@thefrancis

You named the action as "keys" like here:
Lua:
local keys = Action()

But in the end register as "bosskeys":
Lua:
bosskeys:id(7636)
bosskeys:register()

Instead of only "keys":
Lua:
keys:id(7636)
keys:register()

Simply change wheres is "keys" to "bosskeys" or "bosskeys" to "keys"
Now everything makes sense to me you are incredible, thank you very much.
 
Back
Top