Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 23:26

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] Extremely basic (but working/bugless) C# Source

Discussion on [Release] Extremely basic (but working/bugless) C# Source within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Closed Thread
 
Old 05/15/2009, 23:10   #121
 
scottdavey's Avatar
 
elite*gold: 0
Join Date: Dec 2006
Posts: 684
Received Thanks: 238
Quote:
Originally Posted by ShockSoft View Post
Here it is :
Thanks!
scottdavey is offline  
Old 05/16/2009, 06:51   #122
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
Hopefully more people will start working on this source base, and actually learn stuff.

Here's Monster Loading/Spawning.

Monster Class:
Code:
    public class Monster
    {
        public uint ID;
        public string Name;
        public byte Type;
        public ushort Lookface;
        public uint Life;
        public uint AttackMin;
        public uint AttackMax;
        public uint Defence;
        public uint Dexterity;
        public uint Dodge;
        public ushort AttackRange;
        public ushort ViewRange;
        public uint EscapeLife;
        public uint MoveSpeed;
        public ushort Level;
        public byte AttackUser;
        public uint DropMoney;
        public uint DropItemType;
        public uint DropHP;
        public uint DropMP;
        public byte MagicType;
        public uint MagicDefence;
        public uint MagicHitRate;
        public byte AIType;
        public uint Defence2;
        public uint ExtraExp;
    }
Monster Loading:
Code:
        public static void LoadMobs()
        {
            foreach (string file in Directory.GetFiles(DatabasePath + "\\cq_monstertype\\"))
            {
                IniFile cq_mob = new IniFile(file);
                Monster mob = new Monster();

                mob.ID = cq_mob.ReadUInt32("cq_monstertype", "id", 0);
                mob.Name = cq_mob.ReadString("cq_monstertype", "name", "");
                mob.Type = cq_mob.ReadByte("cq_monstertype", "type", 0);
                mob.Lookface = cq_mob.ReadUInt16("cq_monstertype", "lookface", 0);
                mob.Life = cq_mob.ReadUInt32("cq_monstertype", "life", 0);
                mob.AttackMax = cq_mob.ReadUInt32("cq_monstertype", "attack_max", 0);
                mob.AttackMin = cq_mob.ReadUInt32("cq_monstertype", "attack_min", 0);
                mob.Defence = cq_mob.ReadUInt32("cq_monstertype", "defence", 0);
                mob.Dexterity = cq_mob.ReadUInt32("cq_monstertype", "dexterity", 0);
                mob.Dodge = cq_mob.ReadUInt32("cq_monstertype", "dodge", 0);
                mob.AttackRange = cq_mob.ReadUInt16("cq_monstertype", "attack_range", 0);
                mob.ViewRange = cq_mob.ReadUInt16("cq_monstertype", "view_range", 0);
                mob.EscapeLife = cq_mob.ReadUInt32("cq_monstertype", "escape_life", 0);
                mob.Level = cq_mob.ReadUInt16("cq_monstertype", "level", 0);
                mob.AttackUser = cq_mob.ReadByte("cq_monstertype", "attack_user", 0);
                mob.DropMoney = cq_mob.ReadUInt32("cq_monstertype", "drop_money", 0);
                mob.DropItemType = cq_mob.ReadUInt32("cq_monstertype", "drop_itemtype", 0);
                mob.DropHP = cq_mob.ReadUInt32("cq_monstertype", "drop_hp", 0);
                mob.DropMP = cq_mob.ReadUInt32("cq_monstertype", "drop_mp", 0);
                mob.MagicType = cq_mob.ReadByte("cq_monstertype", "magic_type", 0);
                mob.MagicHitRate = cq_mob.ReadUInt32("cq_monstertype", "magic_hitrate", 0);
                mob.MagicDefence = cq_mob.ReadUInt32("cq_monstertype", "magic_def", 0);
                mob.AIType = cq_mob.ReadByte("cq_monstertype", "ai_type", 0);
                mob.Defence2 = cq_mob.ReadUInt32("cq_monstertype", "defence2", 0);
                mob.ExtraExp = cq_mob.ReadUInt32("cq_monstertype", "extra_exp", 0);

                Kernel.Mobs.Add(mob.ID, mob);
            }
            Console.WriteLine("Monsters Loaded [{0}]", Kernel.Mobs.Count);
        }
Spawn Class:
Code:
    public class MobSpawn
    {
        public uint SpawnID;
        public ushort MapID;
        public ushort X;
        public ushort Y;
        public ushort Xc;
        public ushort Yc;
        public uint MaxMobs;
        public ushort RestSecs;
        public uint SpawnAmount;
        public uint MobID;
    }
Monster Spawn Loading:
Code:
        public static void LoadMobSpawns()
        {
            foreach (string file in Directory.GetFiles(DatabasePath + "\\cq_generator\\"))
            {
                IniFile cq_gen = new IniFile(file);
                MobSpawn spawn = new MobSpawn();

                spawn.SpawnID = cq_gen.ReadUInt32("cq_generator", "id", 0);
                spawn.MapID = cq_gen.ReadUInt16("cq_generator", "mapid", 0);
                spawn.X = cq_gen.ReadUInt16("cq_generator", "bound_x", 0);
                spawn.Y = cq_gen.ReadUInt16("cq_generator", "bound_y", 0);
                spawn.Xc = cq_gen.ReadUInt16("cq_generator", "bound_cx", 0);
                spawn.Yc = cq_gen.ReadUInt16("cq_generator", "bould_cy", 0);
                spawn.MaxMobs = cq_gen.ReadUInt32("cq_generator", "maxnpc", 0);
                spawn.RestSecs = cq_gen.ReadUInt16("cq_generator", "rest_secs", 0);
                spawn.SpawnAmount = cq_gen.ReadUInt32("cq_generator", "max_per_gen", 0);
                spawn.MobID = cq_gen.ReadUInt32("cq_generator", "npctype", 0);

                Kernel.MobSpawns.Add(spawn.SpawnID, spawn);
            }
            Console.WriteLine("Monster Spawns Loaded [{0}]", Kernel.MobSpawns.Count);
        }
Code:
        public static void SpawnMobs()
        {
            foreach (MobSpawn spawn in Kernel.MobSpawns.Values)
            {
                Monster ThisMob = new Monster();
                foreach (Monster mob in Kernel.Mobs.Values)
                {
                    if (mob.ID == spawn.MobID)
                    {
                        ThisMob = mob;
                        break;
                    }
                }

                for (uint i = 0; i < spawn.SpawnAmount; i++)
                {
                    Entity newMob = new Entity(EntityFlag.Monster, null);
                    newMob.Action = ConquerAction.None;
                    newMob.Dead = false;
                    newMob.Defence = (ushort)ThisMob.Defence;
                    newMob.Dodge = (sbyte)ThisMob.Dodge;
                    newMob.Facing = (ConquerAngle)Global.Random.Next(0, 9);
                    newMob.Hitpoints = ThisMob.Life;
                    newMob.MaxHitpoints = ThisMob.Life;
                    newMob.Level = (byte)ThisMob.Level;
                    newMob.MagicAttack = ThisMob.AttackMin;
                    newMob.MaxAttack = ThisMob.AttackMax;
                    newMob.MinAttack = ThisMob.AttackMin;
                    newMob.MDefence = (ushort)ThisMob.MagicDefence;
                    newMob.Model = ThisMob.Lookface;
                    newMob.Name = ThisMob.Name;
                    newMob.UID = (uint)Global.Random.Next(400000, 500000);
                    while (Kernel.eMonsters.ContainsKey(newMob.UID))
                        newMob.UID = (uint)Global.Random.Next(400000, 500000);
                    newMob.MapID = spawn.MapID;
                    newMob.X = (ushort)Global.Random.Next(
                        Math.Min(spawn.X, spawn.Xc),
                        Math.Max(spawn.X, spawn.Xc));
                    newMob.Y = (ushort)Global.Random.Next(
                        Math.Min(spawn.Y, spawn.Yc),
                        Math.Max(spawn.Y, spawn.Yc));

                    Kernel.eMonsters.Add(newMob.UID, newMob);
                }
            }

            Console.WriteLine("Monsters Spawned [{0}]", Kernel.eMonsters.Count);
        }
Dictionaries:
Code:
        public static Dictionary<uint, Entity> eMonsters = new Dictionary<uint, Entity>();
        public static Dictionary<uint, Monster> Mobs = new Dictionary<uint, Monster>();
        public static Dictionary<uint, MobSpawn> MobSpawns = new Dictionary<uint, MobSpawn>();
Screen:
Code:
                foreach (Entity mob in Kernel.eMonsters.Values)
                {
                    if (mob.MapID == Client.Entity.MapID)
                        if (Kernel.GetDistance(mob.X, mob.Y, Client.Entity.X, Client.Entity.Y) <= 24)
                        {
                            if (!mob.Dead)
                                mob.SendSpawn(Client);
                        }
                }
This is just a "alpha" code I guess you could say, it's prolly not the greatest, but it works.

I'm still working on lots more with monsters =P
kinshi88 is offline  
Thanks
1 User
Old 05/16/2009, 11:35   #123
 
elite*gold: 0
Join Date: Oct 2008
Posts: 430
Received Thanks: 176
I've been away for quite some time, and probably forgotten quite a bit, but... I'll be getting into this in the next few weeks, when life calms down, and see if I can offer something usefull to this work. Till then, goodluck on your works guys, and thanks for this great release Infamous.
Incariuz is offline  
Old 05/16/2009, 11:56   #124
 
elite*gold: 0
Join Date: Jul 2006
Posts: 46
Received Thanks: 3
Quote:
Originally Posted by kinshi88 View Post
Hopefully more people will start working on this source base, and actually learn stuff.

Here's Monster Loading/Spawning.

Monster Class: <-- i've made a new .cs called Monster.cs and put this in it.
Code:
    public class Monster
    {
        public uint ID;
        public string Name;
        public byte Type;
        public ushort Lookface;
        public uint Life;
        public uint AttackMin;
        public uint AttackMax;
        public uint Defence;
        public uint Dexterity;
        public uint Dodge;
        public ushort AttackRange;
        public ushort ViewRange;
        public uint EscapeLife;
        public uint MoveSpeed;
        public ushort Level;
        public byte AttackUser;
        public uint DropMoney;
        public uint DropItemType;
        public uint DropHP;
        public uint DropMP;
        public byte MagicType;
        public uint MagicDefence;
        public uint MagicHitRate;
        public byte AIType;
        public uint Defence2;
        public uint ExtraExp;
    }
Monster Loading: <--- i've put this in Database.cs
Code:
        public static void LoadMobs()
        {
            foreach (string file in Directory.GetFiles(DatabasePath + "\\cq_monstertype\\"))
            {
                IniFile cq_mob = new IniFile(file);
                Monster mob = new Monster();

                mob.ID = cq_mob.ReadUInt32("cq_monstertype", "id", 0);
                mob.Name = cq_mob.ReadString("cq_monstertype", "name", "");
                mob.Type = cq_mob.ReadByte("cq_monstertype", "type", 0);
                mob.Lookface = cq_mob.ReadUInt16("cq_monstertype", "lookface", 0);
                mob.Life = cq_mob.ReadUInt32("cq_monstertype", "life", 0);
                mob.AttackMax = cq_mob.ReadUInt32("cq_monstertype", "attack_max", 0);
                mob.AttackMin = cq_mob.ReadUInt32("cq_monstertype", "attack_min", 0);
                mob.Defence = cq_mob.ReadUInt32("cq_monstertype", "defence", 0);
                mob.Dexterity = cq_mob.ReadUInt32("cq_monstertype", "dexterity", 0);
                mob.Dodge = cq_mob.ReadUInt32("cq_monstertype", "dodge", 0);
                mob.AttackRange = cq_mob.ReadUInt16("cq_monstertype", "attack_range", 0);
                mob.ViewRange = cq_mob.ReadUInt16("cq_monstertype", "view_range", 0);
                mob.EscapeLife = cq_mob.ReadUInt32("cq_monstertype", "escape_life", 0);
                mob.Level = cq_mob.ReadUInt16("cq_monstertype", "level", 0);
                mob.AttackUser = cq_mob.ReadByte("cq_monstertype", "attack_user", 0);
                mob.DropMoney = cq_mob.ReadUInt32("cq_monstertype", "drop_money", 0);
                mob.DropItemType = cq_mob.ReadUInt32("cq_monstertype", "drop_itemtype", 0);
                mob.DropHP = cq_mob.ReadUInt32("cq_monstertype", "drop_hp", 0);
                mob.DropMP = cq_mob.ReadUInt32("cq_monstertype", "drop_mp", 0);
                mob.MagicType = cq_mob.ReadByte("cq_monstertype", "magic_type", 0);
                mob.MagicHitRate = cq_mob.ReadUInt32("cq_monstertype", "magic_hitrate", 0);
                mob.MagicDefence = cq_mob.ReadUInt32("cq_monstertype", "magic_def", 0);
                mob.AIType = cq_mob.ReadByte("cq_monstertype", "ai_type", 0);
                mob.Defence2 = cq_mob.ReadUInt32("cq_monstertype", "defence2", 0);
                mob.ExtraExp = cq_mob.ReadUInt32("cq_monstertype", "extra_exp", 0);

                Kernel.Mobs.Add(mob.ID, mob);
            }
            Console.WriteLine("Monsters Loaded [{0}]", Kernel.Mobs.Count);
        }
Spawn Class: <--- i've put this in Monster.cs
Code:
    public class MobSpawn
    {
        public uint SpawnID;
        public ushort MapID;
        public ushort X;
        public ushort Y;
        public ushort Xc;
        public ushort Yc;
        public uint MaxMobs;
        public ushort RestSecs;
        public uint SpawnAmount;
        public uint MobID;
    }
Monster Spawn Loading: <---- i've put this in Database.cs
Code:
        public static void LoadMobSpawns()
        {
            foreach (string file in Directory.GetFiles(DatabasePath + "\\cq_generator\\"))
            {
                IniFile cq_gen = new IniFile(file);
                MobSpawn spawn = new MobSpawn();

                spawn.SpawnID = cq_gen.ReadUInt32("cq_generator", "id", 0);
                spawn.MapID = cq_gen.ReadUInt16("cq_generator", "mapid", 0);
                spawn.X = cq_gen.ReadUInt16("cq_generator", "bound_x", 0);
                spawn.Y = cq_gen.ReadUInt16("cq_generator", "bound_y", 0);
                spawn.Xc = cq_gen.ReadUInt16("cq_generator", "bound_cx", 0);
                spawn.Yc = cq_gen.ReadUInt16("cq_generator", "bould_cy", 0);
                spawn.MaxMobs = cq_gen.ReadUInt32("cq_generator", "maxnpc", 0);
                spawn.RestSecs = cq_gen.ReadUInt16("cq_generator", "rest_secs", 0);
                spawn.SpawnAmount = cq_gen.ReadUInt32("cq_generator", "max_per_gen", 0);
                spawn.MobID = cq_gen.ReadUInt32("cq_generator", "npctype", 0);

                Kernel.MobSpawns.Add(spawn.SpawnID, spawn);
            }
            Console.WriteLine("Monster Spawns Loaded [{0}]", Kernel.MobSpawns.Count);
        }
I've put this in Database.cs :
Code:
        public static void SpawnMobs()
        {
            foreach (MobSpawn spawn in Kernel.MobSpawns.Values)
            {
                Monster ThisMob = new Monster();
                foreach (Monster mob in Kernel.Mobs.Values)
                {
                    if (mob.ID == spawn.MobID)
                    {
                        ThisMob = mob;
                        break;
                    }
                }

                for (uint i = 0; i < spawn.SpawnAmount; i++)
                {
                    Entity newMob = new Entity(EntityFlag.Monster, null);
                    newMob.Action = ConquerAction.None;
                    newMob.Dead = false;
                    newMob.Defence = (ushort)ThisMob.Defence;
                    newMob.Dodge = (sbyte)ThisMob.Dodge;
                    newMob.Facing = (ConquerAngle)Global.Random.Next(0, 9);
                    newMob.Hitpoints = ThisMob.Life;
                    newMob.MaxHitpoints = ThisMob.Life;
                    newMob.Level = (byte)ThisMob.Level;
                    newMob.MagicAttack = ThisMob.AttackMin;
                    newMob.MaxAttack = ThisMob.AttackMax;
                    newMob.MinAttack = ThisMob.AttackMin;
                    newMob.MDefence = (ushort)ThisMob.MagicDefence;
                    newMob.Model = ThisMob.Lookface;
                    newMob.Name = ThisMob.Name;
                    newMob.UID = (uint)Global.Random.Next(400000, 500000);
                    while (Kernel.eMonsters.ContainsKey(newMob.UID))
                        newMob.UID = (uint)Global.Random.Next(400000, 500000);
                    newMob.MapID = spawn.MapID;
                    newMob.X = (ushort)Global.Random.Next(
                        Math.Min(spawn.X, spawn.Xc),
                        Math.Max(spawn.X, spawn.Xc));
                    newMob.Y = (ushort)Global.Random.Next(
                        Math.Min(spawn.Y, spawn.Yc),
                        Math.Max(spawn.Y, spawn.Yc));

                    Kernel.eMonsters.Add(newMob.UID, newMob);
                }
            }

            Console.WriteLine("Monsters Spawned [{0}]", Kernel.eMonsters.Count);
        }
Dictionaries: <--- i've put these in Kernel.cs
Code:
        public static Dictionary<uint, Entity> eMonsters = new Dictionary<uint, Entity>();
        public static Dictionary<uint, Monster> Mobs = new Dictionary<uint, Monster>();
        public static Dictionary<uint, MobSpawn> MobSpawns = new Dictionary<uint, MobSpawn>();
Screen: <--- i've put this in the constructor of Screen.cs
Code:
                foreach (Entity mob in Kernel.eMonsters.Values)
                {
                    if (mob.MapID == Client.Entity.MapID)
                        if (Kernel.GetDistance(mob.X, mob.Y, Client.Entity.X, Client.Entity.Y) <= 24)
                        {
                            if (!mob.Dead)
                                mob.SendSpawn(Client);
                        }
                }
This is just a "alpha" code I guess you could say, it's prolly not the greatest, but it works.

I'm still working on lots more with monsters =P
Above i've written where I have put the codes :P
Is it good where I put it?
And I found some errors, I tryed to fix it:
My version of SpawnMobs (because of errors in the code of you :P
I've put //<--- Changed after things i changed :P
Code:
public static void SpawnMobs()
        {
            Monster ThisMob = new Monster(); //<--- Changed
            foreach (MobSpawn spawn in Kernel.MobSpawns.Values)
            {
                foreach (Monster mob in Kernel.Mobs.Values)
                {
                    if (mob.ID == spawn.MobID)
                    {
                        ThisMob = mob;
                        break;
                    }
                }

                for (uint i = 0; i < spawn.SpawnAmount; i++)
                {
                    Random Global = new Random(); //<--- Changed
                    Entity newMob = new Entity(EntityFlag.Monster, null);
                    newMob.Action = ConquerAction.None;
                    newMob.Dead = false;
                    newMob.Defence = (ushort)ThisMob.Defence;
                    newMob.Dodge = (sbyte)ThisMob.Dodge;
                    newMob.Facing = (ConquerAngle)Global.Next(0, 9);
                    newMob.Hitpoints = (int)ThisMob.Life; //<--- Changed
                    newMob.MaxHitpoints = (int)ThisMob.Life; //<--- Changed
                    newMob.Level = (byte)ThisMob.Level;
                    newMob.MagicAttack = ThisMob.AttackMin;
                    newMob.MaxAttack = ThisMob.AttackMax;
                    newMob.MinAttack = ThisMob.AttackMin;
                    newMob.MDefence = (ushort)ThisMob.MagicDefence;
                    newMob.Model = ThisMob.Lookface;
                    newMob.Name = ThisMob.Name;
                    newMob.UID = (uint)Global.Next(400000, 500000);
                    while (Kernel.eMonsters.ContainsKey(newMob.UID))
                        newMob.UID = (uint)Global.Next(400000, 500000);
                    newMob.MapID = spawn.MapID;
                    newMob.X = (ushort)Global.Next(
                        Math.Min(spawn.X, spawn.Xc),
                        Math.Max(spawn.X, spawn.Xc));
                    newMob.Y = (ushort)Global.Next(
                        Math.Min(spawn.Y, spawn.Yc),
                        Math.Max(spawn.Y, spawn.Yc));

                    Kernel.eMonsters.Add(newMob.UID, newMob);
                }
            }
            Console.WriteLine("Monsters Spawned [{0}]", Kernel.eMonsters.Count);
        }
I've put LoadMobs(); LoadMobSpawns(); SpawnMobs();
in LoadDatabase(); above Console.WriteLine("Database Loaded");

When I log in there are no monsters xD
You know what I did wrong? Thnx for sharing xD
taushif is offline  
Thanks
1 User
Old 05/16/2009, 12:58   #125

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
Try adding

Code:
Database.LoadMobs();
Database.LoadMobSpawns();
below Database.LoadDatabase in Progam.cs
Kiyono is offline  
Thanks
2 Users
Old 05/16/2009, 15:46   #126
 
elite*gold: 0
Join Date: Jul 2006
Posts: 46
Received Thanks: 3
Quote:
Originally Posted by Kiyono View Post
Try adding

Code:
Database.LoadMobs();
Database.LoadMobSpawns();
below Database.LoadDatabase in Progam.cs
I've done it and its same as what I did in last line in LoadDatabase()
If I add them without removing the same in LoadDatabase it gives an
error exception that it is already in the Dictionary that means that it runs
the function 2 times. So I removed them in LoadDatabase() and put them in
Program.cs but its the same result as I had :P no monsters :P
Thnx for the info tho I didnt know where LoadDatabase(); was executed,
but now i know ^^
taushif is offline  
Old 05/16/2009, 17:00   #127

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
Well I guess that I put
Code:
foreach (Entity mob in Kernel.eMonsters.Values)
                {
                    if (mob.MapID == Client.Entity.MapID)
                        if (Kernel.GetDistance(mob.X, mob.Y, Client.Entity.X, Client.Entity.Y) <= 24)
                        {
                            if (!mob.Dead)
                                mob.SendSpawn(Client);
                        }
                }
in the wrong place.

I have
Monster Class in Kernel.cs
Load Mobs in Database.cs
MobSpawn in Kernel.cs
Load Mobspawn in Database.cs
Dictionaries in Kernel.cs

//edit lmao I just noticed that I forgot to put in
Code:
public static void SpawnMobs()
Mobs still don't load though.
Kiyono is offline  
Old 05/17/2009, 03:18   #128
 
LordSesshomaru's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 48
Received Thanks: 15
Database.SpawnMobs()

I got 1 Tutule dove to spawn above the Cundtress
LordSesshomaru is offline  
Old 05/17/2009, 07:37   #129
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
I've got all the mobs to spawn =P
kinshi88 is offline  
Old 05/17/2009, 12:03   #130
 
elite*gold: 0
Join Date: Dec 2007
Posts: 618
Received Thanks: 213
tq bin database ftw!
alexbigfoot is offline  
Old 05/17/2009, 12:26   #131

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
D= I managed to spawn 1 Turtledove in the middle of TC.
Kiyono is offline  
Old 05/17/2009, 13:19   #132
 
elite*gold: 0
Join Date: Jul 2006
Posts: 46
Received Thanks: 3
Quote:
Originally Posted by kinshi88 View Post
I've got all the mobs to spawn =P
Hey Kinshi I got a question :P
Where exactly did u put this in Screen.cs?:

Code:
foreach (Entity mob in Kernel.eMonsters.Values)
                    {
                        if (mob.MapID == Client.Entity.MapID)
                            if (Kernel.GetDistance(mob.X, mob.Y, Client.Entity.X, Client.Entity.Y) <= 24)
                            {
                                if (!mob.Dead)
                                    mob.SendSpawn(Client);
                            }
                    }
taushif is offline  
Old 05/17/2009, 17:58   #133
 
LordSesshomaru's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 48
Received Thanks: 15
under the npc code in the Screen.cs
LordSesshomaru is offline  
Thanks
1 User
Old 05/17/2009, 21:30   #134

 
Kiyono's Avatar
 
elite*gold: 20
Join Date: Jun 2006
Posts: 3,296
Received Thanks: 925
I have it here
Code:
Dictionary<uint, INpc> Npcs;
                if (Kernel.Npcs.TryGetValue(Client.Entity.MapID, out Npcs))
                {
                    foreach (Entity mob in Kernel.eMonsters.Values)
                    {
                        if (mob.MapID == Client.Entity.MapID)
                            if (Kernel.GetDistance(mob.X, mob.Y, Client.Entity.X, Client.Entity.Y) <= 24)
                            {
                                if (!mob.Dead)
                                    mob.SendSpawn(Client);
                            }
                    }
                    foreach (KeyValuePair<uint, INpc> DE in Npcs)
                    {
                        INpc npc = DE.Value;
                        if (Kernel.GetDistance(npc.X, npc.Y, Client.Entity.X, Client.Entity.Y) <= 16)
                        {
                            npc.SendSpawn(Client);
                        }   
                    }
                }
                m_Screen = new IMapObject[ScreenDictionary.Count];
                ScreenDictionary.Values.CopyTo(m_Screen, 0);
            }
        }
And it only spawns 1 mob but all the other places I tried didn't spawned mobs at all so...
Suggestions?
Kiyono is offline  
Old 05/18/2009, 00:52   #135
 
elite*gold: 20
Join Date: Apr 2008
Posts: 2,281
Received Thanks: 913
Code:
        public void Reload(bool Clear, ConquerCallback Callback)
        {
            lock (ScreenDictionary)
            {
                if (Clear)
                    ScreenDictionary.Clear();
                else
                    Cleanup();
                foreach (GameClient pClient in Kernel.Clients)
                
                {
                    if (pClient.Identifier != Client.Identifier)
                    {
                        if (pClient.Entity.MapID == Client.Entity.MapID)
                        {
                            if (Kernel.GetDistance(pClient.Entity.X, pClient.Entity.Y, Client.Entity.X, Client.Entity.Y) <= 16)
                            {
                                pClient.Entity.SendSpawn(Client);
                                if (pClient.MyGuild != null)
                                {
                                    Guild.SendGuildName(Client, pClient.MyGuild);
                                    Guild.SendGuildInfo(pClient, Client, pClient.MyGuild);
                                    Guild.SendGuildInfo(pClient, pClient.MyGuild);
                                }
                                if (Callback != null)
                                    Callback.Invoke(Client.Entity, pClient.Entity);
                            }
                        }
                    }
                }
                foreach (Entity mob in Kernel.eMonsters.Values)
                {
                    if (mob.MapID == Client.Entity.MapID)
                        if (Kernel.GetDistance(mob.X, mob.Y, Client.Entity.X, Client.Entity.Y) <= 24)
                        {
                            if (!mob.Dead)
                                mob.SendSpawn(Client);
                        }
                }
                Dictionary<uint, INpc> Npcs;
                if (Kernel.Npcs.TryGetValue(Client.Entity.MapID, out Npcs))
                {
                    foreach (KeyValuePair<uint, INpc> DE in Npcs)
                    {
                        INpc npc = DE.Value;
                        if (Kernel.GetDistance(npc.X, npc.Y, Client.Entity.X, Client.Entity.Y) <= 16)
                            npc.SendSpawn(Client);
                    }
                }
                m_Screen = new IMapObject[ScreenDictionary.Count];
                ScreenDictionary.Values.CopyTo(m_Screen, 0);
            }
        }
kinshi88 is offline  
Thanks
1 User
Closed Thread


Similar Threads Similar Threads
[Huge-Release] All-In-One Basic NPC Scripts For The 5165 Source!
02/19/2010 - CO2 PServer Guides & Releases - 30 Replies
Well I'm sorry that I spammed the whole forum full of my posts So pro4never and .Ryu gave me the idea of making this All-In-One thread about all my NPC's! THESE ARE UPDATED DAILY! NOTE: TO PEOPLE... SOME OF THE CODES ARE NOT MADE BY ME! I USUALLY JUST FIXED/UPDATED THE BASIC ONES! SORRY I'M LEARNING ON HOW TO CODE! 1. Birth-Island-NPC's(The NPC text is not from "REAL CONQUER" SORRY!...) #region BirthOldGeneralYang case 425: {
[FINAL RELEASE]HuB- Source (BASIC) (Original LOTF easier workable)
11/14/2009 - CO2 PServer Guides & Releases - 25 Replies
#REMOVED
[RELEASE] Basic LOTF Source
09/03/2009 - CO2 PServer Guides & Releases - 17 Replies
hey this is a basic lotf source edited based off shadowco, if you dont like it then dont post here... flames will be told on!!! :D i will tell on you to the mods if you flame What it has... - LuckyTime - Guard - 24/7 GW



All times are GMT +1. The time now is 23:28.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.