Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 12:55

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


[How to add monsters in Hellmouth]

Discussion on [How to add monsters in Hellmouth] within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2010
Posts: 85
Received Thanks: 0
[How to add monsters in Hellmouth]

Hey guys,

I dont know what Im doing wrong

I added a MySqlReader for the MobSpawns
Quote:
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");


}
but there are no spawns at all..
so I looked in Spawn.cs

Quote:
public class MobSpawn
{
public Mob MobCoords(Mob M)
{
M.X = (ushort)Program.Rand.Next(X - Spread, Y + 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)

{
try
{
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);

}
for (uint I = 0; I < Amount; I++)
{
Mob M = new Mob();
M.Map = BindMap;
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.MobCounter += Amount;
}

catch (Exception E) { Console.WriteLine(E.ToString()); }
}
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;

}
}
I added a catch (Exception E) { Console.WriteLine(E.ToString()); } to gimme the errors,

and it said

Object reference is not set to an instance of an object,
I don't know how to solve this prob, Any advice?
Im still a learner , so a little help would be very appriciated

thanks in advance



HackProvider is offline  
Old 03/09/2011, 20:14   #2
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,347
What line is giving the null reference exception.

Chances are it's not reading in all the values.


pro4never is offline  
Old 03/09/2011, 20:53   #3
 
elite*gold: 0
Join Date: Dec 2010
Posts: 85
Received Thanks: 0
The errors are in line 36 and in line 40 as you can see on the attached file



thanks

Lines
36 M = MobCoords(M);
37 int Tries = 10;
38 while (Tries > 0 && !Calculations.FreeCoord(M.X, M.Y, M.Map, M.Instance))
39 { M = MobCoords(M); Tries--; }
40 M.UID = this.Map.MobCounter + I;
41 }
42 Map.MobCounter += Amount;
Attached Images
File Type: jpg Error.jpg (310.9 KB, 76 views)
HackProvider is offline  
Old 03/09/2011, 22:40   #4
 
elite*gold: 0
Join Date: Apr 2009
Posts: 751
Received Thanks: 432
probably M (guessing that is the monster) is nulled... or the Map is nulled... check then ^^


12tails is offline  
Old 03/09/2011, 23:03   #5
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,160
What does the Count variable say, does it increase at all?
_Emme_ is offline  
Old 03/09/2011, 23:08   #6
 
elite*gold: 0
Join Date: Dec 2010
Posts: 85
Received Thanks: 0
Not sure but it says uint map.mobcounter ugh tried my best. What now? I guess i got no variable

Well i think my map is nulled,,, how can i fix it :s

* Still a C# Learner *
HackProvider is offline  
Old 03/10/2011, 16:37   #7
 
elite*gold: 0
Join Date: Mar 2011
Posts: 13
Received Thanks: 1
Hmm , would be awesome if someone could explain it a bit better, I got the same prob :S

Thanks in advance
RT-Gaming is offline  
Old 03/10/2011, 17:28   #8
 
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 369
Quote:
Originally Posted by RT-Gaming View Post
Hmm , would be awesome if someone could explain it a bit better, I got the same prob :S

Thanks in advance
Looking at join date, then I would assume you're HackProvider.
Syst3m_W1z4rd is offline  
Old 03/10/2011, 17:55   #9
 
elite*gold: 0
Join Date: Mar 2011
Posts: 13
Received Thanks: 1
@Syst3m_W1z4rd

I am sorry, I'm not , are there any problems with that o.0 Im new here, or do I have to leave this thread?
RT-Gaming is offline  
Old 03/10/2011, 20:36   #10
 
elite*gold: 0
Join Date: Nov 2010
Posts: 159
Received Thanks: 39
Quote:
Originally Posted by Syst3m_W1z4rd View Post
Looking at join date, then I would assume you're HackProvider.
Syst3m_W1z4rd

The Black Market: 0/0/0
Join Date: Nov 2010
And? WTF stop flame anothers!
S/W is offline  
Old 03/10/2011, 20:46   #11
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,347
So I just took a few seconds to open up the source...


Massive hint for you.

It's a total of 2 lines of code you need to add... and they are exactly related to what I said in the faq.

You need to add the monsters you are creating to the spawn and you need to add them to the map.

*gasp*

I'm sorry if my temper seems a tad short atm but this question has been brought up at LEAST 50 times in the past two days (seriously... every time I come back like 5 new ppl have added me on msn and that's the first thing they say) and it's getting a little old.

Adding the basic spawns is a very simple thing which I've essentially done for you. I suggest you read through the code and see what is missing... cause it's not missing much for that.

Movement/attacking/respawns/drops and anything advanced, you're on your own for that part (although I've also provided advice about that)
pro4never is offline  
Thanks
1 User
Old 03/10/2011, 21:59   #12
 
elite*gold: 0
Join Date: Nov 2010
Posts: 159
Received Thanks: 39
Quote:
Originally Posted by pro4never View Post
So I just took a few seconds to open up the source...


Massive hint for you.

It's a total of 2 lines of code you need to add... and they are exactly related to what I said in the faq.

You need to add the monsters you are creating to the spawn and you need to add them to the map.

*gasp*

I'm sorry if my temper seems a tad short atm but this question has been brought up at LEAST 50 times in the past two days (seriously... every time I come back like 5 new ppl have added me on msn and that's the first thing they say) and it's getting a little old.

Adding the basic spawns is a very simple thing which I've essentially done for you. I suggest you read through the code and see what is missing... cause it's not missing much for that.

Movement/attacking/respawns/drops and anything advanced, you're on your own for that part (although I've also provided advice about that)
Cool you are one of members in epvpers who make most guides in coding glad to see you here so long....
S/W is offline  
Old 03/11/2011, 15:00   #13
 
elite*gold: 0
Join Date: Oct 2008
Posts: 7
Received Thanks: 1
I've been looking for more than 3 hours now, but I can't find the solution :S
any tips/help

thanks


thomastur is offline  
Thanks
1 User
Reply



« Question About Effects/skills | Help me with server or let me be staff for $$ »

Similar Threads
[Dev] Hellmouth Revival
03/16/2011 - CO2 Private Server - 235 Replies
<Cleaned for personal use> NOTE: This is not related to the old hellmouth server. This is a private project which will most likely never see the light of day but I wanted a simple place for me to put my notes and document a few things.... Goals See how much the conquer client can be streamlined and turned into something that I feel is worthwhile playing. This will consist of the following steps...
New Npc for HellMouth source
03/08/2011 - CO2 PServer Guides & Releases - 3 Replies
Closed #
Question About Hellmouth
03/07/2011 - CO2 Private Server - 6 Replies
Well Maybe this is not the right section, But I'm going to post it here. This is a Personal question to pro4never (Chris) Why You Did THIS?? First, It's unfair to the minority who managed to update to 5365. I had to keep Trying and to Learn to do this, Now every leecher, Every guy who doesn't know a shit about programming can have 5365 Source. This is going to destroy the whole pserver community. It will be Just Like NewestCOServer. 412344543534 NPC Releases and 93243562652345 Requests....
HellMouth Client
02/18/2011 - CO2 Weapon, Armor, Effects & Interface edits - 17 Replies
Basically I've done the client for HellMouth and would like some feedback and some input to what can be done to improve it. The logo is already going to be removed since its blurry. Thanks. http://i47.tinypic.com/2i1h0km.png ## Updated -Removed Logo -Added new background to top and bottom I'm happy with what it has turned out as.
Question - How to set up Hellmouth source
06/03/2010 - CO2 Private Server - 0 Replies
delete pls



All times are GMT +2. The time now is 12:55.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

BTC: 3KeUpz52VCbhmLwuwydqxu6U1xsgbT8YT5
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

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