Don't have a working UO client install, but try this:
To magic.cpp, add this near the top (before the spells)
Code: Select all
bool blockingSurround( SI16 srcX, SI16 srcY, SI08 srcZ, UI08 worldNumber, SI08 radius, SI16 &outX, SI16 &outY )
{
for( int x = -radius; x <= radius; ++x )
{
for( int y = -radius; y <radius>ValidSpawnLocation( srcX + x, srcY + y, srcZ, worldNumber );
if( foundSpot )
{
outX = srcX + x;
outY = srcY + y;
return true;
}
}
}
return false;
}
Now you'll want to change splSummonAir, splSummonDaemon, splSummonEarth, splSummonFire, splSummonWater and splRandom to this (note, you're only changing a couple of lines):
After the GetSkill check, add this:
Code: Select all
SI16 outX = -1, outY = -1;
bool foundSpot = blockingSurround( caster->GetX(), caster->GetY(), caster->GetZ(), caster->WorldNumber(), 1, outX, outY );
We want to change the SummonMonster call to a if checked one, so it should now look like:
Code: Select all
if( foundSpot )
Magic->SummonMonster( sock, caster, 2, outX, outY, caster->GetZ() );
else if( sock != NULL )
sock->sysmessage( "You cannot summon a creature here" );
return true;
Replacing the *2* in the SummonMonster() call with whatever is currently there.
If you want to do that, you'll need to pass in the direction to blockingSurround, and fiddle that piece of logic.
It looks like it should work (it'll only put a creature there if it can validly spawn there ... hmmm, late note, WON'T work for over water). And would be somewhat better than what is already there (blind assumption of caster's location + 1,1).
Edit: OK, that's a tad bizarre, the code didn't cut and paste properly. Should be updated now.
Edit 2: Still no joy ... something's screwing it up, because the form's accepting it properly, just displaying it incorrectly.