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

Solved Problem with Boss OnKill script

simse

New Member
Joined
Jan 22, 2009
Messages
29
Reaction score
0
I have problem with my Wrath of the emperor Last boss script. It's not like real tibia. It works like this:
You say "hi", "mission", "yes" and the first boss spawn "snake essence" When u kill this boss, second boss spawn "snake thing" and then next and then next and last the tp appear, to reward room.

The problem is that this is a team quest, no one can solo this. So for each player that attacks a boss, that many bosses spawns. So if 3 players attack the first boss, 3 bosses spawn, then if 3 players attack these 3 bosses, 9 bosses spawn, etc. I want that only 1 boss spawn, no matter how many players attacking it.

Also, it would be good to have that you can't talk to the npc again for 10 minutes after the boss is spawned, or maybe the npc can dissapear for 10 minutes? that would be great, please come with suggestions!

Here is my creaturescript:
Code:
local config = {
    timeToRemove = 180, -- seconds
    teleportActionId = 3498,
    bosses = { -- Monster Name,  Summon
        ["Snake God Essence"] = {summon = "Snake Thing", pos = {x=33066, y=31153, z=15}},
        ["Snake Thing"] = {summon = "Lizard Abomination", pos = {x=33066, y=31153, z=15}},
        ["Lizard Abomination"] = {summon = "Mutated Zalamon", pos = {x=33066, y=31153, z=15}},
    },
    tpboss = {
        ["Mutated Zalamon"] = {pos = {x=33066, y=31153, z=15}, topos = {x=33075, y=31173, z=8}}
    }
}

local function removal(position)
    doRemoveItem(getTileItemById(position, 1387).uid, 1)
    doSendMagicEffect(position, CONST_ME_POFF)
    return true
end

function onKill(cid, target, lastHit)
    local bosses, tpboss = config.bosses[getCreatureName(target)], config.tpboss[getCreatureName(target)]

    if(isPlayer(target)) then
        return true
    end

    if(bosses) then
        doSummonCreature(bosses.summon, bosses.pos)
    end
    if(tpboss) then
        local teleport = doCreateItem(1387, tpboss.pos)
        local position = tpboss.pos
        doItemSetAttribute(teleport, "aid", config.teleportActionId)
        doCreatureSay(cid, "You now have 3 minutes to exit this room through the teleporter or the teleporter will dissapear. It will bring you to the reward room", TALKTYPE_ORANGE_1)
        addEvent(removal, config.timeToRemove * 1000, position)
    end
    return true
end

And here is my NPC script:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)        npcHandler:onCreatureAppear(cid)      end
function onCreatureDisappear(cid)      npcHandler:onCreatureDisappear(cid)      end
function onCreatureSay(cid, type, msg)      npcHandler:onCreatureSay(cid, type, msg)    end
function onThink()          npcHandler:onThink()          end

function creatureSayCallback(cid, type, msg)
  if(not(npcHandler:isFocused(cid))) then
    return false
  end
  local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
  if msgcontains(msg, "mission") or msgcontains(msg, "wrath") or msgcontains(msg, "emperor") or msgcontains(msg, "quest") then
      npcHandler:say({"So you have come this far, have you? ...', 'Still, the biggest challenge lies before you. ...', 'Are you ready for the hardest fight of your life?"}, cid)
      talkState[talkUser] = 1
  elseif(msgcontains(msg, "yes") and talkState[talkUser] == 1) then
      npcHandler:say("So be it!", cid)
      doSummonCreature("Snake God Essence", {x=33066, y=31153, z=15})
    end
  end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Help is really appreciated! Thanks!
 
I have the same problem it's because it is an creaturescript try to kill a normal monster on your server and you will see those bosses will spawn I tested ! xD
 
function onKill(cid, target, lastHit, flags)
if bosses and bit.band(flags, 1) == 1 then
if tpboss and bit.band(flags, 1) == 1 then
 
Back
Top