I did something like this for my Steward script. I just store a List<PlayerMobile> on the Steward, and a timer that resets every 24 hours, clearing the List when it ticks. If someone tries to get the item from them, it checks if they are in the List, and if not it gives them the item and adds them to the List. I feel like this is easier than storing a different DateTime for each Player. So, rather than having to wait 24 hours to use it next, in the Steward, it simply resets everyone each 24 hours. This means someone could get one as the timer is about to expire then get another one, but it's still fair, since they only got 1 during each 24 hour period. If you have a daily restart on your server, you don't even need a timer, and you don't need to Serialize the List. It will just reset every day the shard resets.
 
loool you're too smart Lokai. You might aswell be speaking spanish
Post automatically merged:

I don't even know how to go about implementing that
 
I did something like this for my Steward script. I just store a List<PlayerMobile> on the Steward, and a timer that resets every 24 hours, clearing the List when it ticks. If someone tries to get the item from them, it checks if they are in the List, and if not it gives them the item and adds them to the List. I feel like this is easier than storing a different DateTime for each Player. So, rather than having to wait 24 hours to use it next, in the Steward, it simply resets everyone each 24 hours. This means someone could get one as the timer is about to expire then get another one, but it's still fair, since they only got 1 during each 24 hour period. If you have a daily restart on your server, you don't even need a timer, and you don't need to Serialize the List. It will just reset every day the shard resets.

I just store a List<PlayerMobile> on the Steward

C#:
        private List<PlayerMobile> mPlayers;

        public List<PlayerMobile> Players
        {
            get { return mPlayers; }
            set { mPlayers = value; }
        }

and a timer that resets every 24 hours, clearing the List when it ticks.

C#:
        private MyTimer myTimer;

        private class MyTimer : Timer
        {
            private Steward mSteward;

            public MyTimer(Steward steward) : base(TimeSpan.FromHours(24.0))
            {
                mSteward = steward;
            }

            protected override void OnTick()
            {
                mSteward.Players = new List<PlayerMobile>();
            }

it checks if they are in the List, and if not it gives them the item and adds them to the List

C#:
                if (mPlayers.Contains(pm))
                {
                    pm.SendMessage("You have already received an item from this Steward today.");
                    return;
                }

                if (pm.AddToBackpack(Backpack.Items[Utility.Random(Backpack.Items.Count)]))
                {
                    pm.SendLocalizedMessage(1072223); // An item has been placed in your backpack.
                    mPlayers.Add(pm);
                }
 
I'll let that marinate over night and see if I can squeeze that in tomorrow. Ty Lokai!
Post automatically merged:

Where do I plug in the Steward script at? Playermobile.cs? Regstone.cs? Or is it a custom script of its own? I'm only decent at modifying, haven't had much experience on plugging lines in except for one time recently when I added wands to the liches drop table
Post automatically merged:

I'm assuming playermobile.cs correct me if I'm wrong
Post automatically merged:

I think I'll just do without the Steward. I found a different approach a couple hours ago. I decided to just increase the mage shops volume to 60k on store supplies. Also swapped out the lesser potions for greater potions
 
Last edited:
The snippets I gave were from my Steward script. It's the 14th Anniversary Steward. You can find it on these forums. I was not suggesting you add the Steward to your script, just showing how I created those things in the Steward. You could create the List and the Timer pretty much as is on your RegStone. Practically Copy/Paste. The bit where it checks to see if they are in the List would be put in the OnDoubleClick method of RegStone, to determine if they are eligible to get the regs.

Again, these were given to show you how it can be done, not to imply that they would work exactly as written in your script. Feel free to post your script and any attempt you make to implement this, and I would be happy to show more.
 
Ah gotcha. Well if I decide to go about implementing it, I'll refer back to this post and try to plug it in, if I have any problems I'll be sure to reach out to you. Thanks Lokai!
 
Back