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

TFS 0.X NPC random boss to kill tfs 0.4

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
201
Hi guys, i use tfs 0.4 tibia 8.6...
I tried to script, but I did not succeed ...
I need an NPC who draws a random boss for you to have to kill, for example:

Code:
    BossesToKill = {orshabaal, morgaroth, demon boss}
when chatting with the NPC he will sort out a random boss from the list for you to kill
 
Solution
Look this script, why when i kill demon, scorpion, rat or another monster appears "Nops"?
I need to appears "Ok, selected boss.".. do u know why?

Code:
local bossesToKill = {"Demon", "Scorpion", "Rat"}
function onKill(cid, target)
    
    local name = getCreatureName(target)
         if(isInArray(name, bossesToKill)) then
            return doPlayerSendTextMessage(cid, 27, "Ok, selected boss.")
        else
            return doPlayerSendTextMessage(cid, 27, "Nops.")
        end
       
    return TRUE
end
I think you have it backwards

isInArray(bossesToKill, name)
Lua:
local bossesToKill = {"orshabaal", "morgaroth", "demon boss"}
local rand = math.random(#bossesToKill)

-- bossesToKill[rand]
-- the above line will be the monsters_name, which you can plug into whatever function you are wanting to use.
-- so basically it's like this
-- bossesToKill[1]
-- bossesToKill[2]
-- bossesToKill[3]
-- depending on what math.random chooses
 
Lua:
local bossesToKill = {"orshabaal", "morgaroth", "demon boss"}
local rand = math.random(#bossesToKill)

-- bossesToKill[rand]
-- the above line will be the monsters_name, which you can plug into whatever function you are wanting to use.
-- so basically it's like this
-- bossesToKill[1]
-- bossesToKill[2]
-- bossesToKill[3]
-- depending on what math.random chooses

Look this script, why when i kill demon, scorpion, rat or another monster appears "Nops"?
I need to appears "Ok, selected boss.".. do u know why?

Code:
local bossesToKill = {"Demon", "Scorpion", "Rat"}
function onKill(cid, target)
     
    local name = getCreatureName(target)
         if(isInArray(name, bossesToKill)) then
            return doPlayerSendTextMessage(cid, 27, "Ok, selected boss.")
        else
            return doPlayerSendTextMessage(cid, 27, "Nops.")
        end
        
    return TRUE
end
 
Look this script, why when i kill demon, scorpion, rat or another monster appears "Nops"?
I need to appears "Ok, selected boss.".. do u know why?

Code:
local bossesToKill = {"Demon", "Scorpion", "Rat"}
function onKill(cid, target)
    
    local name = getCreatureName(target)
         if(isInArray(name, bossesToKill)) then
            return doPlayerSendTextMessage(cid, 27, "Ok, selected boss.")
        else
            return doPlayerSendTextMessage(cid, 27, "Nops.")
        end
       
    return TRUE
end
I think you have it backwards

isInArray(bossesToKill, name)
 
Solution
Back
Top