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!

[RunUO 2.0 RC 1] CTF

romanthebrain

Sorceror
got this error

PHP:
System.IndexOutOfRangeException: Der Index war außerhalb des Arraybereichs.
   bei Server.Items.CTFGame.StartTimer.OnTick()
   bei Server.Timer.Slice()
   bei Server.Core.Main(String[] args)
 

romanthebrain

Sorceror
Sry for double posting

but ive tried to fix this error for a long time...

i cannot find the answer for this bug ..:(

maybe is why im using RunUO2.0Final . Can anybody help me pls ?

whats wrong in the CTFgame.cs ?????
 

ThorsHammer

Wanderer
Got the Same Error

System.IndexOutOfRangeException: Der Index war außerhalb des Arraybereichs.
bei Server.Items.CTFGame.StartTimer.OnTick()
bei Server.Timer.Slice()
bei Server.Core.Main(String[] args)


every time i Start the CTF the MSG appears "The Game will start in 30 Second" after that msg the Server Crashes, anyone got a hint how too fix it?.

im using RUN UO 2 Final.
 
RunUO - [www.runuo.com] Version 2.1, Build 3995.28114
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Misc/Notoriety.cs:
CS0117: Line 332: 'Server.Spells.Necromancy.TransformationSpell' does not co
ntain a definition for 'UnderTransformation'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

jack-0

Traveler

Elvent

Page
Code:
RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Running with arguments: -debug
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Misc/Notoriety.cs:
    CS0101: Line 14: The namespace 'Server.Misc' already contains a definition f
or 'NotorietyHandlers'
    CS0102: Line 33: The type 'Server.Misc.NotorietyHandlers' already contains a
definition for 'GuildStatus'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

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;
 
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 )
                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 uncontroled mobiles
 
            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 )
                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; // Uncontroled NPCs are only restricted by the young system
            }
 
            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 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.Controlled && c.ControlMaster != null )
            {
                c.DisplayGuildTitle = false;
 
                if ( c.Map != Map.Internal && (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;
           
            // MODIFICATIONS FOR Capture the Flag / Double Dom games
            if ( target.Owner != null )
            {
                Server.Items.CTFTeam ft = Server.Items.CTFGame.FindTeamFor( source );
                if ( ft != null )
                {
                    Server.Items.CTFTeam tt = Server.Items.CTFGame.FindTeamFor( target.Owner );
                    if ( tt != null && ft.Game == tt.Game )
                        return ft == tt ? Notoriety.Ally : Notoriety.Enemy;
                }
            }
 
            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( (Mobile)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;
           
            // MODIFICATIONS FOR Capture the Flag / Double Dom games
            Server.Items.CTFTeam ft = Server.Items.CTFGame.FindTeamFor( source );
            if ( ft != null )
            {
                Server.Items.CTFTeam tt = Server.Items.CTFGame.FindTeamFor( target );
                if ( tt != null && ft.Game == tt.Game )
                    return ft == tt ? Notoriety.Ally : Notoriety.Enemy;
            }
 
            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;
 
            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.Controled &&*/ 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;
        }
    }
}

error :s help me please
 
Two things I am noticing here are becoming frequently annoying.

Before I get asked this, Yes I have it set up correctly.

1) Flags place fine, team set, hue set, linked to stone, within bound of the CTF arena (I actually used the default regions as this was my original intent to use these secluded locations)
However, upon server restart I noticed they were missing. I did [global get hue teamid game location where ctfflag. The flags settings are still correct, however the location is 0,0,0.
Is this normal? Are they pulled back upon starting a game? I don't have beta testers active yet as I'm trying to fine tune things before we get started.

2) The mother of mayhem, the GameControlStone... I have everything set right, and the way I want it. Everything is linked to the stone correctly and works.
HOWEVER... Upon server restart, no matter what... The stone is set to Running = True and I have to [endgame it. I even added the m_Open and m_Running bools to the serialize and
deserialize in order to save the values during a restart. No matter what, even with serialization, when the server comes back up OpenJoin = false, Running = True...

What's going on here?

----

Bob Slayden said:
case 1: m_bounds = new Rectangle2D(5896, 393, 111, 111);//ctf
break;
case 2: m_bounds = new Rectangle2D(5901, 270, 96, 95); //DD
break;

It's this one. to see what area it covers and understand how it works:
[self set x 5896 y 393
note your location
[increase x 111 y 111
and viola, you can now see what the region "box" covers.

----

Code:
RunUO - [www.runuo.com] Version 2.0, Build 3567.2838
Core: Running on .NET Framework Version 2.0.50727
Core: Running with arguments: -debug
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Misc/Notoriety.cs:
    [B]CS0101: Line 14: The namespace 'Server.Misc' already contains a definition f[/B]
[B]or 'NotorietyHandlers'[/B]
    CS0102: Line 33: The type 'Server.Misc.NotorietyHandlers' already contains a
definition for 'GuildStatus'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

You need to delete your notoriety.cs in your scripts/misc folder. This tourny comes with the notoriety.cs already modified to work with CTF/DD so you are getting an error for trying to define "NotoreityHandlers" twice.

----

Code:
RunUO - [[URL='http://www.runuo.com]/']www.runuo.com][/URL] Version 2.1, Build 3995.28114
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Misc/[B]Notoriety.cs:[/B]
CS0117: [B]Line 332: 'Server.Spells.Necromancy.TransformationSpell' does not co[/B]
[B]ntain a definition for 'UnderTransformation'[/B]
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

You must have CurrentExspansion.cs (misc folder) set to None. This means necromancy is disabled... So notoriety.cs is checking for something it doesn't need to check for...

I will HOPE you will try to honestly figure this out before reading any further...
If you really can't figure it out, click Show Spoiler below.
Change this
Code:
if ( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !Server.Spells.Necromancy.TransformationSpell.UnderTransformation( target ) )
to this
Code:
if ( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !Server.Spells.TransformationSpellHelper.UnderTransformation( target ) )
 

lucescrewz

Sorceror
when i type comand [add ctfgame and then target ground i do not get the first game stone for options? i can place joingamestones but not the main one.. any ideas?
 

romanthebrain

Sorceror
Add the gamestone by use [add ctfgame including the number of teams you want to have.

for example : "[add ctfgame 2". for 2 teams
 

Alisha

Sorceror
Everything works well except two things:

- Everyone can join one of the teams and leave the another one empty (requires gm manual balancing)
- Notoriety has made all my monsters look blue instead of grey (I tryed setting up a game stone, but still not working)
 
Top