[FIXED] Character becomes criminal when two summons fight eachother

Found a bug in UOX3? Or experienced a server crash? Perhaps you've noticed a broken feature? Post the details here!
Post Reply
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Character becomes criminal when two summons fight eachother

Post by Xuri »

If a player character summons two elementals (for instance) and orders them to fight eachother, the player will become a criminal, despite there being a check in bool WillResultInCriminal( CChar *mChar, CChar *targ ) in uox3.cpp saying

Code: Select all

	else if( targ->GetOwnerObj() == mChar )
		return false;
After entering some debugging messages in said function, I noticed that the WillResultInCriminal check is run several times during the battle between the summoned creatures, and it seems to sometimes fail the GetOwnerObj check and instead return true under

Code: Select all

else if( targ->IsInnocent() )
just below the GetOwnerObj check in the code.
-= Ho Eyo He Hum =-
Grimson
Developer
Posts: 802
Joined: Sat Jun 04, 2005 1:52 am
Location: Germany
Has thanked: 0
Been thanked: 0

Post by Grimson »

After entering some debugging messages in said function, I noticed that the WillResultInCriminal check is run several times during the battle between the summoned creatures, and it seems to sometimes fail the GetOwnerObj check and instead return true under

Code: Select all

else if( targ->IsInnocent() )
just below the GetOwnerObj check in the code.
mChar is usually the attacking char, which in your case is one of the summoned creatures, not the char commanding the attack. As the creatures don't own each other the check will fail.
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

In which case you would need something like

Code: Select all

CChar *tOwner = targ->GetOwnerObj();
if( ValidateObject( tOwner ) )
{
	if( tOwner == mChar || tOwner == mChar->GetOwnerObj() )
		return false;
}
Scott
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

As a followup on this, the problem (as Xuri and I determined) is NPC's are able to summon blade spirits and energy vortices. Basically the system is currently only built to handle checking the immediate owner of a pet, rather than having nested pets.

A temporary fix is simply to disable the casting of EV and BS for NPC's, however in the long run I'd like to have a scriptable way for users to choose EXACTLY which spells each NPC can cast.

Furthermore, if we want NPC's to be able to summon (and thus become the owners of their summoned creatures) we need to have recursive owner checking, so when the pet of a pet attacks another pet with the same root owner the system doesn't flag the owner as criminal (pet actions directly effect the owners flag).
Scott
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Verified in 0.98-4.0. Summoned a couple of air elementals, had them attack each-other. After a few tries, I suddenly turned into a criminal in the middle of their fight.

Neither of the elementals seemed to summon a pet of it's own, though.
-= Ho Eyo He Hum =-
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

This one might have been fixed in 0.99.2, requires some more testing before we can say for sure, though.
-= Ho Eyo He Hum =-
Post Reply