• 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!

monster loot

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
457
Reaction score
17
how i can make monster lose one items only
example:
if monster have lots of id items like this
Code:
<loot>
        <item id="2148" countmax="70" chance="37500"/><!-- gold coin -->
        <item id="2148" countmax="50" chance="37500"/><!-- gold coin -->
        <item id="2546" countmax="12" chance="4000"/><!-- burst arrow -->
        <item id="2672" countmax="3" chance="15500"/><!-- dragon ham -->
        <item id="2406" chance="25000"/><!-- short sword -->
        <item id="2398" chance="21500"/><!-- mace -->
        <item id="2509" chance="14000"/><!-- steel shield -->
        <item id="2455" chance="10000"/><!-- crossbow -->
        <item id="2397" chance="5000"/><!-- longsword -->
        <item id="1987" chance="100000"><!-- bag -->
            <inside>
        <item id="2457" chance="3000"/><!-- steel helmet -->
        <item id="2647" chance="2000"/><!-- plate legs -->
        <item id="2413" chance="1950"/><!-- broadsword -->
        <item id="7588" chance="1750"/><!-- strong health potion -->
        <item id="2387" chance="1333"/><!-- double axe -->
        <item id="2187" chance="1200"/><!-- wand of inferno -->
        <item id="5920" chance="850"/><!-- green dragon scale -->
        <item id="2434" chance="600"/><!-- dragon hammer -->
        <item id="5877" chance="500"/><!-- green dragon leather -->
        <item id="2145" chance="500"/><!-- small diamond -->
        <item id="2516" chance="400"/><!-- dragon shield -->
        <item id="2409" chance="400"/><!-- serpent sword -->
        <item id="7430" chance="250"/><!-- dragonbone staff -->
        <item id="2177" chance="150"/><!-- life crystal -->   
            </inside>
        </item>
    </loot>

how i can make the monster lose 1 items only
tfs 0.4
 
Lose or drop?

If the idea is dropping just a unique Item, you can edit your sources to that specific monster but its not good.
The best way is remove that loot list from the monster script, and add a onDeath event, adding a item from a random list(array), in this corpse container.

LUA:
local monsterDrops = {
{itemId=2160,count=1},
{itemId=2472,count=1},
}
local randomDrop = math.random(1,#monsterDrops)
corpse:addItem(monsterDrops[randomDrop].itemId,monsterDrops[randomDrop].count)

A tip: monsters need add a script line in monster .xml file to push your death event. Like that:

XML:
<script>
        <event name="dropUniqueItem"/>
</script>
 
Last edited:
Lose or drop?

If the idea is dropping just a unique Item, you can edit your sources to that specific monster but its not good.
The best way is remove that loot list from the monster script, and add a onDeath event, adding a item from a random list(array), in this corpse container.

LUA:
local monsterDrops = {
{itemId=2160,count=1},
{itemId=2472,count=1},
}
local randomDrop = math.random(1,#monsterDrops)
corpse:addItem(monsterDrops[randomDrop].itemId,monsterDrops[randomDrop].count)

A tip: monsters need add a script line in monster .xml file to push your death event. Like that:

XML:
<script>
        <event name="dropUniqueItem"/>
</script>
to set script for every monster will take more time :S noway in source?
 
Back
Top