• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Request with Game.getSpectators

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hi folks! I don't know how to make this script, so here I am.. The script is suppost to check if you kill a Dragon Lord in spectador area will set a global storage.

Tfs 1.2

How make it?

Thanks.
 
Last edited:
not tested BUT:
Code:
local config = {
    fromPosition = Position(xxx,xxx,x),
    toPosition = Position(xxx,xxx,x)
}
function onDeath(creature, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified)
    local player = mostdamagekiller:getPlayer() or mostdamagekiller:getMaster()
    local targetMonster = creature:getMonster()
    if not targetMonster then
        return true
    end
    if targetMonster:getName():lower() ~= 'dragon lord' then
        return true
    end
    if not isInRange(player:getPosition(), config.fromPosition, config.toPosition) then
        return true
    end
    Game.setStorageValue(key, value)
    return true
end
this will work I think :p but to check more than one floor (Z) you need make some modifications
 
I don't think that will fit in what I am wanting, the main idea is to set gameStorage to 1 if a Dragon Lord has been killed in the area X, X, 7 to Y, Y, 7

Do you fill me?
 
I don't think that will fit in what I am wanting, the main idea is to set gameStorage to 1 if a Dragon Lord has been killed in the area X, X, 7 to Y, Y, 7

Do you fill me?
aff man you don't know about the function isInRange() ?
this function works perfectly here, just need to register the event in the monster.xml
here work, set the game storage. I'm using a different one:
Code:
local config = {
    fromPosition = Position(33660, 31895, 5),
    toPosition = Position(33666, 31899, 5)
}
function onDeath(creature, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified)
    local player = mostdamagekiller:getPlayer() or mostdamagekiller:getMaster()
    local targetMonster = creature:getMonster()
    if not targetMonster then
        return true
    end
    if not isInRange(player:getPosition(), config.fromPosition, config.toPosition) then
        print('is not in range')
        return true
    end
    player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) -- test to check
    return true
end
[code]
 
Back
Top