• 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 Script kills X monsters tfs 0.4

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
Hi guys, i use tfx 0.4, tibia 8.6 and i have a doubt in whith this script:

u need to kill a 600 (scorpion, scarab) and i make this script:

Code:
-- ["monsterName"] = storage, quant

local monsters = {
["scorpion","scarab"] = 958700, quant = 600,
}

how can i get the names scorpion and scarab?
i have tried
local monster = monsters[getCreatureName(getCreatureTarget(cid)):lower()]

but it only works if my script is something like this", with one monster:
Code:
-- ["monsterName"] = storage, quant

local monsters = {
["scorpion"] = 958700, quant = 600,
}
 
Last edited:
Solution
Lua:
local monsters = {
    [{"scorpion", "scarab"}] = {958700, quant = 600},
}

for v, k in pairs(monsters) do
    if isInArray(v, getCreatureName(getCreatureTarget(cid)):lower()) then
      
    end
end
Lua:
local monsters = {
    [{"scorpion", "scarab"}] = {958700, quant = 600},
}

for v, k in pairs(monsters) do
    if isInArray(v, getCreatureName(getCreatureTarget(cid)):lower()) then
      
    end
end
 
Solution
Lua:
local monsters = {
    [{"scorpion", "scarab"}] = {958700, quant = 600},
}

for v, k in pairs(monsters) do
    if isInArray(v, getCreatureName(getCreatureTarget(cid)):lower()) then
     
    end
end
and if i have other line with others monsters?
ex:
Code:
local monsters = {
    [{"scorpion", "scarab"}] = {958700, quant = 600},
[{"troll", "swamp troll"}] = {968700, quant = 300},
}
for v, k in pairs(monsters) do
    if isInArray(v, getCreatureName(getCreatureTarget(cid)):lower()) then
    
    end
end
 
it loops through the table until it finds a matching name.

So you can put as many monsters as you want, but you can't use the same monster twice.
 
Back
Top