Government (Player City) System 2.0
Hey folks, first of all this script package was originally wirtten by -RoninGT- for RunUO 1.0. I have taken his package and modified some parts, remove/fixed bugs, added more content, and buffed it up for RunUO 2.0. All of the code found here is either original RunUO scripting, original FS Gavernment System 1.0 by RoninGT, or by yours truly. However, this is now for you. So all support will be found by you, or one of the authors.
In all honesty, this is my first script release, so I'm sure I will forget a lot, edit this post 1 trillion times, and post 65 more releases and fixes, but this is where you start. As far as I can tell, it runs smooth as a whistle. HELP ME FIND BUGS!!
Changelog:
Updated July 16, 2006: (v2.0.6b)
*Fixed fresh install bug
Updated July 15, 2006: (v2.0.6)
*Fixed CheckifHouseinCity() bug
*Fixed more out of place tiles
*Implimented the IsGMCity variable *CityManagementStone.DoUpdate()* - see feature notes
*details
Updated July 13, 2006: (v2.0.5)
*City name is now changeable. Also, the regions thereof are fully dynamic. The code will automatically generate a fun name on city placement, which again, is changeable from the stone. (Thanks Avelyn )
*Fixed a bug causing overlapable cities (city bounds check not functioning properly)
*Fixed a possible crash involving a null exception in the city stones
*Applies several missing core file mods (Thanks Hanse )
*Fixed several small bugs/errors/typos
*Note: These changes encompass many files, including very small fixes in some. It is suggested that you perform a full re-install of the system
Updated July 11, 2006:
*(2.0.4)Fixed redeeding issue after server reset. *citydeed.cs
*(2.0.3)Updated region loading @ server load. (prev. versions did not assign the region to the appropriate city stone) **AccountPrompt.cs for quick install
*(2.0.2)Fixed serialization bug in PlayerMobile.cs..... AGAIN!!
*(2.0.1)Updated Rectangle2D to 3D error..
Basic feature overview:
(aside from 1.0 features) ** to view version 1.0 by Ronin, click here. His page contains useful information on the core of the system
Installation
I suggest self-editing the PlayerMobile.cs file using my instructions, because it is often the most modded file in your scripts. (However, if you have an unedited PlayerMobile, it is MUCH easier to just replace it) To finish the installation, open your PlayerMobile.cs file and locate:
and place the following immediately after...
Then scroll WAY down until you find this code...
And this is where it may be more tricky... add this:
Notice the comments on the numbering. my previous ## was 25, hence my coding.
One more part, the serializer: find this:
And then add this: (make sure this ## matches your deserializer!!!)
note: with this update, I have included my PlayerMobile.cs file, in the case that you don't have other edits there and this hands-on edit is over your head.
And that should do it. If you have any issues, please let me know. If you have any Ideas, please make them happen. Thanks, and have fun.
Player Government System 2.0!!! (v. 2.0.6b)
Hey folks, first of all this script package was originally wirtten by -RoninGT- for RunUO 1.0. I have taken his package and modified some parts, remove/fixed bugs, added more content, and buffed it up for RunUO 2.0. All of the code found here is either original RunUO scripting, original FS Gavernment System 1.0 by RoninGT, or by yours truly. However, this is now for you. So all support will be found by you, or one of the authors.
In all honesty, this is my first script release, so I'm sure I will forget a lot, edit this post 1 trillion times, and post 65 more releases and fixes, but this is where you start. As far as I can tell, it runs smooth as a whistle. HELP ME FIND BUGS!!
Changelog:
Updated July 16, 2006: (v2.0.6b)
*Fixed fresh install bug
Updated July 15, 2006: (v2.0.6)
*Fixed CheckifHouseinCity() bug
*Fixed more out of place tiles
*Implimented the IsGMCity variable *CityManagementStone.DoUpdate()* - see feature notes
*details
Updated July 13, 2006: (v2.0.5)
*City name is now changeable. Also, the regions thereof are fully dynamic. The code will automatically generate a fun name on city placement, which again, is changeable from the stone. (Thanks Avelyn )
*Fixed a bug causing overlapable cities (city bounds check not functioning properly)
*Fixed a possible crash involving a null exception in the city stones
*Applies several missing core file mods (Thanks Hanse )
*Fixed several small bugs/errors/typos
*Note: These changes encompass many files, including very small fixes in some. It is suggested that you perform a full re-install of the system
Updated July 11, 2006:
*(2.0.4)Fixed redeeding issue after server reset. *citydeed.cs
*(2.0.3)Updated region loading @ server load. (prev. versions did not assign the region to the appropriate city stone) **AccountPrompt.cs for quick install
*(2.0.2)Fixed serialization bug in PlayerMobile.cs..... AGAIN!!
*(2.0.1)Updated Rectangle2D to 3D error..
Basic feature overview:
(aside from 1.0 features) ** to view version 1.0 by Ronin, click here. His page contains useful information on the core of the system
- More structures such as blacksmiths added
- City civic structures spawn NPC's and guildmasters for added town functionality
- City Parks and Gardens spawn abmient creatures/npc's for cozy town effect
- City Guards working properly
- GM Cities - Rank 6, rank 3 city bounds, 500 lockdowns (every update, customizable)
- Several structure placement bugs addressed
- Overall stability addressed
- Written for RunUO 2.0 RC1
- PLAYER MUST IMMEDIATELY enter city name, and it can not change.
- Region updates will take affect upon next server restart (due to 2.0 region system changes)
- Many more that I cen't remember right now because it's late
Installation
- Extract the 'new' folder somwhere to your custom script location
- Place all the other files in the directory into your edited folder, EXCEPT FOR PLAYERMOBILE.CS
- note: be sure to backup and remove your original scripts of these.
- Follow the next steps for editing your playermobile file.
I suggest self-editing the PlayerMobile.cs file using my instructions, because it is often the most modded file in your scripts. (However, if you have an unedited PlayerMobile, it is MUCH easier to just replace it) To finish the installation, open your PlayerMobile.cs file and locate:
Code:
public class PlayerMobile : Mobile, IHonorTarget
{
private class CountAndTimeStamp
{
private int m_Count;
private DateTime m_Stamp;
public CountAndTimeStamp()
{
}
public DateTime TimeStamp { get{ return m_Stamp; } }
public int Count
{
get { return m_Count; }
set { m_Count = value; m_Stamp = DateTime.Now; }
}
}
private DesignContext m_DesignContext;
private NpcGuild m_NpcGuild;
private DateTime m_NpcGuildJoinTime;
private TimeSpan m_NpcGuildGameTime;
private PlayerFlag m_Flags;
private int m_StepsTaken;
private int m_Profession;
and place the following immediately after...
Code:
// Start FSGov Edits
private CityManagementStone m_City;
private string m_CityTitle;
private bool m_ShowCityTitle;
private bool m_OwesBackTaxes;
private int m_BackTaxesAmount;
[CommandProperty( AccessLevel.GameMaster )]
public CityManagementStone City
{
get{ return m_City; }
set{ m_City = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public string CityTitle
{
get{ return m_CityTitle; }
set{ m_CityTitle = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool ShowCityTitle
{
get{ return m_ShowCityTitle; }
set{ m_ShowCityTitle = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public bool OwesBackTaxes
{
get{ return m_OwesBackTaxes; }
set{ m_OwesBackTaxes = value; }
}
[CommandProperty( AccessLevel.GameMaster )]
public int BackTaxesAmount
{
get{ return m_BackTaxesAmount; }
set{ m_BackTaxesAmount = value; }
}
//End FSGov Edits
Then scroll WAY down until you find this code...
Code:
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
And this is where it may be more tricky... add this:
Code:
//// Governments System edits!!!/////
case 26: /////////////this should be 1 higher than the next ## in the list
{
m_City = (CityManagementStone)reader.ReadItem();
m_CityTitle = reader.ReadString();
m_ShowCityTitle = reader.ReadBool();
m_OwesBackTaxes = reader.ReadBool();
m_BackTaxesAmount = reader.ReadInt();
goto case 25; /////////// same as next ##
}
//////end edits
Notice the comments on the numbering. my previous ## was 25, hence my coding.
One more part, the serializer: find this:
Code:
base.Serialize( writer );
writer.Write((int)25);
And then add this: (make sure this ## matches your deserializer!!!)
Code:
///////////////////Government Edits//////////////////////
writer.Write((int)26); // version MUST MATCH YOUR DESERIALIZER
writer.Write(m_City);
writer.Write(m_CityTitle);
writer.Write(m_ShowCityTitle);
writer.Write(m_OwesBackTaxes);
writer.Write(m_BackTaxesAmount);
////////////////////////end////////////////////////
note: with this update, I have included my PlayerMobile.cs file, in the case that you don't have other edits there and this hands-on edit is over your head.
And that should do it. If you have any issues, please let me know. If you have any Ideas, please make them happen. Thanks, and have fun.