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

C++ Tfs 0.4 housedoor

GOD Wille

Excellent OT User
Joined
Jan 11, 2010
Messages
2,826
Solutions
2
Reaction score
815
Location
Sweden
Where does a housedoor get "refreshed" in sourcecode [tfs 0.4] C++? If you with lua remove a housedoor ingame, and then add a new door, where you then set the new house's doorid to the same as the previous, it is not until you close or open the door once, that the;

1. Description gets set from "You see a door" to "You see a door, owner is X..." .
2. You can use aleta grav, on the door.

How do I refresh it without having to open/close the door?

Code:
-- house door when server starts, save door id
local door = getItemAttribute(item.uid,"doorid") 
 
-- remove and create a new door because u want to switch out the item id of the housedoor
doRemoveItem(item.uid)
doCreateItem(array.walls.door[i],pos)

-- add house door id to the newly created door
doItemSetAttribute(getThingFromPos(pos).uid,"doorid",door)
Code:
Door* door = house->getDoorByPosition(getNextPosition(player->getDirection(), player->getPosition()));
        if(door && house->canEditAccessList(door->getDoorId(), player))
        {
                std::cout << "Doorid" << door->getDoorId() << std::endl;
                player->setEditHouse(house, door->getDoorId());
                player->sendHouseWindow(house, door->getDoorId());
                g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_WRAPS_BLUE);
        }
        else
        {
                std::cout << "Door" << door << std::endl;
                player->sendCancelMessage(RET_NOTPOSSIBLE);
                g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
        }

        return false;
}

Door prints 0 before opening/closing it once.
 
Last edited:
Back
Top