ond
Veteran OT User
.:: Rookgaard System ::.
"LUA Scripts"
Make a pull-request on the git?.:: Rookgaard System ::.
"LUA Scripts"
https://otland.net/threads/your-first-open-tibia-server.140934/Bro please im very noob making this how and wich software i need use to do this ? explain me please if u have time thanks
u can always edit actions liblooking for script, ladder/rope hole not clickable/ropeable if something blocks it
where i can download spr editor for 7.7 ? i looking on forum and no see ;/
looking for script, ladder/rope hole not clickable/ropeable if something blocks it
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, dont work with field or any item placed on the ladderYou 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
http://pastebin.com/zLZbH1BF , only thing i foundtopOrder is proably wrong in Game::getInternalThing(...), what is it on currently?
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?
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
}