Full Version : restriction question
xmlspawner >>Scripting Support >>restriction question
<< Prev | Next >>
ambak- 01-25-2006
i want to make that if someone attacks someone and then want to run away to his/her house i want it to enter his/her house about a period of time later.
for example a player attacked b player and the a player run away to his house.when he goes over his house he couldnt get in there about 5 minutes.when he want to enter it will say "You cant run away from pvp easyly!You will wait 5 minutes!
ArteGordon- 01-25-2006
Under AOS rules, that is already the way that it works. It is controlled by the IsCombatRestricted method in BaseHouse.cs

CODE
public virtual bool IsCombatRestricted( Mobile m ) { if ( m == null || !m.Player || m.AccessLevel >= AccessLevel.GameMaster || !IsAosRules ) return false; for ( int i = 0; i < m.Aggressed.Count; ++i )
{
AggressorInfo info = (AggressorInfo)m.Aggressed[i];
Guild attackerGuild = m.Guild as Guild;
Guild defenderGuild = info.Defender.Guild as Guild;
if ( info.Defender.Player && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < HouseRegion.CombatHeatDelay && (attackerGuild == null || defenderGuild == null || defenderGuild != attackerGuild && !defenderGuild.IsEnemy( attackerGuild )) )
return true;
}
return false;
}

The time delay is set by the CombatHeatDelay in HouseRegion.cs

CODE
public static TimeSpan CombatHeatDelay = TimeSpan.FromSeconds( 30.0 );

If you want to send a custom message when that happens, just look in HouseRegion.cs in the OnLocationChange and OnMoveInto methods. For example

CODE
else if ( m_House.IsCombatRestricted( m ) && m_House.IsInside( m ) && !m_House.IsInside( oldLocation, 16 ) ) { m.Location = m_House.BanLocation; m.SendLocalizedMessage( 1061637 ); // You are not allowed to access this. }

ambak- 01-25-2006
thanks arte ill look at it..