RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Zippy's CTF Script Re-Re-Release

Status
Not open for further replies.

KainElderan

Wanderer
Our server just recently installed this, and the only problem we've had so far is that when players die with the flag, their robes remain yellow when they get ressed. Is there any way to fix this? Other than that, its an awesome script. I also have tested 2 games, they haven't interfered on my test server. Thanks.

Kain Elderan
 

Forsaken911

Wanderer
oddly still....i have the ctfgame.cs, but the server doesnt recognize the script or something, i cant [add ctfgame. *gives up*
 

al-

Wanderer
wow im glad people are still enjoying the scripts, and thanks shiny for fixing up the bugs.

To anyone using them I found the best games were in a small arena, say make a custom one in green aches. I made 2 team coloured forts with a seperate room where dead players can spawn and prepare themselves, with a teleporter back into the arena. So theres no reskilling.
 

Duo

Wanderer
We recently added this script to our shard, but found that it turned everything blue... we came here, and saw the fix above, however, it didn't fix it. And thus this post :)

At anyrate, we cannot find anything in the Notoriety.cs that would make them all blue, and we know that other's have had the same problem. However, the above fix above didn't help us, we figured we would seek out some help.

Thanks in advance.
 

lordomega

Wanderer
For those having a problem with the blue names, be sure you have a stone loaded and set up, that will usually fix the problem. Has anyone had a problem with the AutoSupplier giving too many items? As in, you can continuously double-click it and recieve an endless supply of items. The problem with this is it seems that during teamchange the script uses the same check it does for when you first enter, so all of the extra items get banked, and not deleted.
 

XLordX

Wanderer
CTF

im using beta35, and the script you posted sh1ny, yet autores isnt working, any ideas why?

Also i saw on another server that their CTF script did so all player guilds was hidden, and instead everyone on same teams, had a team title above their heads (pretty cool), so like each team was one big guild.

Also anyone know where i can find an autosupply stone that doesnt have to be linked with CTF to work?
like a common Reagent stone.

thx ;)
 

mebane2

Wanderer
For b36 users running CTF, here are the GameRegion.cs and Notoriety.cs files that "should" work for b36. Atleast they compile without an error message. Unf I am just building my shard so don't really have a way to test them to see if I made some kinda logic mistake. But if you find one, let me know and I will see if I can fix it.

As you can see by the thread, this aint my code. Just trying to help some peeps out with the move to b36 :)

GameRegion.cs
[code:1]
using Server;
using System;
using Server.Items;
using System.Collections;
using Server.Spells.Third;
using Server.Spells.Fifth;
using Server.Spells.Eighth;
using Server.Spells.Fourth;
using Server.Spells.Sixth;
using Server.Spells.Seventh;
using Server.Spells.Necromancy;
using Server.Spells.Chivalry;
using System.Text;

namespace Server.Regions
{
public class CtfGameRegion : Region
{
public static void Initialize()
{
Region.AddRegion( new CtfGameRegion() );
}

public CtfGameRegion() : base( "", "CTF Game", Map.Felucca )
{
Priority = Region.HighestPriority;
LoadFromXml = false;

this.Coords = new ArrayList( 1 );
this.Coords.Add( new Rectangle2D( 6031 ,400, 100, 100 ) );//ctf ( topleft, bottomright, width, height )
this.Coords.Add( new Rectangle2D( 5901, 270, 96, 95 ) );//dd ( topleft, bottomright, width, height )
}

public override bool CanUseStuckMenu( Mobile m )
{
return false;
}

public override bool OnBeginSpellCast( Mobile m, ISpell s )
{
if ( m.AccessLevel == AccessLevel.Player &&
( s is MarkSpell || s is RecallSpell || s is GateTravelSpell || s is PolymorphSpell ||
s is SummonDaemonSpell || s is AirElementalSpell || s is EarthElementalSpell || s is EnergyVortexSpell ||
s is FireElementalSpell || s is WaterElementalSpell || s is BladeSpiritsSpell || s is SummonCreatureSpell || s is VengefulSpiritSpell || s is SummonFamiliarSpell || s is SacredJourneySpell || s is ParalyzeFieldSpell || s is EnergyFieldSpell || s is WallOfStoneSpell ) )
{
m.SendMessage( "That spell is not allowed." );
return false;
}
else
return base.OnBeginSpellCast( m, s );
}

public override bool AllowHousing( Mobile from, Point3D p )
{
if ( from.AccessLevel == AccessLevel.Player )
return false;
else
return true;
}

public override void AlterLightLevel( Mobile m, ref int global, ref int personal )
{
global = LightCycle.DungeonLevel;
}

public override bool OnSingleClick( Mobile from, object o )
{
if ( o is Mobile )
{
Mobile m = (Mobile)o;

for (int i=0;i<CTFGame.Registry.Count;i++)
{
CTFGame game = (CTFGame)CTFGame.Registry;
CTFTeam team = game.FindTeam( m );
if ( team != null )
{
string msg;
Item[] items;

if ( m.Backpack != null )
items = m.Backpack.FindItemsByType(typeof(CTFFlag));
else
items = new Item[0];

if ( items.Length == 0 )
{
msg = String.Format( "(Team: {0})", team.Name );
}
else
{
StringBuilder sb = new StringBuilder("(Team: " );
sb.Append( team.Name );
sb.Append( "; Flag" );
if ( items.Length > 1 )
sb.Append( "s" );
sb.Append( ": " );

for(int j=0;j<items.Length;j++)
{
CTFFlag flag = (CTFFlag)items[j];

if ( flag != null && flag.Team != null )
{
if ( j > 0 )
sb.Append( ", " );

sb.Append( flag.Team.Name );
}
}

sb.Append( ")" );

msg = sb.ToString();
}
m.PrivateOverheadMessage( Network.MessageType.Regular, team.Hue, true, msg, from.NetState );
break;
}
}
}
return true;
}
}
}
[/code:1]

Notoriety.cs
[code:1]using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Guilds;
using Server.Multis;
using Server.Mobiles;

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 ( 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 )
return true;

Map map = from.Map;

// Added for CTF game by sh1ny
for (int i=0;i<CTFGame.Registry.Count;i++)
{
CTFGame game = (CTFGame)CTFGame.Registry;

CTFTeam ft = game.FindTeam( from );
CTFTeam tt = game.FindTeam( target );

if ( ft != null && tt != null && ft != tt )
return false;
}

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).Controled )
return false; // Players cannot heal uncontroled mobiles

Guild fromGuild = from.Guild;
Guild targetGuild = target.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 )
return true;

Map map = from.Map;

// Added for CTF game by sh1ny
for (int i=0;i<CTFGame.Registry.Count;i++)
{
CTFGame game = (CTFGame)CTFGame.Registry;

CTFTeam ft = game.FindTeam( from );
CTFTeam tt = game.FindTeam( target );

if ( ft != null && tt != null && ft == tt )
return false;
}

if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
return true; // In felucca, anything goes

if ( !from.Player && !(from is BaseCreature && (((BaseCreature)from).Controled || ((BaseCreature)from).Summoned)) )
return true; // Uncontroled NPCs have no restrictions

Guild fromGuild = GetGuildFor( from.Guild, from );
Guild targetGuild = GetGuildFor( target.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).Controled )
return false; // Cannot harm other controled 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.Controled && c.ControlMaster != null )
{
c.DisplayGuildTitle = false;

if ( c.Map != Map.Internal && (c.ControlOrder == OrderType.Attack || c.ControlOrder == OrderType.Guard) )
g = c.Guild = c.ControlMaster.Guild;
else if ( c.Map == Map.Internal || c.ControlMaster.Guild == null )
g = 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;

//Added for CTF game by sh1ny
Guild sourceGuild = GetGuildFor( source.Guild, source );
Guild targetGuild = GetGuildFor( target.Guild, target.Owner );
for (int i=0;i<CTFGame.Registry.Count;i++)
{
CTFGame game = (CTFGame)CTFGame.Registry;

CTFTeam ft = game.FindTeam( source );
CTFTeam tt = game.FindTeam( target.Owner );

if ( ft != null && tt != null )
{
if ( ft == tt )
return Notoriety.Ally;
else
return Notoriety.Enemy;
}
else
{//changed to here

if ( target.Kills >= 5 || (body.IsMonster && IsSummoned( target.Owner as BaseCreature )) || (target.Owner is BaseCreature && ((BaseCreature)target.Owner).AlwaysMurderer) )
return Notoriety.Murderer;

if ( target.Criminal )
return Notoriety.Criminal;

//Guild sourceGuild = GetGuildFor( source.Guild, source );
//Guild targetGuild = GetGuildFor( target.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;
}
}//Added for CTF game by sh1ny
}//Added for CTF game by sh1ny

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, source );
// Guild targetGuild = GetGuildFor( target.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;
}

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 ( !body.IsHuman && !body.IsGhost && !IsPet( target.Owner as BaseCreature ) )
return Notoriety.CanBeAttacked;

ArrayList list = target.Aggressors;

for ( int i = 0; i < list.Count; ++i )
{
if ( list == 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.Controled && ((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;

Guild sourceGuild = GetGuildFor( source.Guild, source );
Guild targetGuild = GetGuildFor( target.Guild, target );

if ( sourceGuild != null && targetGuild != null )
{
if ( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
return Notoriety.Ally;
else if ( sourceGuild.IsEnemy( targetGuild ) )
return Notoriety.Enemy;
}

//Added for CTF game by sh1ny
for (int i=0;i<CTFGame.Registry.Count;i++)
{
CTFGame game = (CTFGame)CTFGame.Registry;

CTFTeam ft = game.FindTeam( source );
CTFTeam tt = game.FindTeam( target );

if ( ft != null && tt != null )
{
if ( ft == tt )
return Notoriety.Ally;
else
return Notoriety.Enemy;
}
else
{//Added for CTF game by sh1ny
if ( target.Kills >= 5 || (target.Body.IsMonster && IsSummoned( target as BaseCreature ) && !(target is BaseFamiliar) && !(target is Golem)) || (target is BaseCreature && ((BaseCreature)target).AlwaysMurderer) )
return Notoriety.Murderer;

if ( target.Criminal )
return Notoriety.Criminal;

//Guild sourceGuild = GetGuildFor( source.Guild, source );
//Guild targetGuild = GetGuildFor( target.Guild, target );

if ( sourceGuild != null && targetGuild != null )
{
if ( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
return Notoriety.Ally;
else if ( sourceGuild.IsEnemy( targetGuild ) )
return Notoriety.Enemy;
}
}//Added for CTF game by sh1ny
}//Added for CTF game by sh1ny

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 ) )
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.Controled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source )
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.Controled && c.ControlMaster != null )
return !house.IsFriend( c.ControlMaster );

return true;
}

public static bool IsPet( BaseCreature c )
{
return ( c != null && c.Controled );
}

public static bool IsSummoned( BaseCreature c )
{
return ( c != null && /*c.Controled &&*/ c.Summoned );
}

public static bool CheckAggressor( ArrayList list, Mobile target )
{
for ( int i = 0; i < list.Count; ++i )
if ( ((AggressorInfo)list).Attacker == target )
return true;

return false;
}

public static bool CheckAggressed( ArrayList list, Mobile target )
{
for ( int i = 0; i < list.Count; ++i )
{
AggressorInfo info = (AggressorInfo)list;

if ( !info.CriminalAggression && info.Defender == target )
return true;
}

return false;
}
}
}
[/code:1]
 
Hey, stupid question... :oops: how do i define a region, this was already asked but not answered... i would really appreciate an answer.

Thanks in advance.
 

dominus

Wanderer
i have founded 2 crashes :D.

First: I created a 2 team ctf i placed and linked all stones & items, I actived the game and removed all things except a flag well configured, if any palyer "Double click" the flag, the server crash

[code:1]

Server Crash Report
===================

Operating System: Microsoft Windows NT 5.1.2600.0
.NET Framework: 1.1.4322.573
Time: 14/01/2004 14:02:20
Mobiles: 16604
Items: 187923
Clients:
- Count: 3
+ ***.**.**.**: (account = ****) (mobile = 0x7F61 '******')
+ ***.***.***.**: (account = ******) (mobile = 0x7EE '***********')
+ ***.**.**.**: (account = *****) (mobile = 0x7 '****')

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.CTFGame.FindTeam(Int32 uid)
at Server.Items.CTFFlag.UpdateTeam()
at Server.Items.CTFFlag.OnDoubleClick(Mobile from)
at Server.Mobile.Use(Item item)
at Server.Network.PacketHandlers.UseReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)

[/code:1]

the second i dont know what produce it

[code:1]

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Items.CTFGame.PlayerMessage(String message)
at Server.Items.ScoreTimer.OnTick()
at Server.Timer.Slice()
at Server.Core.Main(String[] args)

[/code:1]


abybody can help me?? :(
 

Divorios

Wanderer
the link doesnt work could anybody repost or anyone have a mirror or anything that i could please get the script?
 

Dark Jewel

Wanderer
define ....... make it happen in fel ........

Make the game take place in fel, in one of the Unspawned area's. This way they cannot recall in or out. Until game is over. granted, some troubles, with having to get players there manually, But otherwise a simple solution to your issue of preventitive banking.
 
Status
Not open for further replies.
Top