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] Time System

Morxeton

Sorceror
[RunUO 2.0 RC1] Time System

Time System v2.0.6 [RunUO 2.0 RC1]
Released: March 18, 2007 @ 6:37 PM CST

Description:

A fully customizable date and time system that keeps track of it's own time or use real time. It loads it's data from a file at world load, and saves it's data on every world save.

Updates:

v2.0.6:

  • Added a new EMO feature, UseCantTellTime. When set to true, you can't tell the time in the EMO region via [time, clock, and can't see the moon with the spyglass. useful for setting EMO regions in dungeons. Must set system-wide setting UseCantTellTime to true to use this feature.
  • UseNonRedMageAI EMO setting has been created. When set to true, the evil spirits will NOT attack reds (murderers). However, if a player who is red decides to take a shot at an evil spirit with this option enabled, they will end up killing themselves for 100% of the damage will be reflected back onto the player.
  • SelfInstaller has been updated to make updates to two more distro files (BaseAI.cs and BaseCreature.cs). It also has been updated to disable itself after all the updates have been made to the distro files.
  • Optimized the Install() method in SelfInstaller.
  • Made the Evil Spirits a bit stronger.

v2.0.5:

  • Fixed a bug when logging on, then off, then back on rather quickly, the m_LoginQueue would process first and would try to add you back into the MobilesTable when you haven't been removed yet. The m_LogoutQueue will now process first, but also a try/catch wrapper has been placed around MobilesTable.Add to prevent a duplicate key being inserted (it was still possible to crash after changing the order).

v2.0.4:

  • Added EvilSpawners that will now spawn evil spirits during the darkest hour. You must add the spawners manually using RunUO's [ADD command, then [PROPS to configure their properties. The spawner will only function if you [TS SET UseEvilSpawners true AND the EMO it is located in must have UseEvilSpawners set to true.
  • Fixed [TS ADDEMO and [TS GETEMO # to show all of the properties of the EMO (some were missing).
  • Fixed a bug in the CalculateLightLevel() method where it was not using timezone scaling even if UseTimeZones = true, therefore Darkest Hour, Light Levels, and auto lighting were not functioning as they should (i.e. changing too late).
  • Fixed a bug where if a player logged off right in the middle of a system tick, it would throw an exception because the collection was modified (removing their MobileObject from the hashtable) while the for loop was still enumerating. This has been changed to enumerate through NetState.Instances instead.
  • Added login/logout queues and a timer that checks/manages the queues once every 5 seconds.
  • Made a separate timer for polling the lights (default 5 seconds). The timer speed can me changed by using [TS SET LightsEngineTimerSpeed <value>. This was necessary as changing the master timer speed would also affect how often the lights outage effect in darkest hour.
  • Fixed a bug in the Load() method in Data.cs that was incorrectly checking the version and would result in a failed load attempt everytime.
  • Fixed a bug when wearing an item with nightsight with both UseNightSightDarksetHourOverride and UseNightSightOverride set to true, whichever reduction was a higher % between the NightSightDarkestHourReduction and NightSightLevelReduction would take precedence during the Darkest Hour, when it should always be the NightSightDarkestHourReduction.
  • Fixed a bug in the IsDarkestHour() method that was not checking to see if UseDarkestHour was true/false before returning it's calculation.
  • Fixed a bug when upgrading to a newer version, the default settings were not being set for any new settings introduced in the newer version.
  • Fixed a bug that [TS ADDEMO and [TS ADDEEMO were still defaulting to Map.Internal instead of mobile.Map.
  • Made UseDarkestHour, UseAutoLighting, UseRandomLightOutage, and LightOutageChancePerTick EMO based instead of system-wide.
  • Massive changes made to the lights engine to reflect the new EMO changes, plus some optimizations that reduced CPU usage.
  • Fixed a bug when changing an EMO's map using [TS SETEMO # MAP <map>, if typing an invalid map name it would result in a crash.
  • Added ability to enable/disable an EMO and EEMO. The new commands are [TS TOGGLEEMO <#> and [TS TOGGLEEEMO <#>.
  • Changed the SetVariable() method in Config.cs that is used for checking the variables to CheckVariable().
  • Cleaned up a bunch of code in Custom.cs by consolidating and using Config.CheckVariable() method for checking on variables before assigning them.
  • Fixed a bug when using [TS ClearMonths it would cause the server to crash because no months would exist in the array. I have changed it to remove all but the 1st month.
  • Fixed a bug in the CheckTime() method which was not properly handling the day/month checks and could result in a crash in certain situations.
  • Fixed a bug in the CheckTime() method which would not properly calculate the day/months depending on if you had a huge facet adjustment.
  • Fixed a bug in the CheckAlreadyExistsInArray() method which was not properly checking the array.
  • Changed the MobilesTable from being a Hashtable to a generic Dictionary.

v2.0.3:

  • Fixed a bug where the CalculateLightLevel() method was not checking to see if eo.EffectsMap was null before attempting to use a property.

v2.0.2:

Based on these changes, please delete your Time System directory (not data file!) before installation.

  • Removed an unnecessary command that I left in 2.0.1 by accident to do some debugging.
  • When using [TS ADDEMO and [TS ADDEEMO, instead of defaulting to Map.Internal, it will now set the EMO to be on the map of the person who typed in the command.
  • Fixed a bug where after the data file is loaded, the EMO and EEMO arrays were not being reindexed.
  • Consolidated some ObjectProps classes into the EMO.
  • Added EMO props: UseLightLevelOverride and LightLevelOverrideAdjust. When UseLightLevelOverride is enabled, the light level for the EMO that has priority would be the LightLevelOverrideAdjust value.
  • Added EMO props: UseMurdererDarkestHourBonus and MurdererDarkestHourLevelBonus. When UseMurdererDarkestHourBonus is enabled, any players that are murderers, instead of the evil spirits taking away their light level, it will be increased by the MurdererDarkestHourLevelBonus value.
  • Moved the UseLatitude, OuterLatitudePercent, and InnerLatitudePercent from MapObject into EffectsMapObject since this is only used in an EMO, not an EEMO.
  • Added NightSightDarkestHourReduction that is enabled/disabled by UseNightSightDarkestHourOverride. This is a percentage of how well nightsight will work during Darkest Hour. If it is set to 100%, then the nightsight effect will be consumed as it is now with UseNightSightDarkestHourOverride set to true.
  • Optimized the CalculateLightLevel() method and made changes for the new features added.
  • When UseNightSightOverride is enabled and NightSightLevelReduction is at 100%, it will now consume the nightsight effect and prevent it from being reapplied.
  • Fixed a bug where on a fresh install or if the data directory is missing, it would fail to set default configuration upon load failure.
  • Added an additional variable in Data.cs so that you can specify the location of the logs directory.
  • Logging can now be disabled/enabled in game via [TS SET LOGGING true/false. However, you must still set the m_Logging variable in Data.cs if you wish to capture logs of the loading process.
  • Fixed a bug in the SetNightSightOff(MobileObject) method where it would not check to see if mo was null before trying to use the props of the object.
  • Fixed a bug when using [TS SET <variable>, when forgetting to type in a value, it would throw a null reference exception.
  • Added default EMOs for Ilshenar, Malas, and Tokuno.
  • Changed default UpdateInterval from 500ms to 1000ms.

v2.0.1:

  • Fixed a bug where [TS GET would not be able to retrieve the UseNightSightDarkestHourOverride and UseNightSightOverride variables.
  • Removed NightSightLevelReduction from the Variables list, as this is set per EMO, not system wide.
  • Fixed a bug where the default configuration was not calling to "Support.ReIndexArray()" to index the EMO and EEMO arrays. This resulted in the [TS SETEMO and GETEMO commands reporting incorrect indexes.
  • Fixed a bug when setting the timerspeed via [TS SET TIMERSPEED, it would crash the shard as the low and high values being passed into the method were int and not double.
  • Fixed a bug in the CalculateLightLevel() method that was not checking if a MobileObject was null before attempting to use a property of the object.
  • Added a couple lines of code at the end of the Load() method to reindex the EMO and EEMO arrays after loading has completed.
  • Removed an unnecessary check in the CalculateLightLevel() method.
  • Fixed a bug where the system was configured to use an UpdateTimeStamp variable at the system level instead of the mobile level, resulting in only one mobile receiving light level updates.

v2.0.0:

  • Massive update... too many changes to keep track of.

Features:

  • A fully customizable time system that manages the global light level with slow light scaling for a realistic effect.
  • The system will manage lampposts (BaseLight) around the world. When night falls, the lamps turn on, and when morning rises, they turn off. This feature can be disabled. The lights actually turn on when the light level is >= the m_LightsOnLevel variable.
  • Months are fully customizable. You can change their name and total number of days, and have as many months as you wish.
  • Moons are fully customizable. You can change their name and how many days it takes to complete an entire phase. You can have as many or little (none if you prefer) moons as you wish. If you have more than one moon, the system calculates additional lighting for multiple moons based off of the m_MoonLevelAdjust variable.
  • Darkest Hour (on by default, but may be disabled) is a time period in which evil fills the air and sheds darkness all over the place (or time zone that is currently in Darkest Hour). When Darkest Hour starts, and how long it lasts are customizable.
  • During the Darkest Hour, random lampposts around the affected time zone will turn on/off from the evil presence. This feature can be disabled.
  • You can override nightsight during the Darkest Hour to where any nightsight effects are consumed. If you have an active nightsight spell or potion, it will be consumed and cannot be reapplied until after the Darkest Hour is over. This feature can be turned off.
  • EffectMapObjects (EMO) are regions that you can create that control different effects such as seasons and nightsight overrides. You can set the boundaries, priority, toggle on/off use seasons, toggle on/off use latitude for seasons, configure the outer and inner latitude percentages for realism effect (poles and equator), set the start date for each of the seasons, set a static season, enable nightsight override for Darkest Hour, use nightsight override reduction (which while in this region the nightsight effect will be reduced by the percentage you choose).
  • EffectExclusionMapObjects (EEMO) are regions that you can create that disable any effects such as seasons and nightsight overrides. This is useful for if you have an area within an EMO that you wish to exclude from having effects. For the EEMO region to take precedence over the EMO region, you must set the priority of the EEMO region to equal to or greater than the EMO it is in.
  • You can have each facet’s time be adjusted from basetime. For example, you want Felucca to be based off of basetime, but Trammel to be basetime + 2880 minutes (two days). Therefore, Trammel will always be ahead of Felucca by two days.
  • Time zones (on by default) can be disabled or fully configured to suite your needs. By default, TimeZoneXDivisor is set to 16. This means that every 16 X is one minute. However, if you have TimeZoneScaleMinutes set to any value higher than 0, it will take that many minutes to scale to the next time zone. Instead of having every single minute in its own time zone, for example, if you have TimeZoneScaleMinutes (60 by default) set to 60, it would take 60 minutes for each time zone. This means that by default TimeZoneXDivisor (16) and TimeZoneScaleMinutes (60), 16 * 60 = 960 X, it would take 960 X to make up one hour for the time zone. Time zones are NOT an effect under an EMO region.
  • You can adjust the timerspeed (default 5 seconds) and how many minutes are passed per tick of the timer (default 1 minute).
  • You can configure when daytime starts down to the hour and minute, as well as nighttime.
  • You can set the formatting for clocks, spyglass, and the [time command.
  • You can convert all lampposts to TSBaseLight (added support for the Time System) by using the [TS ConvertLampPosts command.

Information:

  • SelfInstaller will install itself into all the necessary distro files (LightCycle.cs, Clocks.cs, Spyglass.cs, NightSight.cs (spell), NightSight.cs (potion), and PlayerMobile.cs). If any of these scripts are not in their original location, SelfInstaller will not work on that script. If any of these scripts are modded, there is a chance that SelfInstaller will fail on installing that script. This feature can be disabled by editting the SelfInstaller.cs. Any scripts that were successfully updated with SelfInstaller, you WILL be required to reboot your server before changes take effect. It will NOT hurt to leave SelfInstaller enabled after it has ran, as it will do nothing. I recommend using SelfInstaller!
  • Type [TS for a list of commands.
  • Type [TS SET for a list of variables you can set.
  • Type [TS SETEMO ?? for a list of variables you can set per EMO.
  • Type [TS SETEEMO ?? for a list of variables you can set per EEMO.
  • Type [TS ADDEMO by itself to add a new EMO, then use [TS SETEMO to configure it. Be sure to set the map first, then X2Y2, then X1Y1.
  • Type a ? after any command to get the syntax of it.
  • For formatting help, please view the Formatting.txt inside the zip file.
  • The Time System.dat (it's data file) is saved in the Data\Custom\Time System directory.
  • If logging (on by default) is enabled, it is also saved in the same directory as the data file. You can disable logging by editting the script Data.cs.
  • If you have two or more EMO regions with the same priority, the one that takes precedence is the one with the lowest index number. For example: Three EMOs (indexes 2, 3, 7) all with priority 50. The EMO that takes effect would be index #2. Use the [TS GETEMO command by itself to check which EMO is in effect, and it will list all the EMOs you are currently standing in. If there is an EEMO that is taking precedence over any EMOs, it will be displayed after the list of EMOs.
  • Use [TS GETEMO to display the list of EMOs are you in.
  • Use [TS GETEEMO to display the list of EEMOs are you in.

TODO:

  • Adding commands for copying EMO and EEMO regions to make it easier to manage/create regions with similar settings.
  • Creating gumps for easy configuration.
  • Make a system-wide EMO option.
  • Add another EMO setting: CantTellTime. When set to true, you will not be able to tell what time it is from the [time command or clocks. This could be useful for creating an EMO for dungeons where you don't want players to know what time it is.
  • The evil spirits that spawn during the Darkest Hour, make an option that can be set to prevent them from attacking PKs.

Fixes For Next Version:

Suggestions From Community:

Installation:

Please see install doc in the Docs directory off of the Time System directory or use SelfInstaller (recommended).
 

Attachments

  • Time System v2.0.6.zip
    75.8 KB · Views: 909

Protius73

Sorceror
wow man nice work... looked through the scripts and looks great gonna be testing this weekend. ^karma :D
 

Liacs

Sorceror
whohoo *falls on her knees*
be praised, mighty Morxeton! Perhaps you noticed that I am a big fan of your time system. Veeeery nice to see that you updated it. Is there by any chance the season changer in it too? :rolleyes: (like i did it here)

Thanks for all your work! +++Karma!

Lia
 

Pyro-Tech

Knight
Glad to see the nightsight thing added in :) i have been waiting for this update for a looong time :D

any thought of doing this in a gump instead of the commands? make for easier formating?


either way, nice work....can't wait to try it out
 

HellRazor

Knight
Liacs;660692 said:
whohoo *falls on her knees*
be praised, mighty Morxeton! Perhaps you noticed that I am a big fan of your time system. Veeeery nice to see that you updated it. Is there by any chance the season changer in it too? :rolleyes: (like i did it here)

Thanks for all your work! +++Karma!

Lia

Kudos to you sir! This looks wonderful!

I know you decided to remove the season changer, but I'd like to see this too - as either a seperate system, or maybe as a plug-in?
 

Liacs

Sorceror
I just read the description again.. and see... there is the season implemented. Even to toggle on / off!!!

Sorry for being blind :D

Lia
 

HellRazor

Knight
Liacs;660728 said:
I just read the description again.. and see... there is the season implemented. Even to toggle on / off!!!

Sorry for being blind :D

Lia

Don't feel bad because I read over the whole thing right before I posted and I missed it too!
 

Morxeton

Sorceror
Thanks guys.

Yes seasons is implemented with some interesting customizations. They are based on an EMO region.

One thing I forgot to mention is that if you have two or more EMO regions with the same priority, the one that takes precedence is the one with the lowest index number. For example:

Three EMOs (indexes 2, 3, 7) all with priority 50. The EMO that takes effect would be index #2. Use the [TS GETEMO command by itself to check which EMO is in effect, and it will list all the EMOs you are currently standing in. If there is an EEMO that is taking precedence over any EMOs, it will be displayed after the list of EMOs.

Pyro-Tech;660718 said:
Glad to see the nightsight thing added in :) i have been waiting for this update for a looong time :D

any thought of doing this in a gump instead of the commands? make for easier formating?


either way, nice work....can't wait to try it out
I couldn't imagine the system without the ngihtsight override feature.

I do have plans on adding gumps in a future release.
 

Morxeton

Sorceror
If anyone has anything they would like to see added to the system, please let me know. I am open to suggestions.
 

Pyro-Tech

Knight
Morxeton;660980 said:
... I couldn't imagine the system without the ngihtsight override feature.

I do have plans on adding gumps in a future release.

I know the original you released for 1.0 didn't have it, and it was going to be in your next itteration...which is this...and good on the gumps.



Morxeton;660994 said:
If anyone has anything they would like to see added to the system, please let me know. I am open to suggestions.

Pretty much the thing i think would make this the easiest system would be gumps to customize everything.....from time frames, to regions and what not. With gumps it would be alot easier to see what variables you have set for various things.

And one thing i would like to see is possibility on how effective night sight is durning normal night....cause i know currently it looks like broad daylight so...there isn't any difference when you have nightsight on at night....so mabey a set up where you can say it is 75% effective during dark hours, and take it even further to be able to set a % during darkest hour.

Another expansion you could do, would be to have it check if your red, and if so, give you a vision bonus during darkest hour lol. Since your evil, the evil spirits would help you out during your hunt

Hmm....as for anything else, i can't think of too much passed what you have already taken care of....i need to read and figure out what the hell an EMO is but....

looks good either way :)
 

Cheetah2003

Wanderer
You seemed to have missed UseNightSightOverride and UseNightSightDarkestHourOverride in the [ts get command. Might wanna put them in.

Nice script, thank you!
 

Morxeton

Sorceror
Pyro-Tech;661014 said:
I know the original you released for 1.0 didn't have it, and it was going to be in your next itteration...which is this...and good on the gumps.
Yes that was the plan, but as you can see it's been over a year since that release... and the system was rewritten from scratch. If I added gumps before this release, it may of been a while :) I wanted to get this out to the community fast (well if you call a year fast...):eek:

Pyro-Tech;661014 said:
Pretty much the thing i think would make this the easiest system would be gumps to customize everything.....from time frames, to regions and what not. With gumps it would be alot easier to see what variables you have set for various things.
I totally agree and plan on adding gumps in a future release. I may also consider adding a plug-in that will allow you to make changes to the system using an external windows form app.

Pyro-Tech;661014 said:
And one thing i would like to see is possibility on how effective night sight is durning normal night....cause i know currently it looks like broad daylight so...there isn't any difference when you have nightsight on at night....so mabey a set up where you can say it is 75% effective during dark hours, and take it even further to be able to set a % during darkest hour.
You can already achieve this by using the [TS SETEMO # command. By default, the UseNightSightOverride is set to false and the NightSightLevelReduction is set to 0. There is a master variable that will disable the night sight override feature system-wide, so be sure to set that to true if you want to use it: [TS SET UseNightSightOverride true

To get the EMO you are in, type [TS GETEMO by itself. The EMO index # with the * next to it is the EMO you are in that has priority. Use [TS SETEMO # UseNightSightOverride true to turn it on, then [TS SETEMO # NightSightLevelReduction # to scale it down by a percentage.

During the Darkest Hour, if you use UseNightSightDarkestHourOverride, it will remove the effect all-together while you are in the Darkest Hour only. You also cannot reapply the effect until you leave the time zone that is in the Darkest Hour, or you wait until Darkest Hour passes. I could add another level reduction for Darkest Hour, and then if the reduction % is at 100%, to negate the effect like how it does now when using the UseNightSightDarkestHourOverride feature.

Hopefully this made sense. I think I will add a document that explains each command and how to use it.

Pyro-Tech;661014 said:
Another expansion you could do, would be to have it check if your red, and if so, give you a vision bonus during darkest hour lol. Since your evil, the evil spirits would help you out during your hunt
This isn't a bad idea at all. I'll add it to the TODO list. Thanks!

Pyro-Tech;661014 said:
Hmm....as for anything else, i can't think of too much passed what you have already taken care of....i need to read and figure out what the hell an EMO is but....

looks good either way :)
Yes, I need to add more clarification on what the hell an EMO is :)

It's basically a region (not a typical RunUO region!) that you configure to use different effects with, such as seasons and nightsight level reduction. There is also master variables that enable/disable these features, such as [TS SET UseSeasons false will disable the use of seasons system-wide and ignore the individual EMO settings for UseSeasons (yes EMO has a UseSeasons variable too). I have to try hard to explain everything in more detail... I will definitely consider adding a document on the explanation of commands and feature far more in depth than explained on this thread.
 

Morxeton

Sorceror
Cheetah2003;661020 said:
You seemed to have missed UseNightSightOverride and UseNightSightDarkestHourOverride in the [ts get command. Might wanna put them in.

Nice script, thank you!

Thanks! Fixed for next version.
 

RANCID77

Wanderer
Morxeton;661027 said:
Thanks! Fixed for next version.

Ohh boy next version huh.. Man...... Thats like a yr away aint it..
hurry up Slow Boy.. LOL.... btw downloading now to test it.. if i find even a typo ima icq ya bro and yes i know how to use spell check... ill let ya know what i think.. nothing but love for ya bro
 

RANCID77

Wanderer
Dang man you need a can of raid.. for all these bugs.. LoL.. and just so everyone else knows hes on my shard we working to get it all fixed so no i aint flamming him
 
Top