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!

[ Runuo 2.0 RC2] Custom Regions in a Box V4.0 [Updated]

aj9251

Sorceror
[ Runuo 2.0 RC2] Custom Regions in a Box V5.0

Updated To Runuo 2.0-2.2
This script should work with Runuo Versions 2.0 to 2.2​

After pulling out most of my hair I was able to come up with a solution to the null reference errors everyone was getting. It is simple for you guys. When you double click the control make sure in the remove area box that there is ALWAYS! at least one region defined. You will notice it is initialized with ( 0,0, -1) <--> ( 0,0,1) Once you add in you're area feel free to delete the default one.

If you adhere to those simple rules I foresee that everyone should have no more crashes (fingers crossed).

However if you do, Please try to replicate the crash with you're server in debug mode and then post below. This will greatly help my troubleshooting.

With that being said. I wish everyone good luck with the script lol.

Custom Regions in a Box V4.0

Description:
This is a rewrite/update for RunUO 2.0 of Asayre8's extremely popular Custom Regions in a Box script for RunUO 1.0. This is also a compilation of changes made by Rift in his re-release of Custom Regions in a Box.
Along with updating this to 2.0 I have included Rift's mods and quite a few changes of my own to improve upon what Asayre started.
Please visit the following threads to familiarize yourself with the background of Custom Regions in a Box and a more in-depth description:

Asayre's Original CustomRegions in a Box V3.6
Rift's Mod [V3.6a]

Installation:
Download the Custom Regions in a Box v4.0.zip below.
Unzip the Custom Regions folder from the zip into your Scripts folder (preferrably a Custom folder or the Engines folder)
Restart your server and you are ready to go.

Usage:
[add RegionControl in game to add a RegionControl.
Visit the links in the Description section above to see the previous features.
Read my Changelog below for V4.0 to discover the new features and changes from previous versions. The Changelog is also included in the Zip file.

V4.0 Changelog:

- Renaming of RegionStone.cs
- RegionStone.cs renamed to RegionControl.cs to properly reflect the name of the Class. (functionality is still the same)

- New RegionControl Constructors
- RegionControl(Rectangle3D rect) to create a RegionControl with an optional area specified by a Rectangle3D.
- RegionControl(Rectangle2D[] rects) to create a RegionControl with an optional area specified by a Rectangle2D array.
- RegionControl(Rectangle3D[] rects) to create a RegionControl with an optional area specified by a Rectangle3D array.

- New "Active" Property for RegionControl
- Set RegionControl.Active to TRUE (Default) then the Region is active.
- Set RegionControl.Active to FALSE then the Region is inactive.

- Changes to Rift's Custom Region Mods
- NoPlayerCorpses has been split up into DeletePlayerCorpse and DeleteNPCCorpse, to allow more customization.
- NoItemDrop has been split up into NoPlayerItemDrop and NoNPCItemDrop, to allow more customization.

- New RegionControl Flags
- EmptyNPCCorpse, if set to TRUE all the items from an NPC's corpse, on death, will be placed outside of the corpse on to
the ground.
- EmptyPlayerCorpse, if set to TRUE all the items from a Player's corpse, on death, will be placed outside of the corpse on to
the ground.
- DeleteNPCCorpse, if set to TRUE any NPC's corpse, on death, will be deleted.
- DeletePlayerCorpse, if set to TRUE any Player's corpse, on death, will be deleted.
- ResNPCOnDeath, if set to TRUE any NPC that dies will have a new instance created in the spot that it died.
- ResPlayerOnDeath, if set to TRUE any Player that dies will be resurrected in the spot that they died.
- MoveNPCOnDeath, if set to TRUE any NPC that dies will be moved to a spot you designate.
- Set MoveNPCToLoc to the Point3D that you wish to move the NPC to.
- Set MoveNPCToMap to the Map that you wish to move the NPC to.
- MovePlayerOnDeath, if set to TRUE any Player that dies will be moved to a spot you designate.
- Set MovePlayerToLoc to the Point3D that you wish to move the Player to.
- Set MovePlayerToMap to the Map that you wish to move the Player to.
- NoPlayerItemDrop, if set to TRUE any Player that dies will not drop their backpack Items to their corpse.
- NoNPCItemDrop, if set to TRUE any NPC that dies will not drop their backpack Items to their corpse.

- Changes to [RegionBounds command
- Targeting a Mobile shows their Region outlined in blue still.
- Targeting a RegionControl that has its Active property set to TRUE outlines the region in green.
- Targeting a RegionControl that has its Active property set to FALSE outlines the region in red.

- Changes to RegionControl Flags
- CannotLootOwnCorpse property changed to CanLootOwnCorpse
- CannotEnter property changed to CanEnter

- Fixed some spelling mistakes
- All instances of "AllowBenifit" changed to "AllowBenefit".

- Prevention of identical RegionName
- On Deserialize, if a region control has the same RegionName as another the region it will have a 1 or 2 etc. added to its
name to distinguish it.
For eg. If a region is called "Custom Region" and another region is already called "Custom Region" it will get called "Custom
Region 1", if "Custom Region 1" already exists too then it will be called "Custom Region 2" etc. This is because of the new way that
Regions are registered on to maps in RunUO 2.0.
- On creation, a new Region Control will be called "Custom Region" and as before each new "Custom Region" will have a
number added after its name.
- On setting of RegionName, if a Region Control already exists with the RegionName that the user tries to specify by using
[props etc. the RegionName will not be changed and a Warning will be displayed in the Console.

Approval Status:
- Have PMed Asayre before starting work to ask permission, I receieved no reply :(.
However after reading posts from him saying about his lack of time due to his time being commited to the main RunUO 2.0 release I decided I wanted to do Custom Regions in a Box justice and release it for all the fans for 2.0.
- If Asayre himself or a Mod has a problem with this post then please either PM me and I will remove it or remove it yourself but please send me a PM telling me you have done so and your reasons. Thanks :D

Comments/Suggestions/Bugs:
Please provide me with any feedback you wish, either in this thread or as a PM. Please also provide me with any Bugs you may find and try to include as much detail in your posts as you can so I can fix them.
I have started a list below of possible features that I would personally like to add to this, please reply in this thread with your comments on these features and also with your own ideas that I will also consider.
Thanks everyone.

Possible Future Updates:
- Export/Import command
An Export command for RunUO 1.0 to export details about all your pre-existing Region Controls. An Import command for RunUO 2.0 to import your exported 1.0 Region Controls into your RunUO 2.0 Server.

- Region Control Profiles
- Profiles for each Region Control so that it can be reused for different things according to different profile sets. An example for this is to use a Region Control for an Event Arena that can hold different Events, different profiles for the Region Control would relate to different Events, so the arena can easily be switched from one Event to another.

- Overhaul of Gumps
Redesigning the Gumps, this would especially be needed if the Region Control Profiles were to be implemented.
 

Attachments

  • Custom Regions in a Box V5.0 Runuo 2.0-2.2.zip
    14 KB · Views: 512

RabidWeezle

Wanderer
Great script! I built a start room in the jail, and this was the perfect thing I needed to make 1 room of the jail "not really jail" so they could exit with the travel system. Very nice.
 

sw4ruo

Wanderer
Code:
Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at Server.Items.RegionControl.get_CustomGoLocation () [0x00000] 
  at Server.Items.RegionControl.Serialize (Server.GenericWriter writer) [0x00000] 
  at Server.StandardSaveStrategy.SaveItems (Server.SaveMetrics metrics) [0x00000] 
  at Server.StandardSaveStrategy.Save (Server.SaveMetrics metrics) [0x00000] 
  at Server.World.Save (Boolean message) [0x00000] 
  at Server.World.Save () [0x00000] 
  at Server.Misc.AutoSave.Save () [0x00000] 
  at Server.Misc.AutoSave.OnTick () [0x00000] 
  at Server.Timer.Slice () [0x00000] 
  at Server.Core.Main (System.String[] args) [0x00000]

Using Mono so I'm not sure if everyone gets this error...

Crash on save when no region was set. [add regioncontrol [save
Can't guarantee m_Region is not null on serialize.
 

b0b01

Sorceror
Yeh its a null exception on the custom go location, i posted the answer elsewhere on the boards, please do a search.
 

test444

Wanderer
i am not sure if is possible turn only PVP in this region, because you can disable PVP, but monster wont attack players too, what if i want disable only PVP and not PVM that cannot be done it seems. yes you can attack NPC monster, but they willl not attack you...
 

razzles

Wanderer
test444;783062 said:
i am not sure if is possible turn only PVP in this region, because you can disable PVP, but monster wont attack players too, what if i want disable only PVP and not PVM that cannot be done it seems. yes you can attack NPC monster, but they willl not attack you...

Yeah, seems that functionality was lost. :(
 

Tumeski

Sorceror
I will make the same question here aswell...

Is this script working with world's lightlevels? Because when i set a region is will stay in lightlevel = "0";

It bugs me :mad:
 

Hawkins

Sorceror
Tumeski;783106 said:
I will make the same question here aswell...

Is this script working with world's lightlevels? Because when i set a region is will stay in lightlevel = "0";

It bugs me :mad:

I think that if the LightLevel property is set to less than 0, it will follow the global light cycle level, the default value is 0.

In CustomRegion.cs
Code:
public override void AlterLightLevel(Mobile m, ref int global, ref int personal)
{
    if (m_Controller.LightLevel >= 0)
        global = m_Controller.LightLevel;
    else
        base.AlterLightLevel(m, ref global, ref personal);
}
 

Tumeski

Sorceror
FINALLY! :D

Thank you for the information I didn't think it would be so simple.

If anyone else wants this information just simply do this:

[set lightlevel "-1"

and then focus on the RegionControl.

Also you can make it so that 0=global lightlevel by modifying this part of CustomRegion.cs

Code:
        public override void AlterLightLevel(Mobile m, ref int global, ref int personal)
        {
           [COLOR="DarkRed"] if (m_Controller.LightLevel > 1)[/COLOR]
                global = m_Controller.LightLevel;
            else
                base.AlterLightLevel(m, ref global, ref personal);
        }

What I edited is in red. Basically it tells the CustomRegions that if the lightlevel is 0 or under it, we will be using global lightlevel.

Easy peasy ^^

Thanks all
 

Hunter

Sorceror
Hey very nice script!
I just have an idea for future release if you plan any. The idea is that within a new custom region you could have a true/false on if players would gain a murder count if they kill anyone inside.

Thanks for this script :)
 
Suggestions on how to fix this error

Server crashes with the following when a player is killed in the region.

Code:
unUO Version 2.0, Build 3459.21734
Operating System: Microsoft Windows NT 5.1.2600 Service Pack 3
.NET Framework: 2.0.50727.3082
Time: 7/4/2009 10:25:13 AM
Mobiles: 2133
Items: 109102
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.Regions.CustomRegion.OnDeath(Mobile m) in d:\RUN_UO(HB)\RUNUO(HB)\Scripts\Customs\Custom Regions in a Box V4.0 Runuo 2.0 RC2\CustomRegion.cs:line 75
   at Server.Mobile.Kill()
   at Server.Mobile.Damage(Int32 amount, Mobile from, Boolean informMount)
   at Server.Mobile.Damage(Int32 amount, Mobile from)
   at Server.Mobiles.PlayerMobile.Damage(Int32 amount, Mobile from) in d:\RUN_UO(HB)\RUNUO(HB)\Scripts\Mobiles\PlayerMobile.cs:line 2222
   at Server.AOS.Damage(Mobile m, Mobile from, Int32 damage, Boolean ignoreArmor, Int32 phys, Int32 fire, Int32 cold, Int32 pois, Int32 nrgy, Boolean keepAlive) in d:\RUN_UO(HB)\RUNUO(HB)\Scripts\Misc\AOS.cs:line 61
   at Server.AOS.Damage(Mobile m, Mobile from, Int32 damage, Int32 phys, Int32 fire, Int32 cold, Int32 pois, Int32 nrgy) in d:\RUN_UO(HB)\RUNUO(HB)\Scripts\Misc\AOS.cs:line 38
   at Server.Spells.SpellHelper.SpellDamageTimerAOS.OnTick() in d:\RUN_UO(HB)\RUNUO(HB)\Scripts\Spells\Base\SpellHelper.cs:line 1038
   at Server.Timer.Slice()
   at Server.Core.Main(String[] args)
 

wildman1920

Wanderer
i keep getting this error as if i have duplicate scripts or at least thats how im reading it, but ive searched all my folders and cannot find any duplicates. what else could it be thank you!

Code:
RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (6 errors, 0 warnings)
Errors:
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/CustomRegion.cs:
    CS0101: Line 10: The namespace 'Server.Regions' already contains a definitio
n for 'CustomRegion'
    CS0102: Line 84: The type 'Server.Regions.CustomRegion' already contains a d
efinition for 'MovePlayerTimer'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RegionBounds.cs:
    CS0101: Line 10: The namespace 'Server.Commands' already contains a definiti
on for 'RegionBounds'
    CS0102: Line 26: The type 'Server.Commands.RegionBounds' already contains a
definition for 'RegionBoundTarget'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RegionControl.cs:
    CS0101: Line 14: The namespace 'Server.Items' already contains a definition
for 'RegionFlag'
    CS0101: Line 65: The namespace 'Server.Items' already contains a definition
for 'RegionControl'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RegionControlGump.cs
:
    CS0101: Line 9: The namespace 'Server.Gumps' already contains a definition f
or 'RegionControlGump'
    CS0102: Line 36: The type 'Server.Gumps.RegionControlGump' already contains
a definition for 'Buttons'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RemoveAreaGump.cs:
    CS0101: Line 10: The namespace 'Server.Gumps' already contains a definition
for 'RemoveAreaGump'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RestrictGump.cs:
    CS0101: Line 8: The namespace '<global namespace>' already contains a defini
tion for 'RestrictType'
    CS0101: Line 16: The namespace 'Server.Gumps' already contains a definition
for 'RestrictGump'
    CS0101: Line 97: The namespace 'Server.Gumps' already contains a definition
for 'SpellRestrictGump'
    CS0101: Line 105: The namespace 'Server.Gumps' already contains a definition
 for 'SkillRestrictGump'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.
 

Hands Of God

Sorceror
wildman1920;842227 said:
i keep getting this error as if i have duplicate scripts or at least thats how im reading it, but ive searched all my folders and cannot find any duplicates. what else could it be thank you!

Code:
RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (6 errors, 0 warnings)
Errors:
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/CustomRegion.cs:
    CS0101: Line 10: The namespace 'Server.Regions' already contains a definitio
n for 'CustomRegion'
    CS0102: Line 84: The type 'Server.Regions.CustomRegion' already contains a d
efinition for 'MovePlayerTimer'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RegionBounds.cs:
    CS0101: Line 10: The namespace 'Server.Commands' already contains a definiti
on for 'RegionBounds'
    CS0102: Line 26: The type 'Server.Commands.RegionBounds' already contains a
definition for 'RegionBoundTarget'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RegionControl.cs:
    CS0101: Line 14: The namespace 'Server.Items' already contains a definition
for 'RegionFlag'
    CS0101: Line 65: The namespace 'Server.Items' already contains a definition
for 'RegionControl'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RegionControlGump.cs
:
    CS0101: Line 9: The namespace 'Server.Gumps' already contains a definition f
or 'RegionControlGump'
    CS0102: Line 36: The type 'Server.Gumps.RegionControlGump' already contains
a definition for 'Buttons'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RemoveAreaGump.cs:
    CS0101: Line 10: The namespace 'Server.Gumps' already contains a definition
for 'RemoveAreaGump'
 + CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/RestrictGump.cs:
    CS0101: Line 8: The namespace '<global namespace>' already contains a defini
tion for 'RestrictType'
    CS0101: Line 16: The namespace 'Server.Gumps' already contains a definition
for 'RestrictGump'
    CS0101: Line 97: The namespace 'Server.Gumps' already contains a definition
for 'SpellRestrictGump'
    CS0101: Line 105: The namespace 'Server.Gumps' already contains a definition
 for 'SkillRestrictGump'
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.

That would have to be duplicates. try removing "CustomScripts/Custom Regions in a Box V4.0 Runuo 2.0 RC2/" and then load the server and see if you can add the region controller.
 

wildman1920

Wanderer
well i still cannot find the dupes in my files but it does seem that i have them somewhere in my scripts lol i just cannot find them for the life of me. so i added the [add regioncontrol and my server crashed and i cannot log back into it. here is the error!


Code:
RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...done (cached)
Scripts: Skipping VB.NET Scripts...done (use -vb to enable)
Scripts: Verifying...done (3053 items, 746 mobiles)
Regions: Loading...done
World: Loading...Error:
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt32()
   at Server.World.Load()
   at Server.Core.Main(String[] args)
This exception is fatal, press return to exit
 

Teagan

Sorceror
wildman1920;842321 said:
well i still cannot find the dupes in my files but it does seem that i have them somewhere in my scripts lol i just cannot find them for the life of me. so i added the [add regioncontrol and my server crashed and i cannot log back into it. here is the error!


Code:
RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...done (cached)
Scripts: Skipping VB.NET Scripts...done (use -vb to enable)
Scripts: Verifying...done (3053 items, 746 mobiles)
Regions: Loading...done
World: Loading...Error:
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.__Error.EndOfFile()
   at System.IO.BinaryReader.FillBuffer(Int32 numBytes)
   at System.IO.BinaryReader.ReadInt32()
   at Server.World.Load()
   at Server.Core.Main(String[] args)
This exception is fatal, press return to exit

I also got tagged with the same error.
Same RUO build version and .net framework as the previous poster. Knives Townhouses 2.01.
 

tyson123

Wanderer
Error At Customregion.cs

Cutom Regions in a box V4.0 Runuo2.0RC2/customregion.cs:
CS0508:Line 28 : 'Server.Regions.CustomRegion.OnDeath<Server.Mobile>': return type must be'bool' to match overridden member 'Server.Region.Ondeath<Server.Mobile>'

I GOT THIS ERROR COULD YOU HELP ME TO FIX IT ?
 

ashftw

Sorceror
@wildman1920 and Teagan.

Your saves have been corrupted. Find a suitable backup in your backups folder guys. I've noticed a lot of people getting corrupt saves from this script, don't know if its coincidence or what, a shame though, its a damn useful script.

Peace.

Ashftw
 

Pure Insanity

Sorceror
Is it just me or do the regions not work if they are located inside of a custom house? Is this because custom town houses have their own region and rules? Are they not allowed to over lap? This is sort of a big issue for me. Any help or info would be greatly appreciated.
 
Top