Full Version : No Damage in Challenge Game
xmlspawner >>XMLPoint's Troubleshooting >>No Damage in Challenge Game
<< Prev | Next >>
jingz2k2- 03-06-2007
Hello,
I am able to install the xmlpoints and the server compiles fine. I am able to use [challenge against another player as well but there's no damage being dealt between the 2 characters that are in challenge..
We both turn orange but no damage can be done to one another. Shouldn't there be a wall to seperate the 2 players before a fight and disappears after a period of time(read set and go)?
Thank you for everything in advanced.
jingz
ArteGordon- 03-07-2007
are you sure you are testing it as players? Staff by default cannot be damaged. The challenge system doesnt change that.
Use the StaffCloak or some other method of changing your access level to player before testing.
There is no countdown. It is something that will be added.
jingz2k2- 03-08-2007
Hello and thank you for the reply.
Yes both characters are player characters. Both with Player as their accesslevel.
And do you think it is also because I missed adding some parts of the scripts you've provided?
Also is it possible that other players(audience) see the players(battling) in duel as invulnerable(YellowHealthBar)?
Thank you very much in advanced.
Jingz
ArteGordon- 03-08-2007
if other people see them as invul, then that's what they are. You may have region settings that are blocking harmful actions, or it may be something in your notoriety.cs.
When the players are not in a duel are they normally invul at that location?
You can post your notoriety.cs and I can take a look.
jingz2k2- 03-08-2007
Thanks artegordon for the reply.
I mean if you know of a code that can make other characters that are not involved in the duel to see the duelists as invulnerable.
About regions, I have tried the options:
Duel Here
Jhelom Fighting Pit
Luna Grand Arena
All three locations doesn't give damage.
Here is my notoriety script:

CODE
using System; using System.Collections; using System.Collections.Generic; using Server; using Server.Items;
using Server.Guilds;
using Server.Multis;
using Server.Mobiles;
using Server.Engines.PartySystem;
using Server.Factions;
using Server.Engines.XmlSpawner2;
namespace Server.Misc
{
public class NotorietyHandlers
{
public static void Initialize()
{
Notoriety.Hues[Notoriety.Innocent] = 0x59;
Notoriety.Hues[Notoriety.Ally] = 0x3F;
Notoriety.Hues[Notoriety.CanBeAttacked] = 0x3B2;
Notoriety.Hues[Notoriety.Criminal] = 0x3B2;
Notoriety.Hues[Notoriety.Enemy] = 0x90;
Notoriety.Hues[Notoriety.Murderer] = 0x22;
Notoriety.Hues[Notoriety.Invulnerable] = 0x35;
Notoriety.Handler = new NotorietyHandler( MobileNotoriety );
Mobile.AllowBeneficialHandler = new AllowBeneficialHandler( Mobile_AllowBeneficial );
Mobile.AllowHarmfulHandler = new AllowHarmfulHandler( Mobile_AllowHarmful );
}
private enum GuildStatus { None, Peaceful, Waring }
private static GuildStatus GetGuildStatus( Mobile m )
{
if( m.Guild == null )
return GuildStatus.None;
else if( ((Guild)m.Guild).Enemies.Count == 0 && m.Guild.Type == GuildType.Regular )
return GuildStatus.Peaceful;
return GuildStatus.Waring;
}
private static bool CheckBeneficialStatus( GuildStatus from, GuildStatus target )
{
if( from == GuildStatus.Waring || target == GuildStatus.Waring )
return false;
return true;
}
/*private static bool CheckHarmfulStatus( GuildStatus from, GuildStatus target )
{
if ( from == GuildStatus.Waring && target == GuildStatus.Waring )
return true;
return false;
}*/
public static bool Mobile_AllowBeneficial( Mobile from, Mobile target )
{
if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
return true;
#region Factions
Faction targetFaction = Faction.Find( target, true );
if( targetFaction != null )
{
if( Faction.Find( from, true ) != targetFaction )
return false;
}
#endregion
Map map = from.Map;
if( map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0 )
return true; // In felucca, anything goes
if( !from.Player )
return true; // NPCs have no restrictions
if( target is BaseCreature && !((BaseCreature)target).Controlled )
return false; // Players cannot heal uncontrolled mobiles
if(XmlPoints.AreInAnyGame(target))
return XmlPoints.AreTeamMembers(from,target);
if( from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young) )
return false; // Young players cannot perform beneficial actions towards older players
Guild fromGuild = from.Guild as Guild;
Guild targetGuild = target.Guild as Guild;
if( fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly( targetGuild )) )
return true; // Guild members can be beneficial
return CheckBeneficialStatus( GetGuildStatus( from ), GetGuildStatus( target ) );
}
public static bool Mobile_AllowHarmful( Mobile from, Mobile target )
{
if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
return true;
Map map = from.Map;
if( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
return true; // In felucca, anything goes
if( !from.Player && !(from is BaseCreature && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned)) )
{
if( !CheckAggressor( from.Aggressors, target ) && !CheckAggressed( from.Aggressed, target ) && target is PlayerMobile && ((PlayerMobile)target).CheckYoungProtection( from ) )
return false;
return true; // Uncontrolled NPCs are only restricted by the young system
}
if (XmlPoints.AreChallengers(from, target))
return true;
Guild fromGuild = GetGuildFor( from.Guild as Guild, from );
Guild targetGuild = GetGuildFor( target.Guild as Guild, target );
if( fromGuild != null && targetGuild != null && (fromGuild == targetGuild || fromGuild.IsAlly( targetGuild ) || fromGuild.IsEnemy( targetGuild )) )
return true; // Guild allies or enemies can be harmful
if( target is BaseCreature && (((BaseCreature)target).Controlled || (((BaseCreature)target).Summoned && from != ((BaseCreature)target).SummonMaster)) )
return false; // Cannot harm other controlled mobiles
if( target.Player )
return false; // Cannot harm other players
if( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) )
{
if( Notoriety.Compute( from, target ) == Notoriety.Innocent )
return false; // Cannot harm innocent mobiles
}
return true;
}
public static Guild GetGuildFor( Guild def, Mobile m )
{
Guild g = def;
BaseCreature c = m as BaseCreature;
if( c != null && c.Controlled && c.ControlMaster != null )
{
c.DisplayGuildTitle = false;
if( c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder == OrderType.Attack || c.ControlOrder == OrderType.Guard) )
g = (Guild)(c.Guild = c.ControlMaster.Guild);
else if( c.Map == Map.Internal || c.ControlMaster.Guild == null )
g = (Guild)(c.Guild = null);
}
return g;
}
public static int CorpseNotoriety( Mobile source, Corpse target )
{
if( target.AccessLevel > AccessLevel.Player )
return Notoriety.CanBeAttacked;
Body body = (Body)target.Amount;
BaseCreature cretOwner = target.Owner as BaseCreature;
if( cretOwner != null )
{
Guild sourceGuild = GetGuildFor( source.Guild as Guild, source );
Guild targetGuild = GetGuildFor( target.Guild as Guild, target.Owner );
if( sourceGuild != null && targetGuild != null )
{
if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
return Notoriety.Ally;
else if( sourceGuild.IsEnemy( targetGuild ) )
return Notoriety.Enemy;
}
Faction srcFaction = Faction.Find( source, true, true );
Faction trgFaction = Faction.Find( target.Owner, true, true );
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
return Notoriety.Enemy;
if( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) )
return Notoriety.CanBeAttacked;
int actual = Notoriety.CanBeAttacked;
if( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) )
actual = Notoriety.Murderer;
if( DateTime.Now >= (target.TimeOfDeath + Corpse.MonsterLootRightSacrifice) )
return actual;
Party sourceParty = Party.Get( source );
List<Mobile> list = target.Aggressors;
for( int i = 0; i < list.Count; ++i )
{
if( list[i] == source || (sourceParty != null && Party.Get( list[i] ) == sourceParty) )
return actual;
}
return Notoriety.Innocent;
}
else
{
if( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && (((BaseCreature)target.Owner).AlwaysMurderer || ((BaseCreature)target.Owner).IsAnimatedDead)) )
return Notoriety.Murderer;
if( target.Criminal )
return Notoriety.Criminal;
Guild sourceGuild = GetGuildFor( source.Guild as Guild, source );
Guild targetGuild = GetGuildFor( target.Guild as Guild, target.Owner );
if( sourceGuild != null && targetGuild != null )
{
if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
return Notoriety.Ally;
else if( sourceGuild.IsEnemy( targetGuild ) )
return Notoriety.Enemy;
}
Faction srcFaction = Faction.Find( source, true, true );
Faction trgFaction = Faction.Find( target.Owner, true, true );
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
{
List<Mobile> secondList = target.Aggressors;
for( int i = 0; i < secondList.Count; ++i )
{
if( secondList[i] == source || secondList[i] is BaseFactionGuard )
return Notoriety.Enemy;
}
}
if( target.Owner != null && target.Owner is BaseCreature && ((BaseCreature)target.Owner).AlwaysAttackable )
return Notoriety.CanBeAttacked;
if( CheckHouseFlag( source, target.Owner, target.Location, target.Map ) )
return Notoriety.CanBeAttacked;
if( !(target.Owner is PlayerMobile) && !IsPet( target.Owner as BaseCreature ) )
return Notoriety.CanBeAttacked;
List<Mobile> list = target.Aggressors;
for( int i = 0; i < list.Count; ++i )
{
if( list[i] == source )
return Notoriety.CanBeAttacked;
}
return Notoriety.Innocent;
}
}
public static int MobileNotoriety( Mobile source, Mobile target )
{
if( Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier) )
return Notoriety.Invulnerable;
if( target.AccessLevel > AccessLevel.Player )
return Notoriety.CanBeAttacked;
if( source.Player && !target.Player && source is PlayerMobile && target is BaseCreature )
{
BaseCreature bc = (BaseCreature)target;
if( !bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType() )
return Notoriety.Enemy;
}
if( target.Kills >= 5 || (target.Body.IsMonster && IsSummoned( target as BaseCreature ) && !(target is BaseFamiliar) && !(target is Golem)) || (target is BaseCreature && (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead)) )
return Notoriety.Murderer;
if( target.Criminal )
return Notoriety.Criminal;
if (XmlPoints.AreTeamMembers(source, target))
return Notoriety.Ally;
else
if (XmlPoints.AreChallengers(source, target))
return Notoriety.Enemy;
Guild sourceGuild = GetGuildFor( source.Guild as Guild, source );
Guild targetGuild = GetGuildFor( target.Guild as Guild, target );
if( sourceGuild != null && targetGuild != null )
{
if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
return Notoriety.Ally;
else if( sourceGuild.IsEnemy( targetGuild ) )
return Notoriety.Enemy;
}
Faction srcFaction = Faction.Find( source, true, true );
Faction trgFaction = Faction.Find( target, true, true );
if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
return Notoriety.Enemy;
if( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains( source ) )
return Notoriety.CanBeAttacked;
if( target is BaseCreature && ((BaseCreature)target).AlwaysAttackable )
return Notoriety.CanBeAttacked;
if( CheckHouseFlag( source, target, target.Location, target.Map ) )
return Notoriety.CanBeAttacked;
if( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) )
{
if( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !Server.Spells.Necromancy.TransformationSpell.UnderTransformation( target ) )
return Notoriety.CanBeAttacked;
}
if( CheckAggressor( source.Aggressors, target ) )
return Notoriety.CanBeAttacked;
if( CheckAggressed( source.Aggressed, target ) )
return Notoriety.CanBeAttacked;
if( target is BaseCreature )
{
BaseCreature bc = (BaseCreature)target;
if( bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source )
return Notoriety.CanBeAttacked;
}
if( source is BaseCreature )
{
BaseCreature bc = (BaseCreature)source;
Mobile master = bc.GetMaster();
if( master != null && CheckAggressor( master.Aggressors, target ) )
return Notoriety.CanBeAttacked;
}
return Notoriety.Innocent;
}
public static bool CheckHouseFlag( Mobile from, Mobile m, Point3D p, Map map )
{
BaseHouse house = BaseHouse.FindHouseAt( p, map, 16 );
if( house == null || house.Public || !house.IsFriend( from ) )
return false;
if( m != null && house.IsFriend( m ) )
return false;
BaseCreature c = m as BaseCreature;
if( c != null && !c.Deleted && c.Controlled && c.ControlMaster != null )
return !house.IsFriend( c.ControlMaster );
return true;
}
public static bool IsPet( BaseCreature c )
{
return (c != null && c.Controlled);
}
public static bool IsSummoned( BaseCreature c )
{
return (c != null && /*c.Controlled &&*/ c.Summoned);
}
public static bool CheckAggressor( List<AggressorInfo> list, Mobile target )
{
for( int i = 0; i < list.Count; ++i )
if( list[i].Attacker == target )
return true;
return false;
}
public static bool CheckAggressed( List<AggressorInfo> list, Mobile target )
{
for( int i = 0; i < list.Count; ++i )
{
AggressorInfo info = list[i];
if( !info.CriminalAggression && info.Defender == target )
return true;
}
return false;
}
}
}

I have added the codes that is in the instructions but I guess there is something wrong, just as you said..
ArteGordon, thank you very much for your patience and help. I really appreciate it. Sorry for all the trouble.
Thanks again
jingz
ArteGordon- 03-08-2007
do you have any other system (challenge system, pvp system, etc.) installed that adds a Mobile.AllowHarmful handler like

CODE
Mobile.AllowHarmfulHandler = new AllowHarmfulHandler( Mobile_AllowHarmful );

The mods for the XmlPoints system that you made to notoriety.cs are all correct.
jingz2k2- 03-08-2007
*Sighs*
Sorry ArteGordon. I've been checking but I don't know if they add that code. I've installed a lot of other systems. These are what I have added so far:
xmlspawner
-golddraco13-
region effects system
sickness system
hunting system
-liacs-
time/whether+season changer
barbershop
-xanthos-
jailing
auction
-lucid nagual-
advanced archery
:edit:
-roningt-
Advanced Animal Taming System
these are the only systems i've added.
ArteGordon- 03-08-2007
use AgentRansack (see the Files forum) to search for this string in your scripts

QUOTE
AllowHarmfulHandler

jingz2k2- 03-09-2007
Hi ArteGordon,
thanks for introducing agent ransack to me. It was most helpful.
I did a search on 'AllowHarmfulHandler' in the Scripts folder and it gave me 2 results.
First was the Notoriety.cs and the other one was Scripts.CS.dll which was located in Scripts\Output\ folder.
ArteGordon- 03-09-2007
puzzling. If people dont challenge each other, are they able to attack each other and do damage (normal criminal/red pvp)?
It sounds like a region issue. You might go to those regions and type "[where" and see what it reports as the region.
You could also try adding a ChallengeGameRegion and see whether they are able to fight there (which they should be able to do).
Place a ChallengeRegionStone, double click it, and define the bounds of the region.
Then do a "[where" to confirm that the challenge game region has sufficient priority to override whatever region might have been there. If it worked, it should report the region as a "Challenge Game Region".
In that region, only people engaged in a challenge duel or game should be able to do damage to each other.
jingz2k2- 03-09-2007
Ohhhhhh I've just tried what you've said....
You're right..
Nothing wrong with XmlPoints then... There's no damage at all when it's player vs player. Oh noes....
Do you happen to have any other alternative solutions to this?
-Edit-
I have tried ChallengeGameRegion already but there's no damage still.
ArteGordon- 03-09-2007
Did you try doing the "[where" command in the challenge game region? What did it say?
If it isnt a region issue, then it sounds like it could be a problem with the CanBeHarmful method in PlayerMobile.cs.
If you post it, I can take a look. You dont need to post the entire script, just the CanBeHarmful method around line 925
jingz2k2- 03-09-2007
Yes I have tried the [where method but still the same results:
Here is the part you are asking for in my playermobile.cs:

CODE
public override bool CanBeHarmful( Mobile target, bool message, bool ignoreOurBlessedness ) { if ( m_DesignContext != null || (target is PlayerMobile && ((PlayerMobile)target).m_DesignContext != null) ) return false; if ( (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier )
{
if ( message )
{
if ( target.Title == null )
SendMessage( "{0} the vendor cannot be harmed.", target.Name );
else
SendMessage( "{0} {1} cannot be harmed.", target.Name, target.Title );
}
return false;
}
return base.CanBeHarmful( target, message, ignoreOurBlessedness );
}

Thank you very much ArteGordon for being really patient with my issue. I really appreciate all this.
ArteGordon- 03-09-2007
when you do the "[where" command, I just need to know exactly what it says.
Also, check the Blessed flag on your players. Use the "[get blessed" command and target the player.
jingz2k2- 03-09-2007
[where:
You are at 1400 3745 -21 in Felucca
Your region is Challenge Game Region
[get blessed:
Blessed = False