• 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 onKill(creature, target)

leandroluck

New Member
Joined
Dec 24, 2010
Messages
104
Reaction score
1
to kill the boss 1 the boss two will appear the problem that if 5 people kill the boss 1 appears the boss two 5x

Code:
local bossPositions = {
    Position(32800, 32829, 14),
    Position(32796, 32832, 14),
    Position(32804, 32834, 14),
    Position(32793, 32835, 14),
    Position(32809, 32830, 14),
    Position(32805, 32829, 14)
}

function onKill(creature, target)
    local targetMonster = target:getMonster()
    if not targetMonster or targetMonster:getName():lower() ~= 'demonone' then
        return true
    end

local boss =Game.createMonster('demontwo', bossPositions[math.random(#bossPositions)])
if boss then
      boss:setReward(false)
end
return true
end
 
Solution
check your sources. There's bound to be more options then just creature and target.
onKill registers for each player. Set it to only work for the player who dealt the killing blow.
use onDeath instead of onKill?
ex.:
Code:
local bossPositions = {
    Position(32800, 32829, 14),
    Position(32796, 32832, 14),
    Position(32804, 32834, 14),
    Position(32793, 32835, 14),
    Position(32809, 32830, 14),
    Position(32805, 32829, 14)
}

function onDeath(creature, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified)
    local boss = Game.createMonster('demontwo', bossPositions[math.random(#bossPositions)])
    if boss then
              boss:setReward(false)
    end

    return true
end

register in monster file:
Code:
<script>
    <script name="BossOneDeath"/>
</script>
 
I tested it happens the problem looks like it when several players kills it summon several and not only 1

sometimes after the boss is dead he comes back as a / reload


---edit --
There was no player on the screen and there were no monsters they are just showing up
 
Last edited:
check your sources. There's bound to be more options then just creature and target.
onKill registers for each player. Set it to only work for the player who dealt the killing blow.
 
Solution
Back
Top