[HELP] Coding Mobspawns

11/15/2011 01:57 pro4never#16
#albetros

I got scolded for spelling my own source wrong ;)

Yah I doubt I'll be releasing it fang. I keep considering it though just cause I have no use for it and I'm far too addicted to releasing stuff :P

@ OP: I've posted quite a lot of information on how to go about writing spawns (basics) into my source... I'd suggest digging through the FAQ thread I made for it some.

If you want to get them spawning, you can edit just like 5-10 lines of code (which I've posted most if not all of) and you'll have them all spawning properly.

You'll then still need to handle their movement/attacking/death/drops which is a bit trickier. Seeing as you're new with C#, I'd strongly suggest what I and others suggest to all new programmers...

Take a step back.

By this I mean don't focus so much on programming for CONQUER. Good programming habits are easy to learn... the first time around. Once you start copying poor code it gets in your head as how things should be done and at some point you'll need to go back and re-train yourself which is much more difficult.

There's plenty of programming tutorials all over the internet and I and others have posted some here on this site. I'd take a few weeks, read a book or two and start with some small programs so that you understand the basics of what C# is, what the basic syntax is, object oriented programming as well as the basics such as data types, conditional statements, loops, etc.

Knowing basic stuff like that will take you miles beyond what simply following guides on here or stumbling around blindly trying to add features will do for you.
11/15/2011 03:38 DaVinci1476#17
[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("Z"), r.ReadUInt16("Spread"), r.ReadUInt16("Map"));
Count += (uint)S.Members.Count;
}
Console.WriteLine(Program.Title + " Spawning " + Count + " monsters into the world");

}
public static void GetBaseMobs()
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
cmd.Select("Monsters");
MySqlReader r = new MySqlReader(cmd);
while (r.Read())
{
BaseMob M = new BaseMob();
M.Name = r.ReadString("Name");
M.MobID = r.ReadUInt32("UID");
M.Mesh = r.ReadUInt32("Mesh");
M.Level = r.ReadByte("Level");
M.MaxHp = r.ReadUInt32("Health");
M.AtkType = r.ReadUInt16("AttackType");
M.MinAtk = r.ReadUInt16("MinAtk");
M.MaxAtk = r.ReadUInt16("MaxAtk");
M.Pdef = r.ReadUInt16("Pdef");
M.Mdef = r.ReadUInt16("Mdef");
M.DropLvl = r.ReadByte("DropMaxLvl");
M.Range = r.ReadByte("AttackRange");
M.Dodge = r.ReadByte("Dodge");
M.Accuracy = r.ReadByte("Accuracy");
if (!Dictionary.BaseMobs.ContainsKey(M.MobID))
Dictionary.BaseMobs.Add(M.MobID, M);
}
Console.WriteLine(Program.Title + " Loaded " + Dictionary.BaseMobs.Count + " Base Monsters from database");
}[/code]

So I uncommented the database part.... I THINK. lol

But I'm using Visual C# Express, and I'm not used to the interface.... (I usually use NetBeans IDE 7.0.1) so i'm not sure how to find out which variables are wrong. and I'm watching TUTs on C# while I'm working on this =p I'm more of a hands on learner, and I'm not much of a book reader lol.
11/15/2011 04:10 Spirited#18
I agree with Chris.. you need to step back and code smaller things - focus on the concepts, not the features in Conquer. I'm pretty sure I wrote a thread about that... not that it's very good. I'm just a notice and I'm sure there's better advice out there. Look into C# with a bit more detail.

Edit: Found it...
[Only registered and activated users can see links. Click Here To Register...]
11/15/2011 05:07 DaVinci1476#19
I'm watching TUTs now =] Have you ever heard of TheNewBoston.com?
11/15/2011 06:52 Spirited#20
Quote:
Originally Posted by DaVinci1476 View Post
I'm watching TUTs now =] Have you ever heard of TheNewBoston.com?
I've heard of it from a friend but I haven't actually been to their website yet. I've also heard that they don't offer C#.
11/15/2011 11:00 -Sensei-#21
Quote:
Originally Posted by Fаng View Post
I've heard of it from a friend but I haven't actually been to their website yet. I've also heard that they don't offer C#.
They are , but in windows Application.
11/15/2011 17:05 DaVinci1476#22
Yeah, they use Visual C#, which is good, because I don't like mac xD