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

Feature Reward Chest & Boss Reward [TFS 1.2]

Status
Not open for further replies.
I used in 1.1 and it worked, however it takes about 20 minutes to receive, it is normal?
 
I used in 1.1 and it worked, however it takes about 20 minutes to receive, it is normal?
Some monsters have a long decay time to rot
Code:
chizzoron the distorter -> 670
gaz'haragoth -> 190
ghazbaran -> 1510
jaul -> 910
mad mage -> 2110
mawhawk -> 190
morgaroth -> 1510
obujos -> 910
orshabaal -> 2700
raging mage -> 2110
tanjis -> 910
the pale count -> 910
zulazza the corruptor -> 670
 
Not working, still had locker/depot chest, theres no reward chest/bag on island or in body. Using TFS 1.2 - ORTS.

Still had loot in remains of ....

Also using all modification from topic like:

Code:
target = Monster(target)
if (target ~= nil) and isInArray(REWARD_CHEST.BOSSES, target:getName()) then
 
Some monsters have a long decay time to rot
Code:
chizzoron the distorter -> 670
gaz'haragoth -> 190
ghazbaran -> 1510
jaul -> 910
mad mage -> 2110
mawhawk -> 190
morgaroth -> 1510
obujos -> 910
orshabaal -> 2700
raging mage -> 2110
tanjis -> 910
the pale count -> 910
zulazza the corruptor -> 670


Found a bug. I'm killing Gaz'Haragoth.- TFS 1.1

Situation:
*Summoned Gaz'Haragoth with 350000 HP (default) - All corpses are empty, loot message says empty to.
*Summoned Gaz'Haragoth with 35 HP - System works, and i receive loot to.


Using this monster.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Gaz'Haragoth" nameDescription="gaz'haragoth" race="undead" experience="1000000" speed="400" manacost="0">
   <health now="350000" max="350000" />
   <look type="591" head="0" body="94" legs="79" feet="79" corpse="22562" />
   <targetchange interval="10000" chance="20" />
   <flags>
     <flag summonable="0" />
     <flag attackable="1" />
     <flag hostile="1" />
     <flag illusionable="0" />
     <flag convinceable="0" />
     <flag pushable="0" />
     <flag canpushitems="1" />
     <flag canpushcreatures="1" />
     <flag staticattack="98" />
     <flag targetdistance="1" />
     <flag runonhealth="0" />
   </flags>
   <attacks>
     <attack name="melee" interval="2000" min="0" max="-5000" />
     <attack name="ice" interval="3000" chance="35" range="7" radius="7" target="1" min="-900" max="-1100">
       <attribute key="shootEffect" value="ice" />
       <attribute key="areaEffect" value="icearea" />
     </attack>
     <attack name="melee" interval="1800" chance="40" range="7" radius="5" target="0" min="0" max="-1000">
       <attribute key="areaEffect" value="blackspark" />
     </attack>
     <attack name="fire" interval="3000" chance="30" length="8" spread="0" min="-4000" max="-6000">
       <attribute key="areaEffect" value="fire" />
     </attack>
     <attack name="physical" interval="2500" chance="20" range="7" radius="5" target="0" min="-200" max="-480">
       <attribute key="areaEffect" value="greenshimmer" />
     </attack>
   </attacks>
   <defenses armor="55" defense="65">
     <defense name="healing" interval="3000" chance="35" min="2500" max="3500">
       <attribute key="areaEffect" value="blueshimmer" />
     </defense>
     <defense name="speed" interval="4000" chance="80" speedchange="500" duration="6000">
       <attribute key="areaEffect" value="redshimmer" />
     </defense>
   </defenses>
   <elements>
     <element firePercent="50" />
     <element earthPercent="50" />
     <element energyPercent="50" />
     <element deathPercent="50" />
     <element physicalPercent="50" />
     <element holyPercent="50" />
     <element icePercent="50" />
   </elements>
   <immunities>
     <immunity paralyze="1" />
     <immunity invisible="1" />
   </immunities>
   <summons maxSummons="3">
     <summon name="Minion of Gaz'haragoth" interval="4000" chance="33" />
   </summons>
   <summons maxSummons="3">
     <summon name="Nightmare of Gaz'haragoth" interval="4000" chance="33" />
   </summons>
   <voices interval="5000" chance="30">
     <voice sentence="Gaz'haragoth begins to channel DEATH AND DOOM into the area! RUN!" yell="1" />
     <voice sentence="Minions! Follow my call!" yell="1" />
     <voice sentence="I've beaten tougher demons then you even know" yell="1" />
     <voice sentence="You puny humans will be my snacks!" yell="1" />
     <voice sentence="Gaz'haragoth calls down: DEATH AND DOOM!" yell="1" />
   </voices>
   <loot>
     <item id="2152" countmax="50" chance="10000" /> <!-- Platinum Coin -->
     <item id="2160" countmax="6" chance="10000" /> <!-- Crystal Coins -->
     <item id="18418" countmax="15" chance="10000" /> <!-- Blue Crystal Splinter -->
     <item id="7368" countmax="100" chance="10000" /> <!-- Assassin Star -->
     <item id="22598" countmax="3" chance="10000" /> <!-- Unrealized Dream -->
     <item id="6500" countmax="2" chance="10000" /> <!-- Demonic Essence -->
     <item id="8473" countmax="100" chance="10000" /> <!-- Ultimate Health Potion -->
     <item id="7590" countmax="100" chance="10000" /> <!-- Great Mana Potions -->
     <item id="8472" countmax="100" chance="10000" /> <!-- Great Spirit Potions -->
     <item id="22397" countmax="3" chance="10000" /> <!-- Dream Matter -->
     <item id="18415" countmax="5" chance="10000" /> <!-- Green Crystal Shard -->
     <item id="22396" countmax="14" chance="10000" /> <!-- Cluster of Solace -->
     <item id="2158" countmax="2" chance="10000" /> <!-- Blue Gem -->
     <item id="18416" countmax="10" chance="10000" /> <!-- Green Crystal Splinter -->
     <item id="18414" countmax="15" chance="10000" /> <!-- Violet Crystal Shard -->
     <item id="6529" chance="6000" /> <!-- Infernal Bolt -->
     <item id="22612" chance="6000" /> <!-- Demonic Tapestry -->
     <item id="5914" chance="6000" /> <!-- Yellow Piece of Cloth -->
     <item id="5911" chance="6000" /> <!-- Red Piece of Cloth -->
     <item id="22610" chance="6000" /> <!-- Dream Warden Mask -->
     <item id="7899" chance="6000" /> <!-- Magma Coat -->
     <item id="7632" chance="6000" /> <!-- Giant Shimmering Pearl -->
     <item id="5954" chance="6000" /> <!-- Demon Horn -->
     <item id="22608" chance="6000" /> <!-- Nightmare Horn -->
     <item id="2195" chance="6000" /> <!-- Boots of Haste -->
     <item id="2168" chance="6000" /> <!-- Life Ring -->
     <item id="22614" chance="6000" /> <!-- Nightmare Beacon -->
     <item id="22613" chance="6000" /> <!-- Eye Pod -->
     <item id="22611" chance="6000" /> <!-- Psychedelic Tapestry -->
     <item id="22398" chance="5000" /> <!-- Crude Umbral Blade -->
     <item id="22401" chance="5000" /> <!-- Crude Umbral Slayer -->
     <item id="22404" chance="5000" /> <!-- Crude Umbral Axe -->
     <item id="22407" chance="5000" /> <!-- Crude Umbral Chopper -->
     <item id="22413" chance="5000" /> <!-- Crude Umbral Hammer -->
     <item id="22410" chance="5000" /> <!-- Crude Umbral Mace -->
     <item id="22416" chance="5000" /> <!-- Crude Umbral Bow -->
     <item id="22419" chance="5000" /> <!-- Crude Umbral Crossbow -->
     <item id="22422" chance="5000" /> <!-- Crude Umbral Spellbook -->
     <item id="22399" chance="5000" /> <!-- Umbral Blade -->
     <item id="22402" chance="5000" /> <!-- Umbral Slayer -->
     <item id="22405" chance="4000" /> <!-- Umbral Axe -->
     <item id="22408" chance="4000" /> <!-- Umbral Chopper -->
     <item id="22414" chance="4000" /> <!-- Umbral Hammer -->
     <item id="22411" chance="4000" /> <!-- Umbral Mace -->
     <item id="22417" chance="4000" /> <!-- Umbral Bow -->
     <item id="22420" chance="4000" /> <!-- Umbral Crossbow -->
     <item id="22423" chance="4000" /> <!-- Umbral Spellbook -->
     <item id="22400" chance="4000" /> <!-- Umbral Masterblade -->
     <item id="22403" chance="3000" /> <!-- Umbral Master Slayer -->
     <item id="22406" chance="3000" /> <!-- Umbral Master Axe -->
     <item id="22409" chance="3000" /> <!-- Umbral Master Chopper -->
     <item id="22415" chance="3000" /> <!-- Umbral Master Hammer -->
     <item id="22412" chance="3000" /> <!-- Umbral Master Mace -->
     <item id="22418" chance="3000" /> <!-- Umbral Master Bow -->
     <item id="22421" chance="3000" /> <!-- Umbral Master Crossbow -->
     <item id="22424" chance="3000" /> <!-- Umbral Master Spellbook -->
     <item id="11262" chance="6000" /> <!-- Solitude Charm -->
     <item id="11261" chance="6000" /> <!-- Twin Sun Charm -->
     <item id="11260" chance="6000" /> <!-- Spiritual Charm -->
     <item id="11259" chance="6000" /> <!-- Unity Charm -->
     <item id="11258" chance="6000" /> <!-- Phoenix Charm -->
   </loot>
</monster>
 
Found a bug. I'm killing Gaz'Haragoth.- TFS 1.1

Situation:
*Summoned Gaz'Haragoth with 350000 HP (default) - All corpses are empty, loot message says empty to.
*Summoned Gaz'Haragoth with 35 HP - System works, and i receive loot to.
Well, I tested with the TFS 1.1 of github and I didn't get that bug, worked perfectly even with your monster.

Once I get free time I'll see how make the loot unique and split it by loot chance and damage percent, so many players don't get the same ferumbras hat for ex.
 
Well, I tested with the TFS 1.1 of github and I didn't get that bug, worked perfectly even with your monster.

Once I get free time I'll see how make the loot unique and split it by loot chance and damage percent, so many players don't get the same ferumbras hat for ex.

Well i've tested it multiple times, and this bug only occur es with Gaz'Haragoth when he has alot of health. at this point i don't know what is causing it, i just posted it to inform.
*People who had problems with no loot try to decrease health of monster and test again just to be sure.
 
First of all great job @cbrm, i just saw it today and i think it is awesome :)

I can help a bit with the optimizations, but since i'm to lazy to test the changes. I hope someone can do it. Then report if they recive errors:
Replace this on creaturescript:

Code:
function doBossReward(monster, corpse)
    local monsterType = MonsterType(monster:getName())
    if not monsterType then
        return true
    end
   
    REWARD_CHEST.LOOT[corpse:getUniqueId()] = {}
    corpse:setAttribute(ITEM_ATTRIBUTE_ACTIONID, 21584)
    corpse:setAttribute(ITEM_ATTRIBUTE_TEXT, corpse:getUniqueId())
   
    local text = "Loot of ".. monsterType:getNameDescription() ..": "
    for creatureId, damage in pairs(monster:getDamageMap()) do
        local player = Player(creatureId)
        if not player then
            return true
        end
       
        if player:getStamina() < 840 then
            text = text .. "nothing (due to low stamina)"
            break
        end
           
        local loot = monsterType:getBossReward(damage.total / monsterType:getMaxHealth())
        if #loot == 0 then
            text = text .. "nothing"
            break
        end
       
        local rewardBag = Game.createItem(REWARD_CHEST.CONTAINER, 1)
        if not rewardBag then
            return true
        end
       
        addContainerItems(Container(rewardBag), loot)
        REWARD_CHEST.LOOT[corpse:getUniqueId()][player:getGuid()] = loot
        text = text .. Container(rewardBag):getContentDescription()
    end
   
    player:sendTextMessage(MESSAGE_INFO_DESCR, text ..".")
    addEvent(doSaveReward, REWARD_CHEST.DECAY[monster:getName():lower()] * 1000, corpse:getUniqueId(), monsterType:getNameDescription())
end

function onKill(creature, target)
    local targetMonster = target:getMonster()
    if not targetMonster or not isInArray(REWARD_CHEST.BOSSES, targetMonster:getName():lower()) then
        return true
    end
   
    local corpse = Game.createItem(MonsterType(targetMonster:getName()):getCorpseId(), 1, targetMonster:getPosition())
    if not corpse then
        return true
    end
   
    corpse:decay()
    targetMonster:setDropLoot(false)
    doBossReward(targetMonster, corpse)
end
 
First of all great job @cbrm, i just saw it today and i think it is awesome :)

I can help a bit with the optimizations, but since i'm to lazy to test the changes. I hope someone can do it. Then report if they recive errors:
Replace this on creaturescript:

Code:
function doBossReward(monster, corpse)
    local monsterType = MonsterType(monster:getName())
    if not monsterType then
        return true
    end
  
    REWARD_CHEST.LOOT[corpse:getUniqueId()] = {}
    corpse:setAttribute(ITEM_ATTRIBUTE_ACTIONID, 21584)
    corpse:setAttribute(ITEM_ATTRIBUTE_TEXT, corpse:getUniqueId())
  
    local text = "Loot of ".. monsterType:getNameDescription() ..": "
    for creatureId, damage in pairs(monster:getDamageMap()) do
        local player = Player(creatureId)
        if not player then
            return true
        end
      
        if player:getStamina() < 840 then
            text = text .. "nothing (due to low stamina)"
            break
        end
          
        local loot = monsterType:getBossReward(damage.total / monsterType:getMaxHealth())
        if #loot == 0 then
            text = text .. "nothing"
            break
        end
      
        local rewardBag = Game.createItem(REWARD_CHEST.CONTAINER, 1)
        if not rewardBag then
            return true
        end
      
        addContainerItems(Container(rewardBag), loot)
        REWARD_CHEST.LOOT[corpse:getUniqueId()][player:getGuid()] = loot
        text = text .. Container(rewardBag):getContentDescription()
    end
  
    player:sendTextMessage(MESSAGE_INFO_DESCR, text ..".")
    addEvent(doSaveReward, REWARD_CHEST.DECAY[monster:getName():lower()] * 1000, corpse:getUniqueId(), monsterType:getNameDescription())
end

function onKill(creature, target)
    local targetMonster = target:getMonster()
    if not targetMonster or not isInArray(REWARD_CHEST.BOSSES, targetMonster:getName():lower()) then
        return true
    end
  
    local corpse = Game.createItem(MonsterType(targetMonster:getName()):getCorpseId(), 1, targetMonster:getPosition())
    if not corpse then
        return true
    end
  
    corpse:decay()
    targetMonster:setDropLoot(false)
    doBossReward(targetMonster, corpse)
end

Tested, the bosses are droppingloot in corpse.
 
It is to change the codes to work in 1.0?
the error in player.cpp actions.cpp and depotchest.cpp
can you send me it changed pro 1.0?
 
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/reward_chest.lua:onUse
data/actions/scripts/reward_chest.lua:3: attempt to call method 'getId' (a nil value)
stack traceback:
    [C]: in function 'getId'
    data/actions/scripts/reward_chest.lua:3: in function <data/actions/scripts/reward_chest.lua:1>

Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/reward_chest.lua:onKill
data/creaturescripts/scripts/reward_chest.lua:296: attempt to index local 'target' (a number value)
stack traceback:
    [C]: in function '__index'
    data/creaturescripts/scripts/reward_chest.lua:296: in function <data/creaturescripts/scripts/reward_chest.lua:295>
 
Hello, how the item is sent to the depot? what condition? if NOT ENOUGH CAPACITY?

DEPOT_ID = 99

the items are not going to the depot, you need to add some actionId in the chest?
 
I using tfs 1.0 and system works fine, when i kill boss the rewards bag are ok, and send to reward chest when corpse rot too, but dont creating the database table, and when player log out him lose the loot in the chest. can help me?
 
works! but you have to wait about 15 ~ 20 minutes, how edite time?
 
why dont creating the database table, and when player logout him lose the loot in the chest. can help me?

--- EDIT --
Im testing with a 2 chars, I give half damage with one, but is only getting loot who is killing the boss, has no error in the console also has what I've said above, the loot disappears from the chest to the character relog..

--EDIT --

Im Tested with 3 normal chars and its works, but the loot disappears from the chest to the character relog yet.

I thinking are not saving because have "else" in this part?
Code:
player:addReward(items, os.time())
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'Your reward container from ' .. name .. ' was moved to your reward chest.')
        else
            db.query('INSERT INTO player_rewardchest VALUES (NULL, ' .. GUID ..', "' .. serialize(items) ..'", ' .. os.time() ..');')

and how to put an item to drop that the boss drop always, only if the player gives a certain amount of damage as the global?
 
Last edited by a moderator:
why dont creating the database table, and when player logout him lose the loot in the chest. can help me?

--- EDIT --
Im testing with a 2 chars, I give half damage with one, but is only getting loot who is killing the boss, has no error in the console also has what I've said above, the loot disappears from the chest to the character relog..

--EDIT --

Im Tested with 3 normal chars and its works, but the loot disappears from the chest to the character relog yet.

I thinking are not saving because have "else" in this part?
Code:
player:addReward(items, os.time())
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'Your reward container from ' .. name .. ' was moved to your reward chest.')
        else
            db.query('INSERT INTO player_rewardchest VALUES (NULL, ' .. GUID ..', "' .. serialize(items) ..'", ' .. os.time() ..');')

and how to put an item to drop that the boss drop always, only if the player gives a certain amount of damage as the global?

DId you add the database to mysql? Works fine here.
 
DId you add the database to mysql? Works fine here.

Yes, i added, so my version is tfs 1.0, when player logout and back, the loot disapear.

otherwise the script is really beautiful, congratulations to the creators


-EDIT

The bug is this: if the player by killing the boss, go relog, he will lose the reward that is in the chest. But if by killing the boss, he opens the chest, oh yes the items saved, and he can relogin will not lose. In short, if the player leave the game after killing the boss before opening the chest, he will lose the items.
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top