[CoV2] Mob Spawns

02/11/2009 07:57 skywar1337#1
I added in some new mobs to the database, added spawns, but nothing is spawning. Am I missing something?
02/11/2009 09:19 damianpesta#2
One error at entity.cs line 212.Use other lotf to fix it.
02/11/2009 11:57 skywar1337#3
I don't see anything wrong.

Code:
        public static void SpawnAllMobs()
        {
            try
            {
                int MobsSpawned = 0;
                int MobSpawnsToSpawn = DataBase.MobSpawns.Length;

                for (int j = 0; j < MobSpawnsToSpawn; j++)
                {
                    uint[] ThisSpawn = DataBase.MobSpawns[j];
                    string[] ThisMob = null;

                    foreach (string[] FindId in DataBase.Mobs)
                    {
                        if (FindId[0] == Convert.ToString(ThisSpawn[1]))
                        {
                            ThisMob = FindId;
                        }
                    }

                    for (int n = 0; n < Convert.ToInt32(ThisSpawn[2]); n++)
                    {
                        uint UID = (uint)General.Rand.Next(400000, 500000);
                        short spawn_x = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[3]), Convert.ToInt16(ThisSpawn[5]));
                        short spawn_y = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[4]), Convert.ToInt16(ThisSpawn[6]));
                        while (AllMobs.Contains(UID))
                        {
                            //DataBase.MobSpawns = null;
                            UID = (uint)General.Rand.Next(400000, 500000);
                        }

                        SingleMob Mob = new SingleMob((short)spawn_x, (short)spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[6]), uint.Parse(ThisMob[7]), (uint)UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]), 0, true);

                        AllMobs.Add(UID, Mob);

                        MobsSpawned++;
                    }
                }
                DataBase.Mobs = null;
                DataBase.MobSpawns = null;
                General.WriteLine("   - Spawned " + MobsSpawned + " mobs.");
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
02/11/2009 12:13 PeTe Ninja#4
use this instead of manual

CREDITS TO EMMETHECODER FOR HIS AWESOME COMMAND

Code:
 if (Splitter[0] == "@addspawn") // adds a spawn to your server (exa. @addspawn 502 2 2 )
                                        {
                                            uint MobID = uint.Parse(Splitter[1]);
                                            ushort Area = byte.Parse(Splitter[2]);
                                            ushort Amount = ushort.Parse(Splitter[3]);
                                            DataBase.NewSpawn(MyChar.LocMap, (ushort)(MyChar.LocX - Area), (ushort)(MyChar.LocY + Area), (ushort)(MyChar.LocX + Area), (ushort)(MyChar.LocY - Area), Amount, MobID);
                                        }
then search for public static void NoGuild(uint UID)

and under it add

Code:
public static bool NewSpawn(ushort Map, ushort XStart, ushort YStart, ushort XEnd, ushort YEnd, ushort SpawnNr, uint MobID)
{
try
{
MySqlCommand Command = new MySqlCommand("INSERT INTO mobspawns (SpawnWhatID,SpawnNr,XStart,YStart,XEnd,YEnd,Map) VALUES (" + MobID + "," + SpawnNr + "," + XStart + "," + YStart + "," + XEnd + "," + YEnd + "," + Map + ")", Connection);
Command.ExecuteNonQuery();
return true;
}
catch { return false; }
}
example of code /addspawn 502 2 2 << i think that is guard :D
02/11/2009 12:16 _Emme_#5
Make sure you restart the server once you used the command.
02/11/2009 13:03 skywar1337#6
Hrm. That doesn't seem to be working either.

The spawn I added, "/addspawn 502 2 2" shows up in the mobspawns database, but nothing spawns.
02/11/2009 14:34 damianpesta#7
Quote:
Originally Posted by skywar1337 View Post
I don't see anything wrong.

Code:
        public static void SpawnAllMobs()
        {
            try
            {
                int MobsSpawned = 0;
                int MobSpawnsToSpawn = DataBase.MobSpawns.Length;

                for (int j = 0; j < MobSpawnsToSpawn; j++)
                {
                    uint[] ThisSpawn = DataBase.MobSpawns[j];
                    string[] ThisMob = null;

                    foreach (string[] FindId in DataBase.Mobs)
                    {
                        if (FindId[0] == Convert.ToString(ThisSpawn[1]))
                        {
                            ThisMob = FindId;
                        }
                    }

                    for (int n = 0; n < Convert.ToInt32(ThisSpawn[2]); n++)
                    {
                        uint UID = (uint)General.Rand.Next(400000, 500000);
                        short spawn_x = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[3]), Convert.ToInt16(ThisSpawn[5]));
                        short spawn_y = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[4]), Convert.ToInt16(ThisSpawn[6]));
                        while (AllMobs.Contains(UID))
                        {
                            //DataBase.MobSpawns = null;
                            UID = (uint)General.Rand.Next(400000, 500000);
                        }

                        SingleMob Mob = new SingleMob((short)spawn_x, (short)spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[6]), uint.Parse(ThisMob[7]), (uint)UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]), 0, true);

                        AllMobs.Add(UID, Mob);

                        MobsSpawned++;
                    }
                }
                DataBase.Mobs = null;
                DataBase.MobSpawns = null;
                General.WriteLine("   - Spawned " + MobsSpawned + " mobs.");
            }
            catch (Exception Exc) { General.WriteLine(Convert.ToString(Exc)); }
        }
line 212 MIninum Value is Same as Maximum Value , look closely
short spawn_y = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[4]), Convert.ToInt16(ThisSpawn[6]));
02/11/2009 16:33 _Emme_#8
Meh its used:

/addspawn modid area amount
02/11/2009 21:12 PeTe Ninja#9
Quote:
Originally Posted by skywar1337 View Post
Hrm. That doesn't seem to be working either.

The spawn I added, "/addspawn 502 2 2" shows up in the mobspawns database, but nothing spawns.
lol i said i think thats it , not sure if it is in your database

go to localhost/phpmyadmin

under mobs

and it says MOBID , thats where it goes

/addspawn [MOBID] [AREA] [AMOUNT]

so lets say pheasant ( which most likely = 1 )

/addspawn 1 10 10

the spot where you are it will add pheasant in 10 spots 10 of them, to see the effect that it makes yo have to restart your server


if this helps you.. thank emme not me