[Help] Hellmouth Mob Spawn

04/10/2011 02:36 F i n c h i#1
Alright,I added the following code in Database.cs

Database.cs
Code:
public static void GetSpawns()
        {
            //I've changed mob spawn code like 5 times.. this should still work though so w/e.
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("MobSpawns");
            uint Count = 0;
            MySqlReader r = new MySqlReader(cmd);
            while (r.Read())
            {
                MobSpawn S = new MobSpawn(r.ReadUInt16("Amount"), Dictionary.BaseMobs[r.ReadUInt16("SpawnMob")], r.ReadUInt16("X"), r.ReadUInt16("Y"), r.ReadUInt16("Spread"), r.ReadUInt16("Map"));
                Count += (uint)S.Members.Count;
            }
            Console.WriteLine(Program.Title + " Spawning " + Count + " monsters into the world");
        
        }
After this I added the following code in Spawn.cs

Spawn.cs
Code:
public class MobSpawn
    {
        public Mob MobCoords(Mob M)
        {
            M.X = (ushort)Program.Rand.Next(X - Spread, X + Spread);
            M.Y = (ushort)Program.Rand.Next(Y - Spread, Y + Spread);
            return M;
        }
        public MobSpawn(uint Amount, BaseMob Type, ushort BindX, ushort BindY,ushort Dist, ushort BindMap)
        {
                MobType = Type;
                TotalSpawn = Amount;
                X = BindX;
                Y = BindY;
                Spread = Dist;
                if (!Dictionary.Maps.ContainsKey(BindMap))
                {
                    Map = new Map(Enum.PkType.None);
                    Dictionary.Maps.ThreadSafeAdd(BindMap, Map);
                }
                else
                    Map = Dictionary.Maps[BindMap];
                for (uint I = 0; I < Amount; I++)
                {
                    Mob M = new Mob();
                    M.Map = BindMap;
                    M.Name = Type.Name;
                    M.Instance = 0;
                    M.Mesh = Type.Mesh;
                    M.MobHP = (ushort)Type.MaxHp;
                    M.MobLevel = Type.Level;
                    M.Dir = (byte)new Random().Next(1, 8);
                    M = MobCoords(M);
                    int Tries = 10;
                    while (Tries > 0 && !Calculations.FreeCoord(M.X, M.Y, M.Map, M.Instance))
                    { M = MobCoords(M); Tries--; }
                    M.UID = this.Map.MobCounter + I;
                    Map _map = Handler.PullMap(M.Map);
                    this.Members.Add(M.UID, M);
                    _map.AddMonster(M, _map.MakeCoord(M.X, M.Y, M.Instance));
                }
                Map.MobCounter += Amount;
                      
        }
        public Dictionary<uint, Mob> Members = new Dictionary<uint, Mob>();
        BaseMob MobType;
        public uint TotalSpawn;
        public uint TotalDead
        {
            get
            {
                uint Count = 0;
                foreach (Mob M in Members.Values)
                    if (!M.Alive)
                        Count++;
                return Count;
            }
        }
        public ushort X, Y, Spread;
        public Map Map;
       
    }
But monsters / guards still doesn't spawn =\
Any help?
04/10/2011 03:01 chickmagnet#2
the problem is in the spawn cs coz the database part is fine coz i actrully fixed it at 1 point but it spawned 0 monsters
04/10/2011 03:22 pro4never#3
Are their any entries in your mobSpawns database? ^^

The actual spawn database was never completed because the mob system was not in use.

Hell my own copy of it only has like 10 spawn entries.
04/10/2011 04:16 chickmagnet#4
Quote:
Originally Posted by pro4never View Post
Are their any entries in your mobSpawns database? ^^

The actual spawn database was never completed because the mob system was not in use.

Hell my own copy of it only has like 10 spawn entries.
ye it does coz at first when i used the spawn fix it spawn than the spawn cs started givin weird errors check the hellmouth rel thread and u'll see a pic of my errors
04/10/2011 04:19 pro4never#5
The error you posted was that it was trying to load a base monster that doesn't exist... Keep in mind that when adding spawns to database it uses the basemob id, not mesh.

(check the mobs database for all of them)
04/10/2011 04:49 chickmagnet#6
Quote:
Originally Posted by pro4never View Post
The error you posted was that it was trying to load a base monster that doesn't exist... Keep in mind that when adding spawns to database it uses the basemob id, not mesh.

(check the mobs database for all of them)
hehe thx imma mess wit that more 2marrow thx very much for the respond and im pretty sure that op has same error i had
04/10/2011 09:07 F i n c h i#7
So,what should I do to get it work?

Like you can see,I don't have any error in console.

[Only registered and activated users can see links. Click Here To Register...]
04/10/2011 15:57 chickmagnet#8
Quote:
Originally Posted by alexalx View Post
So,what should I do to get it work?

Like you can see,I don't have any error in console.

[Only registered and activated users can see links. Click Here To Register...]
try this

Code:
public static void GetSpawns()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("MobSpawns");
            uint Count = 0;
            MySqlReader r = new MySqlReader(cmd);
            while (r.Read())
            {
                MobSpawn S = new MobSpawn(r.ReadUInt16("Amount"), Dictionary.BaseMobs[r.ReadUInt16("SpawnMob")], r.ReadUInt16("X"), r.ReadUInt16("Y"), r.ReadUInt16("Spread"), r.ReadUInt16("Map"));
                Count += (uint)S.Members.Count;
            }
            Console.WriteLine(Program.Title + " Spawning " + Count + " monsters into the world");
        
        }
04/10/2011 16:57 F i n c h i#9
Alright,I will try it now.
Thanks.
04/10/2011 17:03 F i n c h i#10
Actually,thats what I'm using :S
And its not working,It was suppose to say on console:

"Spawning (the amount of monsters) monsters into the world"

But its not saying that anymore...


Can you team view me?
04/10/2011 17:34 chickmagnet#11
sure get on msn [Only registered and activated users can see links. Click Here To Register...]
04/10/2011 17:48 F i n c h i#12
Quote:
Originally Posted by chickmagnet View Post
sure get on msn [Only registered and activated users can see links. Click Here To Register...]
Added you.

Are you online on msn?
04/10/2011 18:07 Yaksha#13
its a problem with the mob uid. if you do a console writeline tin the try and catch u will see u get an error where it cant add the uid. put breakpoints in your code and go through it line by line using f10 to pinpoint the problem. the reason its not showing error is because your not printing the errors.

on another note my mobs move and attacker me but i cant seem to update there location in the objects list so aoe skills are not working correctly :( annoying me now lol
04/10/2011 18:13 F i n c h i#14
In Spawn.cs? should I put the breakpoints?
04/10/2011 18:15 Yaksha#15
Quote:
Originally Posted by alexalx View Post
In Monster.cs? should I put the breakpoints?
oh dear lol

In the Spawn.cs debug the whole MobSpawn function