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

TFS 0.X Efect on monster corpse when monster drops rare

eyez

Member
Joined
Oct 11, 2016
Messages
129
Reaction score
19
loot.gif


How to create this effect on monster corpse when drop some rare loots?

Code:
if(chance <= 100) 'Legendary'
else if(chance <= 500 && chance > 100) 'Epic'
else if(chance <= 2500 && chance > 500) 'Rare'
 
 
Solution

That's a gif from my server, and this is the link I used to create it.
 
guys, i tried to make it to work
Code:
UNCOMMON_ITEMS = {5875,5878,5879}
RARE_ITEMS = {2498,2466,2487}
EPIC_ITEMS = {2472,2470,2195}


function getTopItem(p) -- from Darkhaos's arena script
    p.stackpos = 0
    local v = getThingFromPos(p)
    repeat
        p.stackpos = p.stackpos + 1
        v = getThingFromPos(p)
    until v.itemid == 0
    p.stackpos = p.stackpos - 1
    return getThingFromPos(p)
end


function scanCorpseLoot(cid, pos)
    local corpse = getTopItem(pos)
    if isContainer(corpse.uid) then
        for n = (getContainerSize(corpse.uid) - 1), 0, -1 do
            if isInArray(UNCOMMON_ITEMS, getContainerItem(corpse.uid, n).itemid) then
                addEvent(warningRareLoot, 100, pos, 1)
                addEvent(warningRareLoot, 1000, pos, 1)
                addEvent(warningRareLoot, 2000, pos, 1)
                break
            elseif isInArray(RARE_ITEMS, getContainerItem(corpse.uid, n).itemid) then
                addEvent(warningRareLoot, 100, pos, 2)
                addEvent(warningRareLoot, 1000, pos, 2)
                addEvent(warningRareLoot, 2000, pos, 2)
                break
            elseif isInArray(EPIC_ITEMS, getContainerItem(corpse.uid, n).itemid) then
                addEvent(warningRareLoot, 100, pos, 3)
                addEvent(warningRareLoot, 1000, pos, 3)
                addEvent(warningRareLoot, 2000, pos, 3)
                break 
            end
        end
    end
end

function warningRareLoot(pos, rtype)
    if rtype == 1 then
        doSendAnimatedText(pos, "UNCOMMON", 23)
        doSendMagicEffect(pos, 23) -- azul
    elseif rtype == 2 then
        doSendAnimatedText(pos, "RARE", 22)
        doSendMagicEffect(pos, 22) -- rosa
    elseif rtype then
        doSendAnimatedText(pos, "EPIC", 19)
        doSendMagicEffect(pos, 19) -- vermelho
    end
end

function onKill(cid, target, lastHit)
    if isMonster(target) then
        addEvent(scanCorpseLoot, 150, cid, getThingPos(target))
    end
    return true
end

normally it is working
but sometimes it drops the rare item, but not showing the effects...

did u know why?
 

Similar threads

Back
Top