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 RC1] Custom Regions in a Box V4.0

[RunUO 2.0 RC1] Custom Regions in a Box V4.0

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 V4.0.zip
    13.1 KB · Views: 3,256
Update(dd/mm/yy)

Update (30/06/06)
- Fixed a bug with Music not playing.

Update (31/07/06)
- Fixed a bug with being unable to set IsGuarded.
- Fixed a bug with "Map already contains a Region with that name" Warning when setting IsGuarded on a region (related to above fix).

Update (10/02/07)
- Fixed a bug with being unable to set NoNPCItemDrop.
- Implemented Irian's suggestion of a CustomGoLocation.

Update (01/03/07)
- Fixed a bug with CustomGoLocation not setting properly/resetting on restart.

 
I have some suggestions for you. For using your regions like an arena another two options would be cool:

1) Move corpse after death to specified location (enqueued with customizable timer)

2) Keep criminal status for all players in region to prevent increasing of kills count.
 

GPXtC02

Wanderer
Is it just me or is there a noticeable problem with the script detecting changes in the z-axis?
It seems in the regioned supp-room I run, on all the stairs (to go upon "gate" platforms(z=5)), the region does not recognize the tiles and thus does not register when people attempt to cast spells that should otherwise be uncastable in said region.
 

dracana

Sorceror
GPXtC02 said:
Is it just me or is there a noticeable problem with the script detecting changes in the z-axis?
It seems in the regioned supp-room I run, on all the stairs (to go upon "gate" platforms(z=5)), the region does not recognize the tiles and thus does not register when people attempt to cast spells that should otherwise be uncastable in said region.

yes, I have this problem as well. I tried starting at a low z and ending on top z when adding bounds... this worked on a few areas, but in a couple of my areas, I just can't seem to get it to recoginze every z level :(
 
GPXtC02 said:
Is it just me or is there a noticeable problem with the script detecting changes in the z-axis?
It seems in the regioned supp-room I run, on all the stairs (to go upon "gate" platforms(z=5)), the region does not recognize the tiles and thus does not register when people attempt to cast spells that should otherwise be uncastable in said region.
I am having this as well. When I walk across a bridge that is elevated it leaves the region, when I get to other side, it reenters. Also some of the songs loop, and some dont. Stones (best UO song ever) doesnt loop :(. Also not all songs are listed. Walking isnt. It also lists some songs that were only avail when the music was MIDI.
 

Avelyn

Sorceror
The new server uses 3D rectangles instead of 2D so the Z matters for setting the region now and you have to accomodate for that in the script. Hopefully Tobyjug or Asyre will update this properly if you are having these problems.
 

Avelyn

Sorceror
Big Cheez-it said:
Is there a way to get around it some how?

Yes, but you need to change to default region value of a housing region. If you wish to do this, I believe it's in basehouse.cs somewhere.
 

Draegen

Sorceror
feature that would be great that should be added

ghosts cant enter region

please add this as a feature would rock so much
 
Avelyn said:
Yes, but you need to change to default region value of a housing region. If you wish to do this, I believe it's in basehouse.cs somewhere.
So basically if this is rewritten to fix the z axis problem, it will require a change in a distro file? Or is there an easier way around it?
 

Draegen

Sorceror
problem with this if you make two regions and forget to rename the region it will start throwing a double region error in your consolor and cause server to freeze

like i forgot to change two regions had them both named custom region and it was throwing double region error froze up runuo2.0
 
Draegen said:
problem with this if you make two regions and forget to rename the region it will start throwing a double region error in your consolor and cause server to freeze

like i forgot to change two regions had them both named custom region and it was throwing double region error froze up runuo2.0

Hmm that shouldn't happen... I put in code to make sure that two Region Controls can't have the same Region Name. If you can please provide me with steps of how you are able to name them both the same and get the "Map already has a region registered with that name" problem. Will help me to identify if a problem exists in my code.

Anti-Basic said:
I am having this as well. When I walk across a bridge that is elevated it leaves the region, when I get to other side, it reenters. Also some of the songs loop, and some dont. Stones (best UO song ever) doesnt loop :(. Also not all songs are listed. Walking isnt. It also lists some songs that were only avail when the music was MIDI.

I'm afraid there's nothing I can do about the music, the enum that holds all of the different Music is declared in the Core, so if you know all the names of the music that should be there it might be worth adding it to the RunUO Bug Tracker to get them added to the enum!?
Also with the songs looping that could only be either a Core or a Client problem, all my code needs to do is send the selected constant from the MusicName enum to the constructor of the region. So the Region.cs in the core takes care of the Music... If you know which songs should loop try some tests to see if they do and if they don't then I think it might be worthwhile to submit it to the RunUO Bug Tracker, I'm sure the Devs could tell u then if its a Core or Client prob.


Avelyn said:
The new server uses 3D rectangles instead of 2D so the Z matters for setting the region now and you have to accomodate for that in the script. Hopefully Tobyjug or Asyre will update this properly if you are having these problems.

This is correct, the Z values are v. important now and I have allowed for that in my code. For example if you mark out an area on flat land that starts with a Z value of 0 and an end Z value of 0, then if you just use those Z values the region will not work because the region will have no depth. So what my code should do, for the example above, is make it have a start Z value of -1 and an end Z value of +1.
I'm not too sure why there are problems with the Z values, my code should be allowing for it. I would be grateful if people can do some test on places on the normal Map that you have had problems with, then tell me where you have set up the region, how you did it and what problems are occuring. Thanks!
 
Ajax2000 said:
Im having the Z axis problem as well. I flattened out an area for a town that I made, all ground level is 0, and its adding the -1 and +1 just as you say, the problem is if I go upstairs in a building or whatever, I leave the region.

This must be what everyone is doing, you need to choose your Z values very carefully.
I think that when you are drawing out your region you have all been starting on the flat and finishing on the flat so its not counting the variation in Z values.
When it asks you to target the first part of the bounding box you personally need to be at the lowest Z value for that area. Then when targeting the second part of the area you need to personally have your character go to the highest Z value for that area.
 

Ajax2000

Wanderer
tobyjug said:
This must be what everyone is doing, you need to choose your Z values very carefully.
I think that when you are drawing out your region you have all been starting on the flat and finishing on the flat so its not counting the variation in Z values.
When it asks you to target the first part of the bounding box you personally need to be at the lowest Z value for that area. Then when targeting the second part of the area you need to personally have your character go to the highest Z value for that area.

Is there a reason you couldn't just make the region Z say +100 instead of +1 so that buildings and such are taken into account?

I guess Im not clear on the reason you made the z of the region only +1.
 
porblem is that many spots - the corners of the box are not at the lowest and highest points

so what i would do is to temp put in a "tile" at the one corner below ground level and then one at the opposite corner and set it to +30 ground level and target those - then delete them (or make them hidden from players - in case you need to use them again)
 
too much work imo... then I rather change the script to do the same as in normal regions. Set one z sbyte.MinValue and the other sbyte.MaxValue + 1.
 
Top