• 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 Limit object desintegrate rune

dervin13

Active Member
Joined
Apr 26, 2008
Messages
458
Solutions
1
Reaction score
28
Hello, there's a way to limit the object that clean in sqm like 10 every time that use the rune? Thanks

Lua:
local dead_human = {
    3058, 3059, 3060, 3061, 3064, 3065, 3066
}
function onCastSpell(creature, var, isHotkey)
    local position = Variant.getPosition(var)
    local tile = position:getTile()
    local object = tile and tile:getTopVisibleThing()
    if object and not object:isCreature() then
        local desintegrate = false
        while not isInArray(dead_human, object.itemid)
            and object:getType():isMovable()
            and object.uid > 65535
            and object.actionid == 0
        do
            object:remove()
            desintegrate = true
            object = tile:getTopVisibleThing()
        end
        if desintegrate then
            position:sendMagicEffect(CONST_ME_BLOCKHIT)
            return true
        end
    end

    creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    creature:getPosition():sendMagicEffect(CONST_ME_POFF)
    return false
end
 
Hello, there's a way to limit the object that clean in sqm like 10 every time that use the rune? Thanks

Lua:
local dead_human = {
    3058, 3059, 3060, 3061, 3064, 3065, 3066
}
function onCastSpell(creature, var, isHotkey)
    local position = Variant.getPosition(var)
    local tile = position:getTile()
    local object = tile and tile:getTopVisibleThing()
    if object and not object:isCreature() then
        local desintegrate = false
        while not isInArray(dead_human, object.itemid)
            and object:getType():isMovable()
            and object.uid > 65535
            and object.actionid == 0
        do
            object:remove()
            desintegrate = true
            object = tile:getTopVisibleThing()
        end
        if desintegrate then
            position:sendMagicEffect(CONST_ME_BLOCKHIT)
            return true
        end
    end

    creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
    creature:getPosition():sendMagicEffect(CONST_ME_POFF)
    return false
end
Lua:
local dead_human = {
  3058, 3059, 3060, 3061, 3064, 3065, 3066
}
local removeLimit = 10
function onCastSpell(creature, var, isHotkey)
  local position = Variant.getPosition(var)
  local tile = position:getTile()
  local object = tile and tile:getTopVisibleThing()
  if object and not object:isCreature() then
      local removedCount = 0
      while not isInArray(dead_human, object.itemid)
          and object:getType():isMovable()
          and object.uid > 65535
          and object.actionid == 0
          and removedCount < removeLimit
      do
          object:remove()
          object = tile:getTopVisibleThing()
          removedCount = removedCount + 1
      end
      if removedCount > 0 then
          position:sendMagicEffect(CONST_ME_BLOCKHIT)
          return true
      end
  end

  creature:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
  creature:getPosition():sendMagicEffect(CONST_ME_POFF)
  return false
end
 
Back
Top