Full Version : SpawnRange bug?
xmlspawner >>Troubleshooting >>SpawnRange bug?
<< Prev | Next >>
LowCastle- 02-08-2006
I am using version 3.07. I'm not sure if this occured in previous versions. I just noticed it. Here's the problem:
When I set spawn range to 1, items SHOULD have 9 tiles to choose from (3x3 area) when they spawn. Setting spawnrange to 2 SHOULD spawn things in an area 5x5. At least, that is what I thought until I was spawning some chests in a small room.
When I set the spawnrange to 2, items will spawn in a 4x4 area, two tiles north and west of the spawner, but only one tile east and south of the spawner. When I set the spawnrange to 1, items will spawn in a 2x2 area, only one tile north and west of the spawner.
I tested all the way up to spawnrange=5, with the same results. If this is the way it was intended to work, that's fine. I can work with that. If not, I thought you should know.
ArteGordon- 02-08-2006
I will check that out.
(edit)
the problem is here, in the selection of random locations within the spawning area in the GetSpawnPosition method around line 8840 in xmlspawner2.cs
It should be adding 1 to the range used to generate random values.

QUOTE
if (packrange >= 0 && packcoord != Point3D.Zero) { // find a random coord relative to the packcoord x = packcoord.X - packrange + Utility.Random(packrange * 2 + 1); y = packcoord.Y - packrange + Utility.Random(packrange * 2 + 1);
} else
if (m_Region != null && HasRegionPoints(m_Region)) // 2004.02.08 :: Omega Red
{
// if region spawning is selected then use that to find an x,y loc instead of the spawn box
Point2D p = GetRandomRegionPoint(m_Region);
x = p.X;
y = p.Y;
}
else
{
if (m_Width > 0)
x = m_X + Utility.Random( m_Width + 1);
if (m_Height > 0)
y = m_Y + Utility.Random( m_Height + 1);
}

I will be adding this mod for the next release so you can go ahead and make it in your current version.
LowCastle- 02-08-2006
Thank you for the very quick response, and for the fix.