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

[TFS 1.2] Guildhalls count as regular houses

guiismiti

Well-Known Member
Joined
May 19, 2014
Messages
315
Solutions
3
Reaction score
68
Hello,

I'm using TFS 1.2 and I'm having a couple of problems with guildhalls and houses.

Any player can buy guildhalls, doesn't matter if it is a guild leader or not.
Players are not able to buy guildhalls if they already own a normal house - guild leaders should be able to buy a guildhall while owning a regular house.

Also, is there a way to allow only one house per account?
This solution is from 2008, so, I don't know if it still works for TFS 1.2 (I'm gonna try it today)
https://otland.net/threads/house-limits-per-account.5529/
 
Hello,

I'm using TFS 1.2 and I'm having a couple of problems with guildhalls and houses.

Any player can buy guildhalls, doesn't matter if it is a guild leader or not.
Players are not able to buy guildhalls if they already own a normal house - guild leaders should be able to buy a guildhall while owning a regular house.

Also, is there a way to allow only one house per account?
This solution is from 2008, so, I don't know if it still works for TFS 1.2 (I'm gonna try it today)
https://otland.net/threads/house-limits-per-account.5529/

Did you click on the guildhall option when you made the guildhall in the mapeditor?
 
Did you click on the guildhall option when you made the guildhall in the mapeditor?

Yes

This is part of my house.xml
As you can see, the guildhalls have the key guildhall="true", which was set by RME.

Code:
    <house name="Radiant Plaza 1" houseid="1895" entryx="32771" entryy="31224" entryz="7" rent="5620" townid="13" size="120" />
    <house name="Radiant Plaza 2" houseid="1896" entryx="32770" entryy="31222" entryz="7" rent="3820" townid="13" size="87" />
    <house name="Radiant Plaza 3" houseid="1897" entryx="32766" entryy="31224" entryz="7" rent="4900" townid="13" size="112" />
    <house name="Radiant Plaza 4" houseid="1898" entryx="32769" entryy="31231" entryz="7" rent="7460" townid="13" size="176" />
    <house name="Sun Palace" houseid="1899" entryx="32760" entryy="31209" entryz="7" rent="23120" guildhall="true" townid="13" size="458" />
    <house name="Halls of Serenity" houseid="1900" entryx="32776" entryy="31165" entryz="7" rent="23360" guildhall="true" townid="13" size="427" />
    <house name="Cascade Towers" houseid="1901" entryx="32844" entryy="31192" entryz="7" rent="19500" guildhall="true" townid="13" size="313" />
 
Im looking this for othire :(
@Peonso this talk about guilhouse bug at othire everthying is good excluding, that guild leaders could own a house if he already owns a guildhouse and vice versa
 
Let me know how this works, written on the fly & untested.

houses.cpp
inside Houses::loadHousesXML
below house->setName(houseNode.attribute("name").as_string()); add house->setGuildHall(houseNode.attribute("guildhall").as_bool());

houses.h
below std::string ownerName; add bool guildHall = false;
below
C++:
        void setName(std::string houseName) {
            this->houseName = houseName;
        }
        const std::string& getName() const {
            return houseName;
        }
add
C++:
        void setGuildHall(bool gh) {
            this->guildHall = gh;
        }
        const bool isGuildHall() const {
            return guildHall;
        }

luascript.cpp
below registerMethod("House", "getRent", LuaScriptInterface::luaHouseGetRent); add registerMethod("House", "isGuildHall", LuaScriptInterface::luaHouseIsGuildHall);
under
C++:
int LuaScriptInterface::luaHouseGetRent(lua_State* L)
{
    // house:getRent()
    House* house = getUserdata<House>(L, 1);
    if (house) {
        lua_pushnumber(L, house->getRent());
    } else {
        lua_pushnil(L);
    }
    return 1;
}
add
C++:
int LuaScriptInterface::luaHouseIsGuildHall(lua_State* L)
{
    // house:isGuildHall()
    House* house = getUserdata<House>(L, 1);
    if (house) {
        pushBoolean(L, house->isGuildHall());
    } else {
        lua_pushnil(L);
    }
    return 1;
}

luascript.h
under static int luaHouseGetRent(lua_State* L); add static int luaHouseIsGuildHall(lua_State* L);

talkactions/buyhouse.lua
before house:setOwnerGuid(player:getGuid()) add
Lua:
    if not player:getGuild() and house:isGuildHall() then
        player:sendCancelMessage("You must be in a guild to buy a guild hall.")
        return false
    end
 
Last edited:
Just missing a ; here:
C++:
        pushBoolean(L, house->isGuildHall())
It's possible to show the guild name instead player name when you click on the door of the guildhall?
 
Last edited:
Just missing a ; here:
C++:
        pushBoolean(L, house->isGuildHall())
It's possible to show the guild name instead player name when you click on the door of the guildhall?
Possible? Yes. I can write the code for it later. But does that code work for now?
 
I think so, I compiled without problems and I can only buy a guildhall if I'm in a guild

EDIT: I don't want to abuse your goodwill but it wouldn't be possible for only guild leaders to buy a guildhall? it would be problematic if all players in the same guild bought all the guildhalls

EDIT 2: I delete the guild but the player keeps the house
 
Last edited:
Back
Top