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

BlacKMambA76

Wanderer
great script! thanx a lot, it works for me ;)
But i have a question:

Is it possible to have more than 1 house/account? I tested it and my pg can buy a static townhouse, but after that, i cannot have more houses, townhouses or "custom" houses neither. Where should i change the code to have more houses for 1 account?

Sorry for my bad english :p
 

JerrodWofford

Sorceror
I have an issue when trying to use Knives townhouses 2.0 can anyone tell me how to fix this?

Code:
Errors:
+ Custom/Town Houses v2.01/Items/TownHouse.cs:
    CS0246: Line 10: The type or namespace name 'VersionHouse' could not be foun
d (are you missing a using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

BBraamse

Sorceror
You need to make sure that your TownHouse.cs has a "using Server.BLAHBLAH" at the top which includes whatever namespace VersionHouse uses. Do a search for VersionHouse and see what namespace it uses and try to add that. If you don't find VersionHouse, then you're actually missing that from your scripts entirely.
 

Dreas

Wanderer
Can someone please direct me to where i need to go to change it to take the money from the players backpack rather than the bank.
 
To fix the using System.Collections.Generic; error
worked for me after that

changed lines 28-42
List<Gump> gumps = state.Gumps;

for (int i = 0; i < gumps.Count; ++i)
{
Gump gump = gumps;

if (gump.Serial == serial && gump.TypeID == typeID)
{
int switchCount = pvSrc.ReadInt32();

if (switchCount < 0)
{
Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
state.Dispose();
return;

to lines 28-47
ArrayList gumps = new ArrayList();
foreach (Gump gump in state.Gumps)
gumps.Add(gump);

for (int i = 0; i < gumps.Count; ++i)
{
Gump gump = gumps as Gump;
if (gump == null)
continue;

if (gump.Serial == serial && gump.TypeID == typeID)
{
int switchCount = pvSrc.ReadInt32();

if (switchCount < 0)
{
Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
state.Dispose();
return;
}
 

Vorspire

Knight
To fix the using System.Collections.Generic; error
worked for me after that

changed lines 28-42
List<Gump> gumps = state.Gumps;

for (int i = 0; i < gumps.Count; ++i)
{
Gump gump = gumps;

if (gump.Serial == serial && gump.TypeID == typeID)
{
int switchCount = pvSrc.ReadInt32();

if (switchCount < 0)
{
Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
state.Dispose();
return;

to lines 28-47
ArrayList gumps = new ArrayList();
foreach (Gump gump in state.Gumps)
gumps.Add(gump);

for (int i = 0; i < gumps.Count; ++i)
{
Gump gump = gumps as Gump;
if (gump == null)
continue;

if (gump.Serial == serial && gump.TypeID == typeID)
{
int switchCount = pvSrc.ReadInt32();

if (switchCount < 0)
{
Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
state.Dispose();
return;
}

Use the code tags next time when posting code, you'll notice in your post that the "gumps" reference is now missing [i]

Also, why are you downgrading the code to .Net 1? The server uses List<Gump> for a reason, you should edit the code to use the new features, not downgrade it to work around it...

Here is the correct code:
Rich (BB code):
/*If state.Gumps is ArrayList or List<Gump> - this won't matter, both support ToArray - fix for RunUO 2.0*/
List<Gump> gumps = new List<Gump>((Gump[])state.Gumps.ToArray());

for (int i = 0; i < gumps.Count; ++i)
{
	Gump gump = gumps[i];

	if (gump.Serial == serial && gump.TypeID == typeID)
	{
		int switchCount = pvSrc.ReadInt32();

		if (switchCount < 0)
		{
			Console.WriteLine("Client: {0}: Invalid gump response, disconnecting...", state);
			state.Dispose();
			return;
		}

/*Code Continues*/
 

psychotic

Traveler
help for this Errors:
+ Custom/Town Houses v2.01/Items/TownHouse.cs: CS0246: Line 10: The type or namespace name 'VersionHouse' could not be foun d (are you missing a using directive or an assembly reference?) Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again. OR CAN SOMEONE PLEASE PUT A NEW TOWN HOUSE SCRIPT UP PLEASE ..
 

KnitePrince

Sorceror
Does this still crash the shard when you try to remove, disown, or delete the townhouse ?? last I knew it was only fixable with core mods and recompiling the core.... I have it installed on my shard and am STUCK with multiple townhouses and no way to get rid of them except transferring them to my admin character, removing all but the sign and then making it invisible :( If that is still the case then yall should be warned.. if its been fixed then please let me know so i can re install this and once again use the townhouse! Thx!!!
 

KnitePrince

Sorceror
really? Sweet! What version are you running? I'll DL this again and compare it to what I have..
Nope.. installed the patch, and went to an existing sign.. one of about 20 I have invizzed, and clicked on it to demolish the house;

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Map.RemoveMulti(BaseMulti m, Sector start, Sector end)
at Server.Map.OnLeave(Item item)
at Server.Item.Delete()
at Server.Gumps.HouseDemolishGump.OnResponse(NetState state, RelayInfo info)
at Knives.TownHouses.GumpResponse.DisplayGumpResponse(NetState state, PacketReader pvSrc) at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)

perhaps I am doing something wrong? running it on 2.0 RC1.. its done this for over two years now. Id certainly love to hear how im an idiot and all it takes is something simple I have overlooked.
 

Death X

Sorceror
I made one of the suggested changes above (by Vospire) after getting the generic error and now getting this error:

Error 1 'System.Collections.Generic.IEnumerable<Server.Gumps.Gump>' does not contain a definition for 'ToArray' and no extension method 'ToArray' accepting a first argument of type 'System.Collections.Generic.IEnumerable<Server.Gumps.Gump>' could be found (are you missing a using directive or an assembly reference?) C:\RunUO_Scripts\RunUO_Scripts\Scripts\Town Houses v2.01\Misc\GumpResponse.cs 29 67 RunUO_Scripts

Any insight?
 

jamesreg

Sorceror
i am getting the following errors on compile
Code:
RunUO - [www.runuo.com] Version 2.2, Build 4427.13308
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 64-bit processors
Scripts: Compiling C# scripts...failed (1 errors, 2 warnings)
Warnings:
+ Items/Addons/BaseAddonContainer.cs:
    CS0108: Line 41: 'Server.Items.BaseAddonContainer.Resource' hides inherited
member 'Server.Items.BaseContainer.Resource'. Use the new keyword if hiding was
intended.
+ Expansions/Stygian Abyss/SA Mobiles/SA Peerless/SlasherOfVeils.cs:
    CS0114: Line 115: 'Server.Mobiles.SlasherOfVeils.FireRing()' hides inherited
member 'Server.Mobiles.BasePeerless.FireRing()'. To make the current member ove
rride that implementation, add the override keyword. Otherwise add the new keywo
rd.
Errors:
+ Custom Systems/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?)
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

jamesreg

Sorceror
I got a question whenever I demolish a townhouse a big stone appears outside whats that about.

Also im trying to set inscription as the required skill to own a townhouse and its saying its an invalid skill
 

Pure Insanity

Sorceror
The stone is to give other players a chance to get a plot after a house has been demolished, if you don't like it. It's easy to find and prevent it from adding.

As for the other part, not sure as I've never restricted a town house to a skill.
 

jamesreg

Sorceror
First I want to say this is one of the coolest scripts I have ever tested on here. Great job

Has this been tested on a large scale level that you know of by anyone?

Would it be possible to for example make every npc vendor shop on the shard a rentable.
My plans are to have like invasion events on a shard and have towns left with vendors not wanting
to work anymore. and then have players take over the shops under rules they still have to run a tailor shop, or smith shop etc
Also plan on making most vendor items thats not craftable craftable. Making it so players have to depend on each other more
and bring towns to life like never seen before.

Would that many townhouses create a problem or even be supportable under runuo and a shard with say 100-200 players?
 
Top