• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!
[TFS 1.4.2] Lucky Loot Box

[TFS 1.4.2] Lucky Loot Box 1.0

No permission to download

Description:


A small, clean and fully oldschool-friendly system that adds a fun “Lucky Loot Box” drop to monsters.
Players can find a box with a small chance, and when they open it, they receive a random reward (gold, potions, gems, etc.) and a very small chance to obtain a rare item.

This system is perfect for 7.4/7.x servers because it:
  • does NOT break balance
  • is easy to understand for players
  • adds excitement during hunting
  • feels oldschool and lightweight
  • takes 3–5 minutes to install
Completely free & open-source.

Features​

  • Simple random loot box usable item
  • Normal rewards + ultra-rare rewards
  • Globally configurable drop chance
  • Oldschool-friendly (no overpowered stuff)
  • Fully customizable rewards/tables
  • Works on all TFS 1.4 / 1.5 downgraded


1. Add the item

data/items/items.xml

<item id="9000" name="Lucky Box">
<attribute key="description" value="Shake it and see what happens!" />
</item>

2. Add the action

data/actions/actions.xml

<action itemid="9000" script="lucky_box.lua"/>

3. Create the script


data/actions/scripts/lucky_box.lua




local rewards = {
{id = 2148, count = {10, 40}}, -- gold coins
{id = 2152, count = {1, 3}}, -- platinum coins
{id = 7618, count = {1, 2}}, -- mana potion
{id = 7620, count = {1, 2}}, -- health potion
{id = 2145, count = {1, 2}}, -- small diamond
{id = 2146, count = {1, 2}}, -- small sapphire
{id = 2149, count = {1, 2}}, -- small emerald
{id = 2150, count = {1, 2}}, -- small ruby
}

-- 0.5% rare reward
local rareRewards = {
{id = 2160, count = 1}, -- crystal coin
{id = 2392, count = 1}, -- fire sword
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
item:remove()

-- Rare roll (0.5%)
if math.random(1000) <= 5 then
local reward = rareRewards[math.random(#rareRewards)]
player:addItem(reward.id, reward.count)
player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
player:sendTextMessage(MESSAGE_INFO_DESCR, "Lucky! You found a rare item!")
return true
end

-- Normal reward
local reward = rewards[math.random(#rewards)]
local count = math.random(reward.count[1], reward.count[2])
player:addItem(reward.id, count)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You found something useful!")
return true
end

4. Add the drop to monsters


Inside any monster XML:

<item id="9000" chance="500" /> <!-- 5% -->

___________________________________________________________
You can adjust the value (e.g., 250 = 2.5%, 1000 = 10%).
____________________________________________________________

Configuration Tips
  • Change the item id if 9000 is used in your server.
  • Feel free to add/remove rewards from both tables.
  • To adjust rare drop chance, edit:

if math.random(1000) <= 5 then

(5 = 0.5% → change to 10 for 1%, etc.)
______________________________________________________________

Credit: Bluster
  • Like
Reactions: Mattzon194
Author
blusterdevtfs
Downloads
5
Views
1,207
First release
Last update

Ratings

0.00 star(s) 0 ratings
Back
Top