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

Solved Rise of Devovorga World Quest - Bloom of Doom

Nottinghster

Tibia World RPG Developer
Joined
Oct 24, 2007
Messages
1,570
Solutions
6
Reaction score
437
Location
Brazil - Rio de Janeiro
GitHub
Nottinghster
Hello folks !!

I've created the Rise of Devovorga world quest and it's fully working, as you can see in this link (https://otland.net/threads/7-7-tibi...-cipsoft-should-do.233376/page-8#post-2277923), but there's a little problem:

We need to kill 4 Bloom of Doom, to advance to the next stage, but if 2 players or more, attack and kill 1 one them, it will advance to the next stage

(The problem is killing a monster with same name)

Here's the code part:
Code:
function onKill(cid, target, lasthit)

-- Kill Blooms of Doom by Rodrigo (Nottinghster - OTLand) / Rise of Devovorga World Quest
if getCreatureName(target) == "Bloom Of Doom" then
    if getGlobalStorageValue(STORAGE_DEVOVORGA) == 7 then
        setGlobalStorageValue(STORAGE_DEVOVORGA, getGlobalStorageValue(STORAGE_DEVOVORGA) + 1) -- Value 8
    elseif getGlobalStorageValue(STORAGE_DEVOVORGA) == 8 then
        setGlobalStorageValue(STORAGE_DEVOVORGA, getGlobalStorageValue(STORAGE_DEVOVORGA) + 1) -- Value 9
    elseif getGlobalStorageValue(STORAGE_DEVOVORGA) == 9 then
        setGlobalStorageValue(STORAGE_DEVOVORGA, getGlobalStorageValue(STORAGE_DEVOVORGA) + 1) -- Value 10
    elseif getGlobalStorageValue(STORAGE_DEVOVORGA) == 10 then
        setGlobalStorageValue(STORAGE_DEVOVORGA, getGlobalStorageValue(STORAGE_DEVOVORGA) + 1) -- Value 11
        doCreatureSay(target, TEXT_DEATH_BLOOM_OF_DOOM, TALKTYPE_ORANGE_1)
        broadcastIncarnationsAreBack()
        doTeleportPlayersFromArea(fromPos, toPos, newPos)
        addEvent(removeCocoon, 1 * 1000)
        createSpawnsOfDevovorgas()
    elseif getGlobalStorageValue(STORAGE_DEVOVORGA) == 16 then
        setGlobalStorageValue(STORAGE_DEVOVORGA, getGlobalStorageValue(STORAGE_DEVOVORGA) + 1) -- Value 17
    elseif getGlobalStorageValue(STORAGE_DEVOVORGA) == 17 then
        setGlobalStorageValue(STORAGE_DEVOVORGA, getGlobalStorageValue(STORAGE_DEVOVORGA) + 1) -- Value 18
    elseif getGlobalStorageValue(STORAGE_DEVOVORGA) == 18 then
        setGlobalStorageValue(STORAGE_DEVOVORGA, getGlobalStorageValue(STORAGE_DEVOVORGA) + 1) -- Value 19
    elseif getGlobalStorageValue(STORAGE_DEVOVORGA) == 19 then
        setGlobalStorageValue(STORAGE_DEVOVORGA, getGlobalStorageValue(STORAGE_DEVOVORGA) + 1) -- Value 20
        doCreatureSay(target, TEXT_DEATH_BLOOM_OF_DOOM, TALKTYPE_ORANGE_1)
        createVulnerableCocoon()
    end
end
    return true
end

Thanks for the support ;)
 
Last edited:
onKill is executed for every killer, either check for last hit or use onDeath for the monster.
Thanks for the feedback ;)

1 - onDeath is a TFS function, since I'm using OTServ_SVN 0.6.3, I have the onDie function, don't know if works like TFS (never used TFS :eek:)
2 - How can I check for the last hit ? since I never scripted using that hehehe
 
Taken from OTHire, which is based on otserv, there is already last hit parameter passed to the function.
Code:
onKill(cid, target, lasthit)
 
Just change line:
PHP:
if getCreatureName(target) == "Bloom Of Doom" then
to:
PHP:
if lastHit and getCreatureName(target) == "Bloom Of Doom" then
lastHit is boolean value (true/false)
For every kill, player that did last hit (is some cases most damage, example: when monster die by firefield), get this value true, all other players that did attack same monster run 'onKill' event, but with false.
If you check if it's true, your script (add to counter) will add 'kill' to only one player.
 
Just change line:
PHP:
if getCreatureName(target) == "Bloom Of Doom" then
to:
PHP:
if lastHit and getCreatureName(target) == "Bloom Of Doom" then
lastHit is boolean value (true/false)
For every kill, player that did last hit (is some cases most damage, example: when monster die by firefield), get this value true, all other players that did attack same monster run 'onKill' event, but with false.
If you check if it's true, your script (add to counter) will add 'kill' to only one player.
Now I understood how it works, and I fixed it, thank you so much man !!!
 
Back
Top