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

[7.72] OTHire 0.0.1b - Based in OTServ Trunk (Latest)

looking for script, ladder/rope hole not clickable/ropeable if something blocks it
 
looking for script, ladder/rope hole not clickable/ropeable if something blocks it

IIRC, Avestas rope-script works like you describes it. Haven't tested it myself recently:

Code:
function onUse(cid, item, frompos, item2, topos)
    if(topos.x == 0 and topos.y == 0 and topos.z == 0) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        return false
    end
   
    topos.stackpos = 255
    local tmp = getThingFromPos(topos)
    if (tmp.itemid ~= 0) then
        return false
    end
   
    topos.stackpos = 254
    local field = getThingFromPos(topos)
    if (field.itemid ~= 0) then
        return false
    end
   
    newPos = {x = topos.x, y = topos.y, z = topos.z, stackpos = 0}
    groundItem = getThingFromPos(newPos)
    if (isIntegerInArray(ROPE_SPOT, groundItem.itemid)) then
        newPos.y = newPos.y + 1
        newPos.z = newPos.z - 1
        doTeleportThing(cid, newPos)
    elseif (isIntegerInArray(OPENED_HOLE, groundItem.itemid) or isIntegerInArray(OPENED_TRAP, groundItem.itemid) or isIntegerInArray(DOWN_LADDER, groundItem.itemid)) then
        newPos.y = newPos.y + 1
        downPos = {x = topos.x, y = topos.y, z = topos.z + 1, stackpos = 255}
        downItem = getThingFromPos(downPos)
        if (downItem.itemid > 0) then
            doTeleportThing(downItem.uid, newPos)
        else
            doPlayerSendCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        end
    else
        return false
    end
   
    return true
end
 
IIRC, Avestas rope-script works like you describes it. Haven't tested it myself recently:

Code:
function onUse(cid, item, frompos, item2, topos)
    if(topos.x == 0 and topos.y == 0 and topos.z == 0) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        return false
    end
  
    topos.stackpos = 255
    local tmp = getThingFromPos(topos)
    if (tmp.itemid ~= 0) then
        return false
    end
  
    topos.stackpos = 254
    local field = getThingFromPos(topos)
    if (field.itemid ~= 0) then
        return false
    end
  
    newPos = {x = topos.x, y = topos.y, z = topos.z, stackpos = 0}
    groundItem = getThingFromPos(newPos)
    if (isIntegerInArray(ROPE_SPOT, groundItem.itemid)) then
        newPos.y = newPos.y + 1
        newPos.z = newPos.z - 1
        doTeleportThing(cid, newPos)
    elseif (isIntegerInArray(OPENED_HOLE, groundItem.itemid) or isIntegerInArray(OPENED_TRAP, groundItem.itemid) or isIntegerInArray(DOWN_LADDER, groundItem.itemid)) then
        newPos.y = newPos.y + 1
        downPos = {x = topos.x, y = topos.y, z = topos.z + 1, stackpos = 255}
        downItem = getThingFromPos(downPos)
        if (downItem.itemid > 0) then
            doTeleportThing(downItem.uid, newPos)
        else
            doPlayerSendCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        end
    else
        return false
    end
  
    return true
end

tested it and item on rope hole works, not sure how to fix the ladder tho
 
You mean by ladders if there is a item down under the ladder you cannot go up? if so test with fields aswell if you can confirm this I can post a fix for it.
 
You mean by ladders if there is a item down under the ladder you cannot go up? if so test with fields aswell if you can confirm this I can post a fix for it.
tested, dont work with field or any item placed on the ladder
 
Are you loading 7.4 dat? Anyway, try change:

Code:
Item* topOrderItem =  tile->getItemByTopOrder(2);

to

Code:
Item* topOrderItem =  tile->getItemByTopOrder(1);
 
Probably this will fix the tag "canpushitems" in monsters.

Change the function in monster.cpp
Code:
void Monster::pushItems(Tile* tile)
{
    //We can not use iterators here since we can push the item to another tile
    //which will invalidate the iterator.
    //start from the end to minimize the amount of traffic
    if(TileItemVector* items = tile->getItemList()){
        uint32_t moveCount = 0;
        uint32_t removeCount = 0;
        int32_t downItemSize = tile->getDownItemCount();

        for(int32_t i = downItemSize - 1; i >= 0; --i){
            assert(i >= 0 && i < downItemSize);
            Item* item = items->at(i);
            if(item && item->hasProperty(MOVEABLE) && (item->hasProperty(BLOCKPATH)
                || item->hasProperty(BLOCKSOLID))){
                    if(moveCount < 20 && pushItem(item, 1)){
                        moveCount++;
                    }
                    else if(g_game.internalRemoveItem(item) == RET_NOERROR){
                        ++removeCount;
                    }
            }
        }

        if(removeCount > 0){
            g_game.addMagicEffect(tile->getPosition(), NM_ME_PUFF);
        }
    }
}

For this one:
Code:
void Monster::pushItems(Tile* tile)
{
    //We can not use iterators here since we can push the item to another tile
    //which will invalidate the iterator.
    //start from the end to minimize the amount of traffic
    if(TileItemVector* items = tile->getItemList()){
        uint32_t moveCount = 0;
        uint32_t removeCount = 0;
        int32_t downItemSize = tile->downItems.size();

        for(int32_t i = downItemSize - 1; i >= 0; --i){
            assert(i >= 0 && i < (int32_t)tile->downItems.size());
            Item* item = tile->downItems[i];
            if(item && item->hasProperty(MOVEABLE) && (item->hasProperty(BLOCKPATH)
                || item->hasProperty(BLOCKSOLID))){
                    if(moveCount < 20 && pushItem(item, 1)){
                        moveCount++;
                    }
                    else if(g_game.internalRemoveItem(item) == RET_NOERROR){
                        ++removeCount;
                    }
            }
        }

        if(removeCount > 0){
            g_game.addMagicEffect(tile->getPosition(), NM_ME_PUFF);
        }
    }
}

They can push parcels & pots, how would i do if i want them to push these for example?

D8XuCl1.png
 
They can push parcels & pots, how would i do if i want them to push these for example?

IIRC, Ezzz made a temporare solution for this. Not sure if it has any side-effects on anything else, but here's what he posted:

In creature.cpp - change function:

void Creature::updateTileCache(const Tile* tile, int32_t dx, int32_t dy)

to

Code:
void Creature::updateTileCache(const Tile* tile, int32_t dx, int32_t dy)
{
    if((std::abs(dx) <= (mapWalkWidth - 1) / 2) &&
        (std::abs(dy) <= (mapWalkHeight - 1) / 2)){

        int32_t x = (mapWalkWidth - 1) / 2 + dx;
        int32_t y = (mapWalkHeight - 1) / 2 + dy;

        if (getMonster())
        {
            localMapCache[y][x] = (tile && tile->__queryAdd(0, this, 1,
                FLAG_PATHFINDING | FLAG_IGNOREFIELDDAMAGE | FLAG_IGNOREBLOCKITEM) == RET_NOERROR);
        }
        else
        {
            localMapCache[y][x] = (tile && tile->__queryAdd(0, this, 1,
                FLAG_PATHFINDING | FLAG_IGNOREFIELDDAMAGE) == RET_NOERROR);
        }
    }
#ifdef __DEBUG__
    else{
        std::cout << "Creature::updateTileCache out of range." << std::endl;
    }
#endif
}
 
cannot open data/npc/scripts/data/npc/scripts/default.lua: No such file or directory

why i have this error in console ?
 
Attack speed set in vocations.xml doesn't seem to be working properly. I tried putting it to fast attack but it hits twice and then there's some sort of exhausted. Where in the source can I find this issue?
 
Back
Top