Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If monster is 1 square above push
#1
Hello,

How would this be accomplished?

If monster posx, posy, pos z, then push the monster 1 square up (given the posx, y z ofcouse).

Thank you.

#2
Hello.

I think this code will work.

This code will check if there's a monster "Rat" on Location_FROM X/Y/Z and try to move it to Location_TO X/Y/Z. If there's any item under the monster, it will try to move the items as well.
However, it will NOT check if it's possible to move to Location_TO X/Y/Z, for example, it will not check if there's a field or parcel that would make it impossible to move to.
local SETTINGS = {
    Monster = 'Rat',
    Location_FROM = { X = 32346, Y = 32217, Z = 7 },
    Location_TO = { X = 32345, Y = 32217, Z = 7 },
}

SETTINGS.Monster = SETTINGS.Monster:lower()

local creatures = getcreatures('mfs')

for _, creature in ipairs(creatures) do
    if creature.name:lower() == SETTINGS.Monster and creature.posx == SETTINGS.Location_FROM.X and creature.posy == SETTINGS.Location_FROM.Y and creature.posz == SETTINGS.Location_FROM.Z then
        local monster = creature
        while monster.posx == SETTINGS.Location_FROM.X and monster.posy == SETTINGS.Location_FROM.Y and monster.posz == SETTINGS.Location_FROM.Z do
            local tile = gettile(SETTINGS.Location_FROM.X, SETTINGS.Location_FROM.Y, SETTINGS.Location_FROM.Z)
            if tile.hascreature and tile.itemcount > 1 then
                moveitems(tile.topitem.id, ground(SETTINGS.Location_TO.X, SETTINGS.Location_TO.Y, SETTINGS.Location_TO.Z), ground(SETTINGS.Location_FROM.X, SETTINGS.Location_FROM.Y, SETTINGS.Location_FROM.Z), 100)
                wait(1000)
            else
                break
            end
            monster = getcreature(creature.id)
        end
    end
end

This script works pretty much like the above, but it will move any creature (monster/player) that's on the specific sqm.
local SETTINGS = {
    Location_FROM = { X = 32346, Y = 32217, Z = 7 },
    Location_TO = { X = 32345, Y = 32217, Z = 7 },
}

SETTINGS.Monster = SETTINGS.Monster:lower()

local creatures = getcreatures('pmfs')

for _, creature in ipairs(creatures) do
    if creature.posx == SETTINGS.Location_FROM.X and creature.posy == SETTINGS.Location_FROM.Y and creature.posz == SETTINGS.Location_FROM.Z then
        local monster = creature
        while monster.posx == SETTINGS.Location_FROM.X and monster.posy == SETTINGS.Location_FROM.Y and monster.posz == SETTINGS.Location_FROM.Z do
            local tile = gettile(SETTINGS.Location_FROM.X, SETTINGS.Location_FROM.Y, SETTINGS.Location_FROM.Z)
            if tile.hascreature and tile.itemcount > 1 then
                moveitems(tile.topitem.id, ground(SETTINGS.Location_TO.X, SETTINGS.Location_TO.Y, SETTINGS.Location_TO.Z), ground(SETTINGS.Location_FROM.X, SETTINGS.Location_FROM.Y, SETTINGS.Location_FROM.Z), 100)
                wait(1000)
            else
                break
            end
            monster = getcreature(creature.id)
        end
    end
end

#3
Thank you so much! It works.

Thank you for the great support
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Big Grin" title="Big Grin" class="smilie smilie_4" />



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016