• 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 1.X+ TFS 1.4 Mining Action

raynerjunior

New Member
Joined
Jul 31, 2014
Messages
19
Reaction score
3
Save community!
I need some additions to this mining action.


# Return the random stone IDS. with time.
# Mining only if you have sword skill.


When it changes to ID 3608, I need that after 2 minutes it returns to a randomly selected ID, (Example. {1111, 2222, 3333, 4444} so it resets and you can start mining again!
I also need a skill level added to mine. Example! Sword Skill 15 - Minera ID 1234.





Action - Mining V1
Code:
local config = {
    [3608] = {text = {"Please no!", "Go find another rock.\nI'm not giving out today.", "Why me?", "Please.. stop.", "Haven't you beaten me enough?", "Leave me alone to grow.", "I'm only a little little rock!", "Ow! That was my left ovary!", "Ouch! My.. My right testicle! You monster!", "Please.. I just need some time..", "I'll give you your materials, just please..\nDon't hit me anymore.", "I gave you the materials already!\nWhat more do you want from me!?", "Your hammer is bigger then mine, Okay? Okay!?", "Please stop hitting my wife.\nI think she's starting to like it.", "Hit me again. I dare you.", "Enough already!", "What do I have to do..\nto make you leave?", "Your mother is a rock loving whore.", "Would you hit your mother like that?", "Puny human. Give me the hammer..\nI'll show you how to beat off properly."}},
    [3609] = {break_chance = 50, loot_chance = 20, lower_tier = 3608, -- 100 = break every try | 1 = 1/100 chance to break
        normal_loot_table = { -- 80%
            [1] = {item_id = 2148, count = 1}, -- count = MAX amount person receives of the item
            [2] = {item_id = 2148, count = 1}  -- randomises 1 to count.
        },
        semi_rare_loot_table = { -- 15%
            [1] = {item_id = 2152, count = 1},
            [2] = {item_id = 2152, count = 1}
        },
        rare_loot_table = { -- 5%
            [1] = {item_id = 2160, count = 1},
            [2] = {item_id = 2160, count = 1}
        }
    },
    [3616] = {break_chance = 55, loot_chance = 18, lower_tier = 3609,
        normal_loot_table = { -- 80%
            [1] = {item_id = 2148, count = 1}, -- count = MAX amount person receives of the item
            [2] = {item_id = 2148, count = 1}  -- randomises 1 to count.
        },
        semi_rare_loot_table = { -- 15%
            [1] = {item_id = 2152, count = 1},
            [2] = {item_id = 2152, count = 1}
        },
        rare_loot_table = { -- 5%
            [1] = {item_id = 2160, count = 1},
            [2] = {item_id = 2160, count = 1}
        }
    },
    [3607] = {break_chance = 60, loot_chance = 16, lower_tier = 3616,
        normal_loot_table = { -- 80%
            [1] = {item_id = 2148, count = 1}, -- count = MAX amount person receives of the item
            [2] = {item_id = 2148, count = 1}  -- randomises 1 to count.
        },
        semi_rare_loot_table = { -- 15%
            [1] = {item_id = 2152, count = 1},
            [2] = {item_id = 2152, count = 1}
        },
        rare_loot_table = { -- 5%
            [1] = {item_id = 2160, count = 1},
            [2] = {item_id = 2160, count = 1}
        }
    },
    [1356] = {break_chance = 65, loot_chance = 14, lower_tier = 3607,
        normal_loot_table = { -- 80%
            [1] = {item_id = 2148, count = 1}, -- count = MAX amount person receives of the item
            [2] = {item_id = 2148, count = 1}  -- randomises 1 to count.
        },
        semi_rare_loot_table = { -- 15%
            [1] = {item_id = 2152, count = 1},
            [2] = {item_id = 2152, count = 1}
        },
        rare_loot_table = { -- 5%
            [1] = {item_id = 2160, count = 1},
            [2] = {item_id = 2160, count = 1}
        }
    },
    [1285] = {break_chance = 70, loot_chance = 12, lower_tier = 1356,
        normal_loot_table = { -- 80%
            [1] = {item_id = 2148, count = 1}, -- count = MAX amount person receives of the item
            [2] = {item_id = 2148, count = 1}  -- randomises 1 to count.
        },
        semi_rare_loot_table = { -- 15%
            [1] = {item_id = 2152, count = 1},
            [2] = {item_id = 2152, count = 1}
        },
        rare_loot_table = { -- 5%
            [1] = {item_id = 2160, count = 1},
            [2] = {item_id = 2160, count = 1}
        }
    },
    [3615] = {break_chance = 75, loot_chance = 10, lower_tier = 1285,
        normal_loot_table = { -- 80%
            [1] = {item_id = 2148, count = 1}, -- count = MAX amount person receives of the item
            [2] = {item_id = 2148, count = 1}  -- randomises 1 to count.
        },
        semi_rare_loot_table = { -- 15%
            [1] = {item_id = 2152, count = 1},
            [2] = {item_id = 2152, count = 1}
        },
        rare_loot_table = { -- 5%
            [1] = {item_id = 2160, count = 1},
            [2] = {item_id = 2160, count = 1}
        }
    },
    [1357] = {break_chance = 0, loot_chance = 8, lower_tier = 3615,
        normal_loot_table = { -- 80%
            [1] = {item_id = 2148, count = 1}, -- count = MAX amount person receives of the item
            [2] = {item_id = 2148, count = 1}  -- randomises 1 to count.
        },
        semi_rare_loot_table = { -- 15%
            [1] = {item_id = 2152, count = 1},
            [2] = {item_id = 2152, count = 1}
        },
        rare_loot_table = { -- 5%
            [1] = {item_id = 2160, count = 1},
            [2] = {item_id = 2160, count = 1}
        }
    }
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
 
    local object = config[itemEx.itemid]
 
    if object then
 
        if object.text then
            local rand_text = math.random(#object.text)
            doCreatureSay(cid, object.text[rand_text], TALKTYPE_ORANGE_1, nil, nil, toPosition)
            doSendMagicEffect(toPosition, CONST_ME_POFF)
            return true
        end
 
        -- random events
        local rand_event = math.random(200)
        if rand_event == 200 then
            --print("Random Special Event executed!")
            doSendMagicEffect(toPosition, 33)
            return true
        end
   
        -- rock break
        local rand_break = math.random(100)
        if rand_break <= object.break_chance then
            doTransformItem(itemEx.uid, object.lower_tier)
            doSendMagicEffect(toPosition, CONST_ME_POFF)
        end
 
        local rand_reward = math.random(100)
        if rand_reward > (object.loot_chance + 10) then
            doSendMagicEffect(toPosition, CONST_ME_HITAREA)
            return true
        end
        doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
   
        -- give loot    
        local multiple = 1
        local rand_multiple = math.random(15)
        if rand_multiple == 15 then
            multiple = math.random(2, 3)
        end
        for i = 1, multiple do
            local loot_table = object.normal_loot_table
            local rand_loot = math.random(100)
            if rand_loot < 6 then
                loot_table = object.rare_loot_table
            elseif rand_loot < 21 then
                loot_table = object.semi_rare_loot_table
            end
            local rand_item = math.random(#loot_table)
            rand_item = loot_table[rand_item]
            if rand_item.count == 1 then
                doPlayerAddItem(cid, rand_item.item_id, 1, true)
            else
                local new_count = math.random(rand_item.count)
                doPlayerAddItem(cid, rand_item.item_id, new_count, true)
            end
        end
 
    end
 
    return true
end
 
Last edited:
Back
Top