TFS 0.X Script kills X monsters tfs 0.4

roriscrave

Intermediate OT User
Joined
Dec 7, 2011
Messages
402
Reaction score
39
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:

Xikini

I whore myself out for likes
Joined
Nov 17, 2010
Messages
3,925
Reaction score
2,048
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
 
OP
R

roriscrave

Intermediate OT User
Joined
Dec 7, 2011
Messages
402
Reaction score
39
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
 

Xikini

I whore myself out for likes
Joined
Nov 17, 2010
Messages
3,925
Reaction score
2,048
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.
 
Top