Bittiez

Member
Bittiez submitted a new resource:

World Egg Hunt Event - This is a world event, all players can play, or ignore, read more :)

What Is This?
This is an Egg Hunt event(Not necessarily related to Easter).

Installation and ServUO version
To install simply unzip the file to /Scripts/Custom/

Tested with ServUO Publish 54

Usage:
Type [StartEggHunt

An egg will be placed at your feet, and all players on the same map will have an arrow and a message telling them the arrow points towards the mystical egg.

When they find the egg, they...

Read more about this resource...
 
Love this resource! I've made a few changes though for my server. The script no longer shows an arrow for anyone with above player level access. It also announces which facet the hunt has begun in as well. If you're using Voxpire's Discord Bot it will even broadcast to your discord channel. It now gives a random 120 power scroll and does a gold shower like a champion does.

Code:
using System;
using Server.Commands;
using Server;
using System.Collections.Generic;
using Server.Items;
using Server.Network;
using Server.Engines.CannedEvil;

namespace Bittiez.EggHuntEvent
{
    public class EggHunt
    {
        public static void Initialize()
        {
            CommandSystem.Register("StartHunt", AccessLevel.Seer, new CommandEventHandler(StartEggHunt));
        }

        public static void StartEggHunt(CommandEventArgs e)
        {
            Only_One_Egg();
            Item egg = new TheEgg(e.Mobile.Location, e.Mobile.Map);
			// Send a typical message
			var DiscordMSG = "The Hunt has begun in " + e.Mobile.Map + ".";
			VitaNex.Modules.Discord.DiscordBot.SendMessage(DiscordMSG);
			//
            World.Broadcast(38, false, "The Hunt has begun in " + e.Mobile.Map + ".");
        }

        public static void Only_One_Egg()
        {
            Dictionary<Serial, Item> it = World.Items;

            List<Item> DeleteMe = new List<Item>();

            foreach (Item i in it.Values)
            {
                if ((i is TheEgg || i is TheArrow) && i != null && !i.Deleted)
                {
                    DeleteMe.Add(i);
                }
            }

            foreach (Item ii in DeleteMe)
                ii.Delete();
        }
    }
}

namespace Server.Items
{
    public class TheEgg : Item
    {
        #region Don't edit
        private List<Item> Rewards = new List<Item>();
        #endregion

        public TheEgg(Point3D loc, Map m)
            : base(0x1ECD)
        {
            LootType = LootType.Blessed;
            Movable = false;
            Name = "The Hunt Egg";
            Hue = 38;
            Location = loc;
            Map = m;
            Show_Arrows();
        }

        public SkillName Random_Skill()
        {
            while (true)
            {
                foreach (SkillName s in Enum.GetValues(typeof(SkillName)))
                {
                    if (new Random().Next(10) == 3) return s;
                }
            }
        }

        public override void OnDoubleClick(Mobile from)
        {
            if (!Utility.InRange(from.Location, this.Location, 1))
                from.SendMessage(38, "You must be closer to capture the egg!");

            this.Delete();
            from.SendMessage(38, "You pick up the egg, but it crumbles in your hand..");
			
			from.AddToBackpack(new PowerScroll(Random_Skill(), 120));
            from.AddToBackpack(new DarwinDollars(1,20));
			
			switch ( Utility.Random(999) )
            {
                case 0:
                    {
                        from.AddToBackpack(new DarwinDollars(250));
						World.Broadcast(38, false, from.Name + " was awarded 250 bonus Darwin Dollars!");
                        break;
                    }
            }
			
			GoldShower.DoForChamp(from.Location, from.Map);
			
            World.Broadcast(38, false, from.Name + " has found the egg!");
			// Send a typical message
			var DiscordMSG = from.Name + " has found the egg!";
			VitaNex.Modules.Discord.DiscordBot.SendMessage(DiscordMSG);
			//
        }

        public void Show_Arrows()
        {
            Mobile m;
            Point3D loc;
            foreach (NetState ns in NetState.Instances)
                if (ns.Mobile != null)
                {
                    m = ns.Mobile;
                    if (m.Map == this.Map && m.AccessLevel == AccessLevel.Player)
                    {
                        loc = m.Location;
                        loc.Z += 5;
                        new TheArrow(m.GetDirectionTo(this.Location), loc, m.Map);
                        m.SendMessage(38, "The arrow points towards the mystical egg...");
                    }
                }
            Start_Timer(TimeSpan.FromSeconds(20));

        }

        public void Start_Timer(TimeSpan s)
        {
            Server.Timer.DelayCall(s, new Server.TimerCallback(Show_Arrows));
        }

        #region Serialize
        public TheEgg(Serial serial)
            : base(serial)
        {
        }
        public override void Deserialize(GenericReader reader)
        {
            this.Delete();
        }
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
        }
        #endregion
    }

    public class TheArrow : Item
    {
        public TheArrow(Direction d, Point3D mtw, Map m)
        {
            LootType = LootType.Blessed;
            Movable = false;
            Name = "arrow";
            int IDD;
            switch (d)
            {
                default:
                case Direction.Up: IDD = 0x206A; break;
                case Direction.North: IDD = 0x206B; break;
                case Direction.Right: IDD = 0x206C; break;
                case Direction.Down: IDD = 0x206E; break;
                case Direction.South: IDD = 0x206F; break;
                case Direction.Left: IDD = 0x2070; break;
                case Direction.West: IDD = 0x2071; break;
                case Direction.East: IDD = 0x206D; break;

            }


            this.ItemID = IDD;
            this.MoveToWorld(mtw, m);
            Start_Timer(TimeSpan.FromSeconds(10));
        }

        public void Start_Timer(TimeSpan s)
        {
            Server.Timer.DelayCall(s, new Server.TimerCallback(Timer_Callback));
        }


        public void Timer_Callback()
        {
            this.Delete();
        }


        #region Serialize
        public TheArrow(Serial serial)
            : base(serial)
        {
        }
        public override void Deserialize(GenericReader reader)
        {
            this.Delete();
        }
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
        }
        #endregion
    }
}
 
I love the changes, good work!
Love this resource! I've made a few changes though for my server. The script no longer shows an arrow for anyone with above player level access. It also announces which facet the hunt has begun in as well. If you're using Voxpire's Discord Bot it will even broadcast to your discord channel. It now gives a random 120 power scroll and does a gold shower like a champion does.

Code:
using System;
using Server.Commands;
using Server;
using System.Collections.Generic;
using Server.Items;
using Server.Network;
using Server.Engines.CannedEvil;
 
I just wanted to thank you for this, it gave me a great idea and has since exploded into a whole automated event system haha..
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back