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

House-saves items door doesn't show house info

robbydeath

Well-Known Member
Joined
Feb 11, 2008
Messages
495
Reaction score
92
Location
washington state
I'm wondering if anyone knows what the problem might be... I got the items saving on reset and invitation system working for the house but still the door when examined doesn't show it belongs to anyone.
"You see closed/open door"
Do I need to create an action for this? If so one for EACH house? (doesn't sound right)
Or make entire new doors for houses only? (doesn't sound right)
I must be missing something.
Any ideas?
It's been a long time since I've played with my files. Thanks a lot for any suggestion.
By the way, this is oldschool Avesta 0.6.5

Does anyone see anything in this that might be causing the problem?
Also /buyhouse is not working. But /owner does work, after I make someone owner they are able to save items/invite people inside.
But when examining the door "You see a closed/open door"
Also /buyhouse not working

Code:
--[[ House Class 0.2.1 Nostradamus & Pedro B. --]]
-- House constants
CONST_GUEST_LIST = 256
CONST_SUBOWNER_LIST = 257

-- Internal use
LIST_FIRST = CONST_GUEST_LIST
LIST_LAST = CONST_SUBOWNER_LIST


local HOUSE_CONFIG =
{
    tilePrice    = 100, -- in GPs
    needPremium = false -- need premium to buy houses? true/false
}
  
House = {
    id = 0
}

-- Constructor of the class
function House:New(o)
    local o = o or {}
    setmetatable(o, self)
    self.__index = self
    return o
end

    -- Independent functions
    function House.getHouseByOwnerGUID(guid)
        local houseID = getHouseByPlayerGUID(guid)
        if(houseID == nil) then
            return nil
        end

        local h = House:New()
        h:setID(houseID)
        return h
    end

    function House.getHouseByOwner(cid)
        if(isPlayer(cid) == FALSE) then
            error('House.getHouseByOwner(): Player not found!')
            return nil
        end

        local playerGUID = getPlayerGUID(cid)
        return House.getHouseByOwnerGUID(playerGUID)
    end

    function House.getHouseByPos(pos)
        if(type(pos) ~= 'table') then
            error('House.getHouseByPos(): parameter must be a table!')
            return nil
        end

        local houseID = getTileHouseInfo(pos)
        if(houseID == 0) then
            return nil
        end

        local h = House:New()
        h:setID(houseID)
        return h
    end

    -- Functions that uses 'self'
    function House:getID()
        return self.id
    end

    function House:setID(id)
        self.id = id
    end

    function House:getOwner()
        if(tonumber(self.id) == 0) then
            error('House:getOwner(): House ID not set!')
        end

        return getHouseOwner(self.id)
    end

    function House:getName()
        if(tonumber(self.id) == 0) then
            error('House:getName(): House ID not set!')
        end

        return getHouseName(self.id)
    end

    function House:getEntry()
        if(tonumber(self.id) == 0) then
            error('House:getEntry(): House ID not set!')
        end

        return getHouseEntry(self.id)
    end

    function House:getRent()
        if(tonumber(self.id) == 0) then
            error('House:getRent(): House ID not set!')
        end

        return getHouseRent(self.id)
    end

    function House:getTown()
        if(tonumber(self.id) == 0) then
            error('House:getTown(): House ID not set!')
        end

        return getHouseTown(self.id)
    end

    function House:getAccessList(listid)
        local listid = tonumber(listid)
        if(tonumber(self.id) == 0) then
            error('House:getAccessList(): House ID not set!')
        end

        if(listid < LIST_FIRST or listid > LIST_LAST) then
            error('House:getAccessList(): Wrong List ID!')
        end

        return getHouseAccessList(self.id, listid)
    end

    function House:getSize()
        if(tonumber(self.id) == 0) then
            error('House:getSize(): House ID not set!')
        end

        return getHouseTilesSize(self.id)
    end

    function House:getPrice()
        if(tonumber(self.id) == 0) then
            error('House:getPrice(): House ID not set!')
        end

        return HOUSE_CONFIG.tilePrice * self:getSize()
    end

    function House:setAccessList(listid, listtext)
        local listid = tonumber(listid)
        local text = tostring(listtext)
        if(tonumber(self.id) == 0) then
            error('House:setAccessList(): House ID not set!')
        end

        if(listid < LIST_FIRST or listid > LIST_LAST) then
            error('House:setAccessList(): Wrong List ID!')
        end

        return setHouseAccessList(self.id, listid, text)
    end

    function House:setOwner(guid)
        local guid = tonumber(guid)
        if(tonumber(self.id) == 0) then
            error('House:setOwner(): House ID not set!')
        end

        return setHouseOwner(self.id, guid)
    end

    -- Buy function for the house
    function House:buy(cid)
        if(tonumber(self.id) == 0) then
            error('House:buy(): House ID not set!')
            return false
        end

        local cid = tonumber(cid)
        if(isPlayer(cid) == FALSE) then
            error('House:buy(): Player does not exist!')
            return false
        end

        local housePrice = self:getPrice()
        local guid = getPlayerGUID(cid)
        local playerOwnHouse = (House.getHouseByOwnerGUID(guid) ~= nil)

        if(playerOwnHouse) then
            doPlayerSendCancel(cid, 'You already own a house.')
            return false
        end

        if(HOUSE_CONFIG.needPremium and isPremium(cid) == FALSE) then
            doPlayerSendCancel(cid, 'Only premium players are able to buy a house.')
            return false
        end

        if(doPlayerRemoveMoney(cid, housePrice) == FALSE) then
            doPlayerSendCancel(cid, 'You do not have enough money.')
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Price: ' ..

housePrice .. '.')
            return false
        end

        self:setOwner(guid)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have bought

the house ' .. self:getName() .. '.')
        return true
    end

Does the house ID need to be set to something? so confusing... been trying so many things the past 2 days
 
Last edited:
that's the file and it's not working .. I tried all sorts of stuff to fix it, no luck.
including deleting/adding a lot
I'm trying to fix the houses on the server I'm trying to make decent
(maybe the file is working, maybe its something else.)
I can't really post a script if I don't know what one is not working.
The house.xml corresponds with the map editor names and town ID's.
Loads up fine on the server no errors
Houses are physically there, they save items, i can do /owner to create an owner.
But when I examine the door, its "You see a closed/open door"
I would really like "You see Loot Lane 1 owner is ___"
and also /buyhouse does not work.
Thanks for the reply
I should add I believe Buyhouse and possibly the door information are in the script i posted but not sure. It's the only house script I could find. Maybe the problem is in the sql db, I have houses and it also corresponds with the house.xml. However, I don't have any tables in House_Lists. I don't know if I should have anything in there or not. That could very well be the problem.
 
Last edited:
Do you know what 0 means in this script?
Top one looks like its missing something

Code:
"House = {
id = 0"

Code:
"local houseID = getTileHouseInfo(pos)
if(houseID == 0) then
return nil
end"
 
Last edited:
Bump
The correct door entrance coordinates are set, still /buyhouse doesn't work. says "you must be infront of the house you want to buy" EVEN when I'm facing the correct location. When door examined "you see closed/open door" But I can set/owner and save items inside, invite others, just like a normal house.
Maybe something in the sources... Nobody knows huh :(
I am out of things to try lol

Code:
<?xml version="1.0" encoding="UTF-8"?>
<houses>
  <house name="Thais house 1" houseid="1" entryx="32359" entryy="32228" entryz="7" rent="0" townid="3" size="14"/>
</houses>
 
Buyhouse is working now, the only thing wrong with the house now is that anyone can open/close the door, and when you examine the house it shows "you see a door"
Any ideas what file references the house owner/name to the housedoor?
Thanks
 
Back
Top