RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[2.0 RC1, 1.0 Final] Knives' TownHouses 2.0

Tmloyd

Wanderer
Greetings and salutations. This system has been vital to my server up to now, and I really want to thank you for creating it. It's a stupendous piece of work.

I need to make a small edit, however. A facet of my server requires that spawned mobiles, spawned by an XmlSpawner, be able to hang out in a TownHouse !Controlled and ControlMaster == null. Yet, they seem to delete occasionally, especially on a worldsave; the World Controller doesn't seem to be doing this. Any ideas? It only happens in the TownHouse zone, so I presume it is tied to this somehow.
 

Tabion

Sorceror
I think that is handled is basehouse.cs, under HasAccess. Check around the lines in the 33oo's range. Also take this with a grain of salt, I'm still learning
 

Tmloyd

Wanderer
As a followup, it appears there was a line in BaseCreature.cs's LoyaltyTimer that checked to see if the creature was uncontrolled in a HouseRegion, and subsequently deleted it. I put in a check to make sure the creature isn't of the type that I am trying to preserve, and that did the trick.
 

Nockar

Sorceror
GREAT SYSTEM!!!!

I am having one small issue though.

I read through all 12 pages and only saw this mentioned once but I didn't see a fix. When my players try purchase a house it says "You can not purchase this house". The only way I have been able to get around this is to make the char staff for a moment, let them claim the house and then demote them back to a player. Is there a code fix for this to allow the players more than one house I already have it set for multiple houses per account for regualr houses.

Anyone know how to resolve this??? I am having the exact same thing happen.
“You can not purchase this house”
 

Pure Insanity

Sorceror
From the looking at the script and BaseHouse.cs I'm betting that you only have this issue when another player already has at least one house. Seems that it calls the HasAccountHouse before allowing them to purchase a town house. And HasAccountHouse will always return true in it's current form, if the player has one house. Even if they can in fact own more houses than that. Seems like an easy way to fix this would be to edit this method, or the original method in the actual town house sign script (could make it use your own method to see if they are at their max houses, instead of using the basehouse methods) or just simply edit the basehouse method, or even add a new method such as...CanBuyAnotherHouse() since changing the original method might make some other things mess up.

Code:
public static bool HasHouse( Mobile m )
        {
            if ( m == null )
                return false;

            List<BaseHouse> list = null;
            m_Table.TryGetValue( m, out list );

            if ( list == null )
                return false;

            for ( int i = 0; i < list.Count; ++i )
            {
                BaseHouse h = list[i];

                if ( !h.Deleted )
                    return true;
            }

            return false;
        }

This is the bit of code from basehouse that will always return true if the mobile has one house, thus not allowing them to purchase a new town house. Although this method is actually called from the HasAccountHouse(). I suggest just looking in the file to see for yourself. There would be a few ways to fix it. Honestly, I don't see why it's made to work like this to begin with (town houses that is.) Can't believe no one has ever complained about this before in the past...or has BaseHouse changed in the past year or so?
 

Nockar

Sorceror
From the looking at the script and BaseHouse.cs I'm betting that you only have this issue when another player already has at least one house. Seems that it calls the HasAccountHouse before allowing them to purchase a town house. And HasAccountHouse will always return true in it's current form, if the player has one house. Even if they can in fact own more houses than that. Seems like an easy way to fix this would be to edit this method, or the original method in the actual town house sign script (could make it use your own method to see if they are at their max houses, instead of using the basehouse methods) or just simply edit the basehouse method, or even add a new method such as...CanBuyAnotherHouse() since changing the original method might make some other things mess up.

Thanks for the info.
Before your post I did some searching about basehouse.cs and found some info about what you were saying.

What I ended up doing was changing this line from 0 to some other number.
0 = 1 house
1 = 2 houses
2 = 3 houses
etc
I have not tested it yet in game but I think it’ll work.

Code:
            for ( int i = 0; i < list.Count; ++i )
to
            for ( int i = 3; i < list.Count; ++i )
 

Pure Insanity

Sorceror
Try this...Just replace the entire loop, make sure the m_HouseCount deceleration is pasted also.

Code:
int m_HouseCount = 0;
for ( int i = 0; i < list.Count; ++i )
            {
                BaseHouse h = list[i];

                if ( !h.Deleted )
                    m_HouseCount += 1;
                
                if( m_HouseCount > 4 ) //Should be 1 less than your house cap.
                    return true;
            }

Note, this should make your town houses work without having to do what was mentioned above. Although I'm not sure what effect it will have on the default house system. Which is why I suggest just replacing the method call completely with your own, so it doesn't need to reference the basehouse file for that. Which also means no distro edit needed, which most people prefer to avoid. Also doing it this way means it would have to be changed any time you decide to change your house limit. Let me know if it works.
 
Code:
Errors:
+ Custom/Town Houses v2.01/Misc/GumpResponse.cs:
    CS0266: Line 28: Cannot implicitly convert type 'System.Collections.Generic.
IEnumerable<Server.Gumps.Gump>' to 'System.Collections.Generic.List<Server.Gumps
.Gump>'. An explicit conversion exists (are you missing a cast?)
+ Custom/Ultima Paintball 1.2.0/PBGameItem.cs:
    CS0117: Line 552: 'System.Collections.Generic.List<Server.SkillName>' does n
ot contain a definition for 'Length'
+ Custom/Ultima Paintball 1.2.0/PBPlayerStorage.cs:
    CS0117: Line 72: 'System.Collections.Generic.List<Server.SkillName>' does no
t contain a definition for 'Length'

How to fix?
 
Ah, I've seen this error before. Try changing Length to Count ;)

Oops, sorry. Didnt notice I also posted the paintball errors.

Need help with this error:
Code:
Errors:
+ Custom/Town Houses v2.01/Misc/GumpResponse.cs:
    CS0266: Line 28: Cannot implicitly convert type 'System.Collections.Generic.
IEnumerable<Server.Gumps.Gump>' to 'System.Collections.Generic.List<Server.Gumps
.Gump>'. An explicit conversion exists (are you missing a cast?)
 
Ok, I seem to have fixed that error. However I now have an error with deleting the townhouses. Everything freezes up and then the server crashes.
 
Ok, I seem to have fixed that error. However I now have an error with deleting the townhouses. Everything freezes up and then the server crashes.

How you fixed it? Would be nice to know...
Trying to get the TownHouses to work on Neruns Distro + RunUO 2.1
 
Top