[Release]Dragon Spawning

12/27/2010 12:21 coreymills#1
this will only work if u have Terato Dragon in ur client

EDIT: this is for the 5165 version

NOTE: this was coded using the ConquerSX source
the timer i had help doing so credits to StealArcher for help with the timer

go to program.cs and look for ur timers paste this there:
Code:
Program.SpawnDrag = new System.Timers.Timer();
                Program.SpawnDrag.Interval = 3600000;
                Program.SpawnDrag.Elapsed += new System.Timers.ElapsedEventHandler(SpawnDrag_Elapsed);
                Program.SpawnDrag.Start();
next search for:
Code:
static void CompanionThread_Execute()
after the closing bracket "}" paste this code

Code:
public static void SpawnDrag_Elapsed(object source, System.Timers.ElapsedEventArgs e)
        {
            try
            {
                if (SpawnDrag != null)
                {
                    Database.SpawnDragon();
                    Game.World.SendMsgToAll("Server", "Dragon Spawned in GuildWar Area", 2011, 0);
                    SpawnDrag.Stop();
                    SpawnDrag.Close();
                    SpawnDrag = null;
                }
            }
            catch { }
        }
now open Database.cs and paste this
Code:
public static void SpawnDragon()
        {
            string[] DSpawn = File.ReadAllLines(@"OldCODB\MobInfos.txt");
            Hashtable Mobs = new Hashtable(DSpawn.Length);
            for (int i = 0; i < DSpawn.Length; i++)
            {
                if (DSpawn[i][0] != '*')
                {
                    Game.Mob M = new ConquerSx.Game.Mob(DSpawn[i]);
                    Mobs.Add(M.MobID, M);
                }
            }
            string[] DMob = File.ReadAllLines(@"OldCODB\dragonspawn.txt");
            foreach (string Spawn in DMob)
            {
                if (Spawn[0] == '*') return;
                {
                    string[] SpawnInfo = Spawn.Split(' ');
                    int MobID = int.Parse(SpawnInfo[0]);
                    int Count = int.Parse(SpawnInfo[1]);
                    ushort Map = ushort.Parse(SpawnInfo[2]);
                    ushort XFrom = ushort.Parse(SpawnInfo[3]);
                    ushort YFrom = ushort.Parse(SpawnInfo[4]);
                    ushort XTo = ushort.Parse(SpawnInfo[5]);
                    ushort YTo = ushort.Parse(SpawnInfo[6]);

                    if (!Game.World.H_Mobs.Contains(Map))
                        Game.World.H_Mobs.Add(Map, new Hashtable());
                    Hashtable MapMobs = (Hashtable)Game.World.H_Mobs[Map];

                    DMap D = (DMap)DMaps.H_DMaps[Map];

                    for (int i = 0; i < Count; i++)
                    {
                        Game.Mob _Mob = new ConquerSx.Game.Mob((Game.Mob)Mobs[MobID]);
                        _Mob.Loc = new ConquerSx.Game.Location();
                        _Mob.Loc.Map = Map;
                        _Mob.Loc.X = (ushort)Program.Rnd.Next(Math.Min(XFrom, XTo), Math.Max(XFrom, XTo));
                        _Mob.Loc.Y = (ushort)Program.Rnd.Next(Math.Min(YFrom, YTo), Math.Max(YFrom, YTo));

                        while (D != null && D.GetCell(_Mob.Loc.X, _Mob.Loc.Y).NoAccess)
                        {
                            _Mob.Loc.X = (ushort)Program.Rnd.Next(Math.Min(XFrom, XTo), Math.Max(XFrom, XTo));
                            _Mob.Loc.Y = (ushort)Program.Rnd.Next(Math.Min(YFrom, YTo), Math.Max(YFrom, YTo));
                        }
                        _Mob.StartLoc = _Mob.Loc;
                        _Mob.EntityID = (uint)Program.Rnd.Next(400000, 500000);
                        while (Game.World.H_Chars.Contains(_Mob.EntityID) || MapMobs.Contains(_Mob.EntityID))
                            _Mob.EntityID = (uint)Program.Rnd.Next(400000, 500000);

                        MapMobs.Add(_Mob.EntityID, _Mob);
                    }
                }
            }
        }
in your OldCODB create a text doc and call it dragonspawn.txt and paste this
Quote:
100 1 1038 334 326 334 326
then in mobinfos.txt paste this(only if u dont have the info for Terato Dragon)
Quote:
100 TeratoDragon 1 950 250 50000 2500 70 1500 0 0 100 70 21 8036 0 True 16 0 0 500 1 True
and he'll spawn every hour

SideNote: this may be the wrong way to do it but i learned to do this on my own
12/27/2010 14:01 †he Knight#2
Wasting time..for useless shits...
Code:
100 TeratoDragon 1 950 250 50000 2500 70 1500 0 0 100 70 21 8036 0 True 16 0 0 500 [COLOR="Red"]1[/COLOR] True
The red one is spawning time. (in seconds)
12/27/2010 14:49 coreymills#3
Quote:
Originally Posted by coreymills View Post
SideNote: this may be the wrong way to do it but i learned to do this on my own
did u not read
12/28/2010 01:47 denominator#4
So then the 1 should be 3600 for an hour?
12/28/2010 14:21 †he Knight#5
Quote:
Originally Posted by coreymills View Post
did u not read
Well my friend your learning is a piece of shit.. You aren't learning anything for now. When i started , I Was far behind you , Now I'm Far Ahead.

Quote:
Originally Posted by denominator View Post
So then the 1 should be 3600 for an hour?
Seems So.
12/28/2010 16:34 coreymills#6
i'm teaching all this to myself
12/28/2010 21:28 denominator#7
Well I changed the 1 to 3600 but haven`t bothered to log the server on to test it lmfao. I will eventually test it lol. Thanks for that little bit of info I probably read it elsewhere in the past but as with most things over time I forgot lol.
12/29/2010 22:35 pro4never#8
So much bashing... While I agree with the fact that it's far from perfect and that making it so focused ("LETS SPAWN DRAGON!" instead of a entity spawn method to add w/e mob you want) is a bit limiting but I don't recall seeing anything posted before to do this sort of stuff and he's teaching himself.

Needs improvement but still.. he's learning so that should not be bashed.
12/31/2010 16:17 cahanf#9
I cannot find the timers with in the program.cs. I am probably over looking them. lol
12/31/2010 20:44 coreymills#10
search for:
Code:
static void Main(string[] args)
search inside that codeblock
01/01/2011 01:21 cahanf#11
The only mention of timer I see is that and if that is the correct line do I put it underneath... and how exactly do you distinguish the timer. I have never donw anything with the timer before and Im curious about it. tThanks
Code:
public static System.Timers.Timer DropEventTimer = null;
01/01/2011 01:30 coreymills#12
what source version are u using?
01/01/2011 02:37 cahanf#13
I'm using Arcos 5165 version.
01/01/2011 03:07 coreymills#14
search for:
Code:
MyThread MobThread = new MyThread();
                MobThread.Execute += new Execute(MobThread_Execute);
                MobThread.Start(400);
paste it under the MobThread.Start(400);
01/28/2011 08:08 hunterlow2#15
all error i'm using C#