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!

Power Hour

Status
Not open for further replies.

Qualthwar

Wanderer
Power Hour

Hey all, this is my first time posting, but I have been reading for a while now. I have just began the process of hosting a server, and am totally new to scripting, so bare with me.

I have searched the threads for an answer on this, and have found many topics on it, but no complete answers. I would really like to implement a power hour in my server. I realize there is a guaranteed gains system in place, and that's fine. Does anyone care to share with me how I would go about doing this? Thanks in advance.

edit: i should mention i'm using rc 2.0
 

Qualthwar

Wanderer
You must have missed the part where i said i was totally new to scripting, haha. Okay, the theory makes sense, any idea how i would actually go about doing that though?
 

Gargouille

Sorceror
Hi,

Just make a new file with that code, and store it everywhere in script Directory :
Code:
using System;
using Server;

namespace Server.Misc
{
	static class PowerHour
	{
		const int Begin=12, End=13;//Happy Hour from 12 to 13
		
		public static bool On
		{
			get { return ( (Begin <= DateTime.Now.Hour) && (DateTime.Now.Hour <= End) );}
		}
	}
}

Then you can use that line/test everywhere you need :
Code:
if(PowerHour.On)

For example, in Scripts/Misc/SkillCheck.cs, find the Gain method, and after the line :
Code:
int toGain = 1;
insert :
Code:
if(PowerHour.On)toGain*=2;
 

Qualthwar

Wanderer
okay, that kinda makes sense. The begin=12, and end=13 is what determines the length of the power hour, correct? So this will enable the power hour to be active for 1 hour each day, as soon as the character logs in?
 

Jeff

Lord
Qualthwar;798603 said:
oh yeah, okay. How would i change it to the first hour a character is logged in?

quite a bit more work, i doubt anyone is going to just explain that. You should really look into learning C#.
 

Qualthwar

Wanderer
unbelieveable, i did like 2 hours of searching last night and i never saw that thread. That helped. I'll try the powerhour.cs, and make some changes to my playermobile.cs / skillcheck.cs. thanks bud.
 

DavidMc

Wanderer
Gargouille's code its cool, but what about if i want to auto broadcast "The Power Hour has started" at 12:00 and "has ended" at 13:00.

this is what i'm using to test it, "the cold hour"

Code:
if(PowerHour.On)
                        AddWeather( -15, 100, 0, new Rectangle2D( 0, 0, 5120, 4096 ) );
                        else
                        {
                           for ( int i = 0; i < 15; ++i )
		           AddDynamicWeather( +15, 100, 5, 8, 400, 400, new Rectangle2D( 0, 0, 5120, 4096 ) ); 
                        }
 

Qualthwar

Wanderer
i still don't have it working. i'd post my script but i'm at work right now. if anyone has a functioning power hour script, it would be awesome if you could pm me with it.
 

Jeff

Lord
Qualthwar;798697 said:
i still don't have it working. i'd post my script but i'm at work right now. if anyone has a functioning power hour script, it would be awesome if you could pm me with it.

Please read the rules, requests are not allowed...
 
Status
Not open for further replies.
Top