TFS 0.X Script kills X monsters tfs 0.4

Discussion in 'Support' started by roriscrave, Nov 8, 2018 at 7:22 PM.

  1. roriscrave

    roriscrave Member

    Joined:
    Dec 7, 2011
    Messages:
    202
    Likes Received:
    12
    Best Answers:
    0
    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 (Text):
    1. -- ["monsterName"] = storage, quant
    2.  
    3. local monsters = {
    4. ["scorpion","scarab"] = 958700, quant = 600,
    5. }
    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 (Text):
    1. -- ["monsterName"] = storage, quant
    2.  
    3. local monsters = {
    4. ["scorpion"] = 958700, quant = 600,
    5. }
     
    Last edited: Nov 8, 2018 at 7:28 PM
  2. Best Answer:
    Post #2 by Xikini, Nov 8, 2018 at 8:55 PM
  3. Xikini

    Xikini I whore myself out for likes

    Joined:
    Nov 17, 2010
    Messages:
    3,748
    Likes Received:
    1,960
    Best Answers:
    104
    Best Answer
    Code (Lua):
    1. local monsters = {
    2.     [{"scorpion", "scarab"}] = {958700, quant = 600},
    3. }
    4.  
    5. for v, k in pairs(monsters) do
    6.     if isInArray(v, getCreatureName(getCreatureTarget(cid)):lower()) then
    7.      
    8.     end
    9. end
     
    roriscrave likes this.
  4. roriscrave

    roriscrave Member

    Joined:
    Dec 7, 2011
    Messages:
    202
    Likes Received:
    12
    Best Answers:
    0
    and if i have other line with others monsters?
    ex:
    Code (Text):
    1. local monsters = {
    2.     [{"scorpion", "scarab"}] = {958700, quant = 600},
    3. [{"troll", "swamp troll"}] = {968700, quant = 300},
    4. }
    5. for v, k in pairs(monsters) do
    6.     if isInArray(v, getCreatureName(getCreatureTarget(cid)):lower()) then
    7.    
    8.     end
    9. end
     
  5. Xikini

    Xikini I whore myself out for likes

    Joined:
    Nov 17, 2010
    Messages:
    3,748
    Likes Received:
    1,960
    Best Answers:
    104
    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.
     

Share This Page

Loading...