|
You last visited: Today at 23:48
Advertisement
help with mob spawns
Discussion on help with mob spawns within the CO2 Private Server forum part of the Conquer Online 2 category.
06/08/2010, 01:16
|
#1
|
elite*gold: 0
Join Date: Jul 2008
Posts: 36
Received Thanks: 1
|
help with mob spawns
i need help fixing this
Loaded 254 portals.
Loaded 1019 NPCs.
Loaded 40 Mobs.
Loaded 11147 items.
Loaded 172 Mob Spawns.
System.ArgumentOutOfRangeException: 'minValue' cannot be greater than maxValue.
Parameter name: minValue
at System.Random.Next(Int32 minValue, Int32 maxValue)
at COServer_Project.Mobs.SpawnAllMobs() in D:\CONQUER ONLINE SERVER STUFF\COServerProject\COServerProject1\COServerPro ject\Entities.cs:line 207
Loading Plus info done.
all i know is that with that error i cannot spawn more mobs
and on that line 207 it is
short spawn_x = (short)General.Rand.Next(Convert.ToInt16(ThisSpawn[3]), Convert.ToInt16(ThisSpawn[5]));
the whole section is
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))
{
UID = (uint)General.Rand.Next(400000, 500000);
}
SingleMob Mob = new SingleMob(spawn_x, spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), short.Parse(ThisMob[6]), short.Parse(ThisMob[7]), UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]));
AllMobs.Add(UID, Mob);
MobsSpawned++; ;
}
thats all the info i know about that the problem occurs at
|
|
|
06/08/2010, 01:56
|
#2
|
elite*gold: 0
Join Date: Oct 2009
Posts: 128
Received Thanks: 50
|
Code:
for (int n = 0; n < Convert.ToInt32(ThisSpawn[2]); n++)
{
uint UID = (uint)General.Rand.Next(400000, 500000);
short xMin = Convert.ToInt16(ThisSpawn[3]);
short xMax = Convert.ToInt16(ThisSpawn[5]);
if (xMin > xMax)
{
short temp = xMin;
xMin = xMax;
xMax = temp;
}
short spawn_x = (short)General.Rand.Next(xMin, xMax);
short yMin = Convert.ToInt16(ThisSpawn[4]);
short yMax = Convert.ToInt16(ThisSpawn[6]);
if (yMin > yMax)
{
short temp = yMin;
yMin = yMax;
yMax = temp;
}
short spawn_y = (short)General.Rand.Next(yMin, yMax);
while (AllMobs.Contains(UID))
{
UID = (uint)General.Rand.Next(400000, 500000);
}
SingleMob Mob = new SingleMob(spawn_x, spawn_y, Convert.ToInt16(ThisSpawn[7]), uint.Parse(ThisMob[3]), uint.Parse(ThisMob[3]), short.Parse(ThisMob[6]), short.Parse(ThisMob[7]), UID, ThisMob[2], int.Parse(ThisMob[1]), short.Parse(ThisMob[4]), (byte)General.Rand.Next(8), byte.Parse(ThisMob[5]));
AllMobs.Add(UID, Mob);
MobsSpawned++;
}
It's important to be able to read and understand the exceptions or errors that get thrown from methods. The issue in this case was that the contract for the System.Random.Next(Int32 minValue, Int32 maxValue) method is that the maxValue cannot be smaller than the minValue, and it was in your case. The code I've added checks to see if the minimum x range for the monster is not greater than the maximum x range, and the same for the y range, and if it is, then those ranges are switched. This should hopefully solve your problem. This was simple, and you should have be able to do it yourself. In the future, please take the time to make an attempt at fixing your problems, and if you're still having problems, show us what you've done to try and fix your issue, and we will help you from there. Don't expect someone to do the code for you every time.
|
|
|
06/10/2010, 21:26
|
#3
|
elite*gold: 40
Join Date: Sep 2006
Posts: 1,890
Received Thanks: 805
|
The only problem he had is that one of his MinX was bigger than his MaxX point.. When he put in the mob spawn..
|
|
|
06/10/2010, 21:59
|
#4
|
elite*gold: 0
Join Date: Oct 2009
Posts: 128
Received Thanks: 50
|
Quote:
Originally Posted by gerble93
The only problem he had is that one of his MinX was bigger than his MaxX point.. When he put in the mob spawn..
|
Yes, you've just reiterated what I've said with less detail. Instead of the OP searching through that list, the problem was solved using what they've provided. A rectangle is still a rectangle, even if its bounds are not ordered from least to greatest, therefore the fix was perfectly acceptable.
|
|
|
 |
Similar Threads
|
Can anyone help me with spawns
02/27/2009 - Conquer Online 2 - 1 Replies
can anyone tell me where the is the locations 0f the spawns for some monsters or route for example :turtledoves or bandits draw a route thanks!
|
Lab 2 spawns
01/24/2009 - Conquer Online 2 - 4 Replies
hey can anyone help me? im trying to find a really big spawn in lab 2. im a warrior so i only train with superman
|
other plvl spawns than main spawns
01/15/2009 - Conquer Online 2 - 3 Replies
hi there,
im on epvp since 3 years now but this is my first thread so dont kill me for sharing only :)
well what i wanted to know is, since gms work alot by hunting down botters, if someone can give me spawns (in coords) or maybe in the map(s) of serps, alienserps and basi which are not the mains. so noone else would find me afk on bot for plvl :o
thnx for your replies :)
|
Need a new map for spawns in MZ
03/05/2006 - Conquer Online 2 - 5 Replies
i need a new map for MZ. i cant find the old taks10.jpg and file its been replace w/ task10.pul..tnx.. :D
|
All times are GMT +1. The time now is 23:49.
|
|