Hello!
So basically when for example in mummy.xml file I have:
It drops a random amount of gold. Sometimes 10, 20 and sometimes 100.
I want to make it dropping around 60-100 gold, but as I though and tested there is no countmin.
As far as I know only basics of lua scripts I add this in my mummy.xml
This in creaturesscripts.xml:
And this my lua script:
Well i know it not perfect, but it works fine for me.
Anyway now gold is on the last free slot in dead mummy container even after bag. It just looks weird and make it hard to drag and drop gold to my backpack.
Forgot to say before. In config.lua I can make moneyRate = 2 but then my mummy can drop even 200gold coins at once, which also is kinda bad for me.
So is there any way to make gold appear at first slot in the dead body or maybe there is something like coutmin? Or maybe can I do something with moneyRate, I mean when dropped gold is >100 then make it =100? I tried do everything on my own, but oh well. The code, which I posted is best I got as far.
So basically when for example in mummy.xml file I have:
Code:
<item id="3031" countmax="100" chance="400" /> <!-- a gold coin -->
I want to make it dropping around 60-100 gold, but as I though and tested there is no countmin.
As far as I know only basics of lua scripts I add this in my mummy.xml
Code:
<script>
<event name="LootGoldMonster"/>
</script>
<event type="death" name="LootGoldMonster" script="lootgoldmonster.lua"/>
And this my lua script:
Code:
local config = {
["mummy"] = {min = 50, max = 96}
}
function onDeath(cid, corpse)
local amount = math.random(config[cid:getName()].min, config[cid:getName()].max)
local itemDropped = doCreateItemEx(3031, amount)
doAddContainerItemEx(corpse.uid, itemDropped)
return true
end
Anyway now gold is on the last free slot in dead mummy container even after bag. It just looks weird and make it hard to drag and drop gold to my backpack.
Forgot to say before. In config.lua I can make moneyRate = 2 but then my mummy can drop even 200gold coins at once, which also is kinda bad for me.
So is there any way to make gold appear at first slot in the dead body or maybe there is something like coutmin? Or maybe can I do something with moneyRate, I mean when dropped gold is >100 then make it =100? I tried do everything on my own, but oh well. The code, which I posted is best I got as far.