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!

(Severly) restricting house placement

Fresshness

Wanderer
(Severly) restricting house placement

The way I want house placement to be restricted is severe; I want the players to only be able to place houses in Towns (guarded zones). I think I have found the script that is responsible for this, namely Multis/HousePlacement.cs.

I tried to make some changes, but they did not work. Following the logic, I think the solution has 2 steps:

1) in an earlier stage of the "HousePlacementResult Check" function I made the followin (in red) modification, so that it will not immediatly say the location is invalid just because its situated in town:

Code:
if ( !reg.AllowHousing( from, testPoint ) ) // Cannot place houses in dungeons, towns, treasure map areas etc
{
	if ( reg.IsPartOf( typeof( TreasureRegion ) ) )
		return HousePlacementResult.BadRegionHidden;
							
	[COLOR="Red"]if ( reg.IsPartOf( typeof( TownRegion ) ) )
		continue;  // allow in town placement
	else[/COLOR]
		return HousePlacementResult.BadRegion;
}

However, it does not work. I cannot place houses in town (in addition to placing in regular valid locations).

2) the second part would be the following; at the end of the "HousePlacementResult Check" function, when the location is deemed valid, I would do another check to see if the location is in town. If it is in town, proceed to declare the location valid, if not in town, proceed to declare the location invalid. However, I really have no clue about how to implement this (It would seem, though I might be wrong, that at least some runuo-core knowledge is needed here).

Thanks for any insight you can offer !
 
Fresshness said:
The way I want house placement to be restricted is severe; I want the players to only be able to place houses in Towns (guarded zones). I think I have found the script that is responsible for this, namely Multis/HousePlacement.cs.

I tried to make some changes, but they did not work. Following the logic, I think the solution has 2 steps:

1) in an earlier stage of the "HousePlacementResult Check" function I made the followin (in red) modification, so that it will not immediatly say the location is invalid just because its situated in town:

Code:
if ( !reg.AllowHousing( from, testPoint ) ) // Cannot place houses in dungeons, towns, treasure map areas etc
{
    if ( reg.IsPartOf( typeof( TreasureRegion ) ) )
        return HousePlacementResult.BadRegionHidden;
 
    [COLOR=red]if ( reg.IsPartOf( typeof( TownRegion ) ) )
        continue;  // allow in town placement
    else[/COLOR]
        return HousePlacementResult.BadRegion;
}

However, it does not work. I cannot place houses in town (in addition to placing in regular valid locations).

2) the second part would be the following; at the end of the "HousePlacementResult Check" function, when the location is deemed valid, I would do another check to see if the location is in town. If it is in town, proceed to declare the location valid, if not in town, proceed to declare the location invalid. However, I really have no clue about how to implement this (It would seem, though I might be wrong, that at least some runuo-core knowledge is needed here).

Thanks for any insight you can offer !

Code:
 [COLOR=red]if ( reg.IsPartOf( typeof( TownRegion ) ) )
[/COLOR][SIZE=2]return HousePlacementResult.Valid; 
[/SIZE]
This is just a guess. I haven't tested it.
 

Fresshness

Wanderer
Ah yes, that is a good suggestion thanks.

It is possible, by the looks of it, that further elaborate checking is skipped that way. But for me, that's really not important. I'll check it out and report back here.
 
Fresshness said:
Ah yes, that is a good suggestion thanks.

It is possible, by the looks of it, that further elaborate checking is skipped that way. But for me, that's really not important. I'll check it out and report back here.
You could go into Regions.xml and change the places you want houseplacement to:
<smartNoHousing active="false" />
 
Top