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

[10.90 + Cast] Tfs 1.2 (custom modifications) + Reward Chest

I would explain, but no1 explained me yet how to fix these :X
The two warnings indicates that there are two unreferenced parameters (as in unused). Simply open protocollogin (L47) & protocolspectator.cpp (L364) and remove the identifiers broadcast & version (but leave the types).

It should look like this now:
protocollogin.cpp, L47
Code:
void ProtocolLogin::addWorldInfo(OutputMessage_ptr& output, const std::string& accountName, const std::string& password, uint16_t, bool isLiveCastLogin /*=false*/)
protocolspectator.cpp, L364
Code:
void ProtocolSpectator::writeToOutputBuffer(const NetworkMessage& msg, bool)

The MPIR library you are using is outdated (Update to MPIR 2.7 or newer).
 
And another problem is that when i use rune or potion, the text is white and it's on the bottom of the screen. I really want to fix all these issues like loot and runes on hotkey..
 
I just wanna change these things to normal "view" or "design" idk how to write it in english.
Using one of 97.... and this loot.
kWOkzA2.png
 
I just wanna change these things to normal "view" or "design" idk how to write it in english.
Using one of 97.... and this loot.
kWOkzA2.png
I already explained it on page 4, same with loot messages, it's 3 small changes
 
reward chest not working for me
I didn't touch the script, posted it down so you can confirm it's the same you using

Error: http://pastebin.com/FDb7B9mN

Code:
function sort_descending(t)
    local tmp = {}
    for k, v in pairs(t) do
        table.insert(tmp, {k, v})
    end
    table.sort(tmp, function(a, b) return a[2] > b[2] end)
    return tmp
end

function table.find(t, v)
    for i,x in pairs(t) do
        if x == v then
            return true
        end
    end
end

function Player:addItemRewardBag(itemid, count)
    local rewardbag = self:getDepotChest(99)
    return rewardbag:addItem(itemid, count)
end

function MonsterType:getBossReward(chance, unique)
    local ret = {}
    local function randomItem(lootBlock, chance)
        local randvalue = math.random(0, 100000) / (getConfigInfo("rateLoot") * chance)
        if randvalue < lootBlock.chance then
            if (ItemType(lootBlock.itemId):isStackable()) then
                return (randvalue%lootBlock.maxCount) + 1
            else
                return 1
            end
        end
    end
    local lootBlockList = self:getLoot()
    for _, loot in pairs(lootBlockList) do
        local rd = randomItem(loot, chance)
        if rd then
            if loot.uniquedrop then
                if unique then
                    table.insert(ret, {loot, rd})
                end
            else
                table.insert(ret, {loot, rd})
            end
        end
    end
    return ret
end

BossLoot = {}
BossUids = {}

function BossLoot:new(boss)
    if not table.find(BossUids, boss:getId()) then
        table.insert(BossUids, boss:getId())
        return setmetatable({creature=boss}, {__index = BossLoot})
    end
end

function BossLoot:updateDamage()
    if self.creature then
        local tmp = {}
        local totaldmg = 0
        for killer, damage in pairs(self.creature:getDamageMap()) do
            totaldmg = totaldmg+damage.total
            tmp[killer] = damage.total
        end
        self.players = sort_descending(tmp)
        self.totaldmg = totaldmg
    else
        error("Creature not found.")
    end
end

function BossLoot:setRewards()
    if self.totaldmg and self.creature then
        if getConfigInfo("rateLoot") > 0 then
            local mt = MonsterType(self.creature:getName())
            for i, playertab in ipairs(self.players) do
                local loot
                if i == 1 then
                    loot = mt:getBossReward(playertab[2] / self.totaldmg, true)
                else
                    loot = mt:getBossReward(playertab[2] / self.totaldmg, false)
                end
                table.insert(self.players[i], loot)
            end
        end
    else
        error("Error")
    end
end

function BossLoot:addRewards()
    if self.players and self.players[1] and self.players[1][3] then
        for i, playertab in ipairs(self.players) do
            local player = Player(playertab[1])
            if player then
                local str = "The following items are available in your reward chest: "
                for i, lootTable in ipairs(playertab[3]) do
                    local item = player:addItemRewardBag(lootTable[1].itemId, math.ceil(lootTable[2]))
                    if item then
                        str = str .. item:getNameDescription() .. ", "
                    end
                end
                str = str:sub(1, #str-2)
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, str)
            end
        end
    else
        error("Error")
    end
end

function onKill(creature, target)
    if (Monster(target) ~= nil) then
        local mt = MonsterType(target:getName())
        if mt:useRewardChest() then
            local loot = BossLoot:new(target)
            if loot then
                local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition()))
                corpse:decay()
                target:setDropLoot(false)
                loot:updateDamage()
                loot:setRewards()
                loot:addRewards()
                corpse:setAttribute('aid', 21584)
            end
        end
    end
end
 
Uff this thread name is too appealing. Every time I see it, it makes me wonder should I bother Wibbenz or not.
 
@Lundrial can you tell me what cast system did you use, so I can follow step by step to check whats wrong, cuz it's not working for me '-'
 
@Lundrial can you tell me what cast system did you use, so I can follow step by step to check whats wrong, cuz it's not working for me '-'
Djarek's cast system, with some modifications to make it work on 10.80+ this is the 4th time I say it but well, the modifications are in this thread, just check the comments.
 
which moon file must change to reward work perfectly beyond the creaturescript??
 
fixed, the issue was related to monster name, since my monster files are in numbers and not names and since monster file name was different than monster name it didn't work
 
@Lundrial
beyond the creaturescripts which files have to change to operate the reward system?
I am using the sources that was posted linux ubuntu 15.04,
cast system is working
 
@Lundrial
@Lava Titan

I'm reward system problem in the cast is working perfectly,
I am using the sources of the topic , rewardloot.lua in creaturescripts and frags the monster and not working , have some other script where you have to change ?
 
@Lundrial
@Lava Titan

I'm reward system problem in the cast is working perfectly,
I am using the sources of the topic , rewardloot.lua in creaturescripts and frags the monster and not working , have some other script where you have to change ?
not to sound rude but, I couldn't truly understand what you're trying to tell me, but if you mixed your datapack with this one, you need to register the event in login.lua in order to make it work, hope it helps!
 
Back
Top