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

Lua New "boss reward" system TFS 1.0

ATT3

Intermediate OT User
Joined
Sep 22, 2010
Messages
512
Reaction score
100
Some of you might already know what I am talking about by reading the title but for the rest I will do my best to explain it as well as I can :)

Ok, nowdays in real tibia when you participate to kill any major boss /such as Ferumbras, the body "turns" into reward chest, so everybody can get something.//If somebody didn't do any damage on the boss he cant open the body.

But, what makes it a bit more difficult is that the guy who has dealt the most damage will get the rarest items (such as Ferumbras hat and magic plate armor) in this case.
and if somebody only shot 1 SD he will get pretty much nothing, e.g 100 gps.

So yeah, here is something that I've got this far:
Creaturescript.
Code:
local boss = {
    ["gaz'haragoth"] = 2,
    ["mawhawk"] = 3,
    ["ferumbras"] = 4
}

function onDeath(cid, corpse, lastHitKiller, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
        local creature = Creature(cid)
        local damageMap = creature:getDamageMap()
        local v = boss[creature:getName():lower()]

        for id, damage in pairs(damageMap) do
                local player = Player(id)
                if player and v then
                        player:setStorageValue(954, v)
                        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Loot from:~?monster name, loot from body/ or it could just be:Open the body to get your loot")
                end
        end
end

And then the difficult part:
Action:

Ofc, this is very raw version of it, but I guess you got the point now.
Code:
local feru = {2149,9971,2148,2514,7405,7427}
local mawhawk = {2152,7591,2148,5951,18554,22533}
local count = {38,4,78,1,1,1}
present =math.random(#items)

function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 6078 and getPlayerStorageValue(cid, 954, 1) then -- ferumbras
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE,"You have found:items that he found")
doPlayerAddItem(cid,feru[present],count[present])
setPlayerStorageValue(cid, 954, 0)

elseif item.itemid == 22628 and getPlayerStorageValue(cid, 954, 2) then -- mawhawk
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE,"You have found:items that he found")
doPlayerAddItem(cid,mawhawk[present],count[present])
setPlayerStorageValue(cid, 954, 0)

elseif item.itemid == 10029 and getPlayerStorageValue(cid, 954, 3) then -- some third monster
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE,"You have found:items that he found")
doPlayerAddItem(cid,thirdboss[present],count[present])
setPlayerStorageValue(cid, 954, 0)
end
end

Appreciate your help, thanks :)
 
You could set an action id on the transformed chest at the transformation point, add a script corresponding with that action id in the actions, and return false if the opener may not open.

Just an idea.

[Question]
Is the reward per most damage linear? Or simply that the one with the most damage gets the rarest item (only one)?

Ignazio
 
Back
Top