Page 1 of 1

Creatures can be summoned inside walls

Posted: Fri Jul 07, 2006 7:30 pm
by Xuri
If standing on the west side of a wall, summoning a creature/elemental/daemon will make that summoned creature appear inside the wall east of the character, allowing it to walk out of the wall on the other side.

Basically a bug that allows people to attack other people through walls by summoning a creature and sending it through to the other side :P

Image
UOX3 needs to check the spawn location if it's a valid location for NPCs to move on, and pick a new one on a different side on the character if not.

Posted: Sun Jul 09, 2006 5:51 am
by Maarc
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.

Posted: Sun Jul 09, 2006 6:04 am
by giwo
Alternatively you can do a ValidSpawnLocation() on the target XY in SummonMonster() and just have it summon on the character if no or invalid target.

Not sure how OSI handled summoning (if it was infront of the caster or on the caster).

Posted: Sun Jul 09, 2006 6:41 am
by Xuri
Just tested the Summon Creature spell on the official shards, and at least in the current implementation they seem to be summoned to a random valid tile immediately next to the caster.

Posted: Sun Jul 09, 2006 5:20 pm
by giwo
Ok then, sounds like Maarcs code would be the best solution.

Note that we will still want to add the ValidSpawnLocation() check for the targeted summons (EV and BS, namely). As there is a chance the client would allow them to target an area that they shouldn't be able to summon a creature on.

Posted: Wed Jul 02, 2008 3:02 am
by Xuri
After summoning about 40 elementals in the same spot as in my original post in this thread, and not having any of the elementals spawn in the wall - this seems to be fixed.

hypothetically speaking.

Posted: Sat Oct 25, 2008 10:01 am
by dracuskaos
hypothetically speaking aren't the floor tiles supposed to actually represent 4 feet? If it doesn't break the server why not just remove the plus one and spawn the critter on the same tile as the player?

Or is this were I get a foam brick thrown at me?

Posted: Sun Oct 26, 2008 10:15 am
by Xuri
Nah, that's one solution - though this bug seems to have been fixed already. Unless you've ran into it yourself?