• 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 Ladder bug when any item is below

ondrake

Member
Joined
Dec 5, 2008
Messages
70
Solutions
1
Reaction score
6
Hello! I'm having a strange problem and i hope you guys can help me.

I found out that the ladders cannot be used when there's any item below them or fire.
using OThire GitHub - TwistedScorpio/OTHire: OpenTibia Server for Tibia 7.72 ultimate version no modified, linux debian 7 and 8
I already reported on github but the creators did not respond.
I already checked the items.otb with the item editor and object build this normal.

35829447-a616ee5a-0aa1-11e8-99b0-3f51ddb7e34b.png


35787342-12e5ead6-0a0c-11e8-9ad8-0de97c37dc31.png



function onUse(cid, item, frompos, item2, topos)
newPos = {x = frompos.x, y = frompos.y, z = frompos.z}
if (isInArray(LADDER, item.itemid) ) then
newPos.y = newPos.y + 1
newPos.z = newPos.z - 1
doTeleportThing(cid, newPos)
else
newPos.z = newPos.z + 1
doTeleportThing(cid, newPos)
end
return true
end
 
I found the error, in the parcel trap that I had added
game.cpp


Code:
//the first down item is usually the right item unless there is topOrder items with scripts
                Item* downItem = tile->getTopDownItem();

                //check items with topOrder 2 (ladders, signs, splashes)
                Item* topOrderItem =  tile->getItemByTopOrder(2);
                if(topOrderItem && g_actions->hasAction(topOrderItem) ){
                    const ItemType& it = Item::items[topOrderItem->getID()];
                    //if the top order item has a height or allows pickupable items we use the first down item instead
                    if(!(downItem && (it.hasHeight || it.allowPickupable))){
                        thing = topOrderItem;
                    }
                }

                if(thing == NULL){
                    //first down item
                    thing = downItem;
                }

                if(thing == NULL){
                    //then items with topOrder 3 (doors etc)
                    thing = tile->getTopTopItem();
                }

                if(thing == NULL){
                    //and finally the ground
                    thing = tile->ground;
                }
            }
            else{
                thing = tile->__getThing(index);
            }
 
Back
Top