Trying ot use the wow party radar script :

error:

CS0246: Line 124: The type or namespace name 'TrackArrow' could not be found
(are you missing a using directive or an assembly reference?)


Line 124
Code:
from.QuestArrow = new TrackArrow( from, pm, 200 ); // uses arrow from Tracking to indicate direction of member outside of radar


Code:
using System;
using Server;
using Server.Items;
using Server.Network;
using Server.Mobiles;
using Server.SkillHandlers; //tracking arrow
using Server.Engines.PartySystem;
using System.Collections;
using System.Collections.Generic;
using Server.Gumps;

namespace Server.Gumps
{
    public class PartyRadarGump : Gump
    {
        public PartyRadarGump( Mobile from, Mobile pm ) : base( 5, 5 )
        {
            int gumpX = 0; // Default X value
            int gumpY = 0; // Default Y value

            int minY = 20; // Minimum Radar Y value - needs to be verified
            int maxY = 250; //Maximum Radar Y value - needs to be verified

            int minX = 20; // Minimum Radar X value - needs to be verified
            int maxX = 250; // Maximum Radar X value - needs to be verified

            //Base Gump Objects
            AddPage( 0 );
            AddImage( 0, 0, 5011 );
            AddImage( 134, 134, 1209 );

            //Positioning of Icon gumps on radar
            Party p = Engines.PartySystem.Party.Get( from );

            foreach ( PartyMemberInfo mi in p.Members )
            {
                PlayerMobile pl = mi.Mobile as PlayerMobile;

                if ( pl != from )
                {
                    gumpX = 0;
                    gumpY = 0;

                    Point3D myLoc = new Point3D( from.X, from.Y, from.Z);
                    Point3D theirLoc = new Point3D( pl.X, pl.Y, pl.Z);

                    double distanceX = Math.Sqrt(Math.Pow(theirLoc.X - myLoc.X, 2) ); // calculate distance from player to party member on X axis
                    double distanceY = Math.Sqrt(Math.Pow(theirLoc.Y - myLoc.Y, 2) ); // calculate distance from player to party member on Y axis

                    if ( pl.X < from.X )
                    {
                        gumpX = (134 - (Convert.ToInt32(distanceY))); // converts (center of gump - distance between players to integer = X Axis =
                    }
                    else
                    {
                        gumpX = (134 + Convert.ToInt32(distanceY)); // converts (center of gump - distance between players to integer = X Axis =
                    }

                    if (pl.Y < from.Y )
                    {
                        gumpY = (134 - (Convert.ToInt32(distanceX))); // converts (center of gump - distance between players to integer = Y Axis =
                    }
                    else
                    {
                        gumpY = (134 + Convert.ToInt32(distanceX)); // converts (center of gump - distance between players to integer = Y Axis =
                    }

                    if ( pl == p.Leader)
                    {
                        if ( gumpX < minX )
                        {
                            gumpX = minX;
                        }
                        if ( gumpX > maxX )
                        {
                            gumpX = maxX;
                        }
                        if ( gumpY < minY )
                        {
                            gumpY = minY;
                        }
                        if ( gumpY > maxY )
                        {
                            gumpY = maxY;
                        }

                        AddImage( gumpX, gumpY, 2361, 0x489 ); // Add a blue 'dot' for party leader
                        AddLabel( (gumpX - 12), (gumpY -17), 0x489, pl.Name ); // Add party leader's name above dot
                    }
                    else
                    {
                        if ( gumpX < minX )
                        {
                            gumpX = minX;
                        }
                        if ( gumpX > maxX )
                        {
                            gumpX = maxX;
                        }
                        if ( gumpY < minY )
                        {
                            gumpY = minY;
                        }
                        if ( gumpY > maxY )
                        {
                            gumpY = maxY;
                        }

                        AddImage( gumpX, gumpY, 2361, 0x559 ); // Add a green 'dot' for party member
                        AddLabel( (gumpX - 12), (gumpY - 17), 0x559, pl.Name ); // Add party member's name above dot
                    }

                    if ( pm.InRange ( from, 30 ) ) // display indication arrow until player is within 30 tiles
                    {
                        if ( from.QuestArrow != null ) // stop arrow tracking for members within range
                        {
                            from.QuestArrow.Stop();
                        }
                    }
                    else
                    {
                        if ( pm.InRange( from, 200 ) && pm.Map == from.Map)
                        {
                            from.QuestArrow = new TrackArrow( from, pm, 200 ); // uses arrow from Tracking to indicate direction of member outside of radar
                        }
                        else if ( from.QuestArrow != null ) // stop arrow tracking if too far out of range or different map
                        {
                            from.QuestArrow.Stop();
                        }
                    }
                }
            }

            GumpTimer gumpTimer = new GumpTimer( from, pm );
            gumpTimer.Start();
        }
    }

    public class GumpTimer : Timer
    {
        private Mobile m_From, m_Target;
        private int m_LastX, m_LastY;

        public GumpTimer( Mobile from, Mobile member ) : base( TimeSpan.FromSeconds( 0.5 ))
        {
            m_From = from;
            m_Target = member;
        }

        protected override void OnTick()
        {
            if ( m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map )
            {
                Stop();
                return;
            }

            Party p = Engines.PartySystem.Party.Get( m_From );
            if ( p != null )
            {
                //Refresh Gump
                m_From.CloseGump( typeof (PartyRadarGump));
                               
                     NetState ns = m_From.NetState;
                    if (ns != null)
                {
   
                        List<Gump> gumps = new List<Gump>( ns.Gumps );
                       
            for ( int i = 0; i < gumps.Count; ++i )
            {
                                if (gumps[i].GetType() == typeof(PartyRadarGump) )
                {
                                          ns.RemoveGump(i);

                }
            }

                }
                if (! m_From.HasGump( typeof( PartyRadarGump)))
                {
                    PartyRadarGump pr = new PartyRadarGump( m_From, m_Target );
                    m_From.SendGump( pr ); // Custom Radar Gump
                }

                // can switch pages instead of resending/recycling?
            }
            else
            {
                m_From.CloseGump( typeof (PartyRadarGump));
                Stop();
                return;
            }
        }
    }
}
 
Oh this is for RunUO 2.2, sorry was looking at ServUO code.
[doublepost=1512155749][/doublepost]Do me a favor, check to see if TrackArrow in Tracking.cs is a private class. If it is change it to public.
 
Oh this is for RunUO 2.2, sorry was looking at ServUO code.
[doublepost=1512155749][/doublepost]Do me a favor, check to see if TrackArrow in Tracking.cs is a private class. If it is change it to public.
ok hold on, it is public



Code:
 public class TrackArrow : QuestArrow
        {
            private Mobile m_From;
            private Timer m_Timer;

            public TrackArrow(Mobile from, Mobile target, int range) : base(from, target)
            {
                m_From = from;
                m_Timer = new TrackTimer(from, target, range, this);
                m_Timer.Start();
            }

            public override void OnClick(bool rightClick)
            {
                if (rightClick)
                {
                    Tracking.ClearTrackingInfo(m_From);

                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();

                    m_From = null;

                    Stop();
                }
            }

            public override void OnStop()
            {
                m_Timer.Stop();

                if (m_From != null)
                {
                    Tracking.ClearTrackingInfo(m_From);

                    m_From.LocalOverheadMessage(MessageType.Regular, 906, true, string.Format("Has perdido la pista"));

                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();
                }
            }
        }
 
Above the first line, do you have a namespace listed?

It should be something that your other script has access to, like

Code:
namespace Server.Gumps

in tracking.cs?


Code:
using System;
using System.Collections.Generic;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
using Server.Spells;
using Server.Spells.Necromancy;

namespace Server.SkillHandlers
{
    public class Tracking
    {
        public static void Initialize()
        {
            SkillInfo.Table[(int)SkillName.Tracking].Callback = OnUse;
        }

        public static TimeSpan OnUse( Mobile m )
        {
            if (m.BeginAction(typeof(IAction)))
            {
                m.RevealingAction();
                m.SendLocalizedMessage(1011350); // What do you wish to track?

                m.CloseGump(typeof(TrackWhatGump));
                m.CloseGump(typeof(TrackWhoGump));
                m.SendGump(new TrackWhatGump(m));
            }
            else
                m.SendAsciiMessage("You must wait to perform another action.");

            return TimeSpan.FromSeconds( 1.0 ); // 1 second delay before beign able to re-use a skill
        }
 
Hmmm no..

Tracking.cs

Code:
using System;
using System.Collections.Generic;
using Server.Gumps;
using Server.Mobiles;
using Server.Network;
using Server.Spells;
using Server.Spells.Necromancy;

namespace Server.SkillHandlers
{
    public class Tracking
    {
        public static void Initialize()
        {
            SkillInfo.Table[(int)SkillName.Tracking].Callback = OnUse;
        }

        public static TimeSpan OnUse( Mobile m )
        {
            if (m.BeginAction(typeof(IAction)))
            {
                m.RevealingAction();
                m.SendLocalizedMessage(1011350); // What do you wish to track?

                m.CloseGump(typeof(TrackWhatGump));
                m.CloseGump(typeof(TrackWhoGump));
                m.SendGump(new TrackWhatGump(m));
            }
            else
                m.SendAsciiMessage("You must wait to perform another action.");

            return TimeSpan.FromSeconds( 1.0 ); // 1 second delay before beign able to re-use a skill
        }

        public class TrackingInfo
        {
            public Mobile m_Tracker;
            public Mobile m_Target;
            public Point2D m_Location;
            public Map m_Map;

            public TrackingInfo( Mobile tracker, Mobile target )
            {
                m_Tracker = tracker;
                m_Target = target;
                m_Location = new Point2D( target.X, target.Y );
                m_Map = target.Map;
            }
        }

        private static readonly Dictionary<Mobile, TrackingInfo> m_Table = new Dictionary<Mobile, TrackingInfo>();

        public static void AddInfo( Mobile tracker, Mobile target )
        {
            TrackingInfo info = new TrackingInfo( tracker, target );
            m_Table[tracker] = info;
        }

        public static double GetStalkingBonus( Mobile tracker, Mobile target )
        {
            TrackingInfo info = null;
            m_Table.TryGetValue( tracker, out info );

            if ( info == null || info.m_Target != target || info.m_Map != target.Map )
                return 0.0;

            int xDelta = info.m_Location.X - target.X;
            int yDelta = info.m_Location.Y - target.Y;

            double bonus = Math.Sqrt( (xDelta * xDelta) + (yDelta * yDelta) );

            m_Table.Remove( tracker );    //Reset as of Pub 40, counting it as bug for Core.SE.

            if( Core.ML )
                return Math.Min( bonus, 10 + tracker.Skills.Tracking.Value/10 );

            return bonus;
        }


        public static void ClearTrackingInfo( Mobile tracker )
        {
            m_Table.Remove( tracker );
        }
    }

    public class TrackWhatGump : Gump
    {
        private readonly Mobile m_From;
        private readonly bool m_Success;

        public TrackWhatGump( Mobile from ) : base( 20, 30 )
        {
            m_From = from;
            m_Success = from.CheckSkill( SkillName.Tracking, 0.0, 21.1 );

            AddPage( 0 );

            AddBackground( 0, 0, 440, 135, 5054 );

            AddBackground( 10, 10, 420, 75, 2620 );
            AddBackground( 10, 85, 420, 25, 3000 );

            AddItem( 20, 20, 9682 );
            AddButton( 20, 110, 4005, 4007, 1, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 20, 90, 100, 20, 1018087, false, false ); // Animals

            AddItem( 120, 20, 9607 );
            AddButton( 120, 110, 4005, 4007, 2, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 120, 90, 100, 20, 1018088, false, false ); // Monsters

            AddItem( 220, 20, 8454 );
            AddButton( 220, 110, 4005, 4007, 3, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 220, 90, 100, 20, 1018089, false, false ); // Human NPCs

            AddItem( 320, 20, 8455 );
            AddButton( 320, 110, 4005, 4007, 4, GumpButtonType.Reply, 0 );
            AddHtmlLocalized( 320, 90, 100, 20, 1018090, false, false ); // Players
        }

        public override void OnResponse( NetState state, RelayInfo info )
        {
            if (info.ButtonID >= 1 && info.ButtonID <= 4)
                TrackWhoGump.DisplayTo(m_Success, m_From, info.ButtonID - 1);
            else
            {
                if (m_From is PlayerMobile)
                    ((PlayerMobile)m_From).EndPlayerAction();
            }
        }
    }

    public delegate bool TrackTypeDelegate( Mobile m );

    public class TrackWhoGump : Gump
    {
        private readonly Mobile m_From;
        private readonly int m_Range;

        private static readonly TrackTypeDelegate[] m_Delegates = new TrackTypeDelegate[]
            {
                IsAnimal,
                IsMonster,
                IsHumanNPC,
                IsPlayer
            };

        private class InternalSorter : IComparer<Mobile>
        {
            private readonly Mobile m_From;

            public InternalSorter( Mobile from )
            {
                m_From = from;
            }

            public int Compare( Mobile x, Mobile y )
            {
                if ( x == null && y == null )
                    return 0;
                else if ( x == null )
                    return -1;
                else if ( y == null )
                    return 1;

                return m_From.GetDistanceToSqrt( x ).CompareTo( m_From.GetDistanceToSqrt( y ) );
            }
        }

        public static void DisplayTo( bool success, Mobile from, int type )
        {
            if ( !success )
            {
                from.SendLocalizedMessage( 1018092 ); // You see no evidence of those in the area.
                if (from is PlayerMobile)
                    ((PlayerMobile)from).EndPlayerAction();
                return;
            }

            Map map = from.Map;

            if (map == null)
            {
                if (from is PlayerMobile)
                    ((PlayerMobile)from).EndPlayerAction();
                return;
            }

            TrackTypeDelegate check = m_Delegates[type];

            //Taran - Removed passive gain, you already gain when you use the skill
            //from.CheckSkill( SkillName.Tracking, 21.1, 100.0 ); // Passive gain

            int range = 6 + (int)(from.Skills[SkillName.Tracking].Value / 2);

            List<Mobile> list = new List<Mobile>();

            foreach ( Mobile m in from.GetMobilesInRange( range ) )
            {
                // Ghosts can no longer be tracked
                // Taran - Ghosts and invis people are trackable again
                if ( m != from && (!Core.AOS) && (m.AccessLevel == AccessLevel.Player || from.AccessLevel > m.AccessLevel) && check( m ) && CheckDifficulty( from, m ) )
                    list.Add( m );
            }

            if ( list.Count > 0 )
            {
                list.Sort( new InternalSorter( from ) );

                from.SendGump( new TrackWhoGump( from, list, range ) );
                from.SendLocalizedMessage( 1018093 ); // Select the one you would like to track.
            }
            else
            {
                if ( type == 0 )
                    from.SendLocalizedMessage( 502991 ); // You see no evidence of animals in the area.
                else if ( type == 1 )
                    from.SendLocalizedMessage( 502993 ); // You see no evidence of creatures in the area.
                else
                    from.SendLocalizedMessage( 502995 ); // You see no evidence of people in the area.

                if (from is PlayerMobile)
                    ((PlayerMobile)from).EndPlayerAction();
            }
        }

        // Tracking players uses tracking and detect hidden vs. hiding and stealth
        private static bool CheckDifficulty( Mobile from, Mobile m )
        {
            if ( !Core.AOS || !m.Player )
                return true;

            int tracking = from.Skills[SkillName.Tracking].Fixed;   
            int detectHidden = from.Skills[SkillName.DetectHidden].Fixed;

            if( Core.ML && m.Race == Race.Elf )
                tracking /= 2; //The 'Guide' says that it requires twice as Much tracking SKILL to track an elf.  Not the total difficulty to track.

            int hiding = m.Skills[SkillName.Hiding].Fixed;
            int stealth = m.Skills[SkillName.Stealth].Fixed;
            int divisor = hiding + stealth;

            // Necromancy forms affect tracking difficulty
            if (TransformationSpellHelper.UnderTransformation(m, typeof(HorrificBeastSpell)))
                divisor -= 200;
            else if (TransformationSpellHelper.UnderTransformation(m, typeof(VampiricEmbraceSpell)) && divisor < 500)
                divisor = 500;
            else if (TransformationSpellHelper.UnderTransformation(m, typeof(WraithFormSpell)) && divisor <= 2000)
                divisor += 200;

            int chance;
            if ( divisor > 0 )
            {
                if ( Core.SE )
                    chance = 50 * (tracking * 2 + detectHidden) / divisor;
                else
                    chance = 50 * (tracking + detectHidden + 10 * Utility.RandomMinMax( 1, 20 )) / divisor;
            }
            else
                chance = 100;

            return chance > Utility.Random( 100 );
        }

        private static bool IsAnimal( Mobile m )
        {
            return ( !m.Player && m.Body.IsAnimal );
        }

        private static bool IsMonster( Mobile m )
        {
            return ( !m.Player && m.Body.IsMonster );
        }

        private static bool IsHumanNPC( Mobile m )
        {
            return ( !m.Player && m.Body.IsHuman );
        }

        private static bool IsPlayer( Mobile m )
        {
            return m.Player;
        }

        private readonly List<Mobile> m_List;

        private TrackWhoGump( Mobile from, List<Mobile> list, int range ) : base( 20, 30 )
        {
            m_From = from;
            m_List = list;
            m_Range = range;

            AddPage( 0 );

            AddBackground( 0, 0, 440, 155, 5054 );

            AddBackground( 10, 10, 420, 75, 2620 );
            AddBackground( 10, 85, 420, 45, 3000 );

            if ( list.Count > 4 )
            {
                AddBackground( 0, 155, 440, 155, 5054 );

                AddBackground( 10, 165, 420, 75, 2620 );
                AddBackground( 10, 240, 420, 45, 3000 );

                if ( list.Count > 8 )
                {
                    AddBackground( 0, 310, 440, 155, 5054 );

                    AddBackground( 10, 320, 420, 75, 2620 );
                    AddBackground( 10, 395, 420, 45, 3000 );
                }
            }

            for ( int i = 0; i < list.Count && i < 12; ++i )
            {
                Mobile m = list[i];

                AddItem( 20 + ((i % 4) * 100), 20 + ((i / 4) * 155), ShrinkTable.Lookup( m ) );
                AddButton( 20 + ((i % 4) * 100), 130 + ((i / 4) * 155), 4005, 4007, i + 1, GumpButtonType.Reply, 0 );

                if ( m.Name != null )
                    AddHtml( 20 + ((i % 4) * 100), 90 + ((i / 4) * 155), 90, 40, m.Name, false, false );
            }
        }

        public override void OnResponse( NetState state, RelayInfo info )
        {
            int index = info.ButtonID - 1;

            if ( index >= 0 && index < m_List.Count && index < 12 )
            {
                Mobile m = m_List[index];
                m_From.QuestArrow = new TrackArrow(m_From, m, m_Range);
            }
            else
            {
                if (m_From is PlayerMobile)
                    ((PlayerMobile)m_From).EndPlayerAction();
            }
        }

        public class TrackArrow : QuestArrow
        {
            private Mobile m_From;
            private Timer m_Timer;

            public TrackArrow(Mobile from, Mobile target, int range) : base(from, target)
            {
                m_From = from;
                m_Timer = new TrackTimer(from, target, range, this);
                m_Timer.Start();
            }

            public override void OnClick(bool rightClick)
            {
                if (rightClick)
                {
                    Tracking.ClearTrackingInfo(m_From);

                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();

                    m_From = null;

                    Stop();
                }
            }

            public override void OnStop()
            {
                m_Timer.Stop();

                if (m_From != null)
                {
                    Tracking.ClearTrackingInfo(m_From);

                    m_From.LocalOverheadMessage(MessageType.Regular, 906, true, string.Format("Has perdido la pista"));

                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();
                }
            }
        }

        private class TrackTimer : Timer, IAction
        {
            private Mobile m_From, m_Target;
            private readonly int m_Range;
            private int m_LastX, m_LastY;
            private QuestArrow m_Arrow;

            public TrackTimer(Mobile from, Mobile target, int range, QuestArrow arrow) : base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(2.5))
            {
                m_From = from;
                m_Target = target;
                m_Range = range;

                m_Arrow = arrow;

                if (from is PlayerMobile)
                    ((PlayerMobile)from).ResetPlayerAction(this);
            }

            protected override void OnTick()
            {
                if (!m_Arrow.Running)
                {
                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();

                    Stop();
                    return;
                }

                if (m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map || !m_From.InRange(m_Target, m_Range) || (m_Target.Hidden && m_Target.AccessLevel > m_From.AccessLevel))
                {
                    m_Arrow.Stop();
                    Stop();
                    return;
                }

                if (m_LastX != m_Target.X || m_LastY != m_Target.Y)
                {
                    m_LastX = m_Target.X;
                    m_LastY = m_Target.Y;

                    m_Arrow.Update();
                }
            }

            #region IAction Members

            public void AbortAction(Mobile from)
            {
                if (from is PlayerMobile)
                    ((PlayerMobile)from).EndPlayerAction();

                m_Arrow.Stop();
                Stop();
            }

            #endregion
        }

    }
}
 
No I am not sure that will work.

You have TrackArrow nested inside the other class. So, really, it's like Tracking.TrackArrow. You could try referring to it that way, but it might complain that the class is not static, then after fixing that it will say you do not have a reference. etc. etc.

You could run down this rabbit hole, but it might take you somewhere you do not expect. To begin, add this to your script at the top, and see what happens:


Code:
using Server.SkillHandlers.Tracking;
 
Code:
    CS0138: Line 8: A using namespace directive can only be applied to namespace
s; 'Server.SkillHandlers.Tracking' is a type not a namespace

i also tried
Code:
  from.QuestArrow = new Tracking.TrackArrow ( from, pm, 200 );


CS0426: Line 124: The type name 'TrackArrow' does not exist in the type 'Ser
ver.SkillHandlers.Tracking'
 
Last edited:
Try this one. I think the new class needs to be inside your gump's class, which is why it is marked private.
 

Attachments

  • PartyRadarGump.cs
    8.5 KB · Views: 4
CS0138: Line 7: A using namespace directive can only be applied to namespace
s; 'Server.SkillHandlers.Tracking' is a type not a namespace
 
Oops, take that line out.
i did now im getting another error heehe


+/PARTYRADAR/[ServUO.com]-PartyRadarGump.cs:
CS0246: Line 147: The type or namespace name 'TrackTimer' could not be found
(are you missing a using directive or an assembly reference?)
 
OK, so you need to copy the TrackTimer into it too:

Code:
            public TrackTimer(Mobile from, Mobile target, int range, QuestArrow arrow) : base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(2.5))
            {
                m_From = from;
                m_Target = target;
                m_Range = range;
                m_Arrow = arrow;
                if (from is PlayerMobile)
                    ((PlayerMobile)from).ResetPlayerAction(this);
            }
            protected override void OnTick()
            {
                if (!m_Arrow.Running)
                {
                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();
                    Stop();
                    return;
                }
                if (m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map || !m_From.InRange(m_Target, m_Range) || (m_Target.Hidden && m_Target.AccessLevel > m_From.AccessLevel))
                {
                    m_Arrow.Stop();
                    Stop();
                    return;
                }
                if (m_LastX != m_Target.X || m_LastY != m_Target.Y)
                {
                    m_LastX = m_Target.X;
                    m_LastY = m_Target.Y;
                    m_Arrow.Update();
                }
            }
 
This the full code, getting errors,

CS1518: Line 184: Expected class, delegate, enum, interface, or struct
CS1518: Line 193: Expected class, delegate, enum, interface, or struct


Code:
using System;
using Server;
using Server.Items;
using Server.Network;
using Server.Mobiles;
using Server.SkillHandlers; //tracking arrow
//using Server.SkillHandlers.Tracking; //tracking arrow
using Server.Engines.PartySystem;
using System.Collections;
using System.Collections.Generic;
using Server.Gumps;
namespace Server.Gumps
{
    public class PartyRadarGump : Gump
    {
        public PartyRadarGump( Mobile from, Mobile pm ) : base( 5, 5 )
        {
            int gumpX = 0; // Default X value
            int gumpY = 0; // Default Y value
            int minY = 20; // Minimum Radar Y value - needs to be verified
            int maxY = 250; //Maximum Radar Y value - needs to be verified
            int minX = 20; // Minimum Radar X value - needs to be verified
            int maxX = 250; // Maximum Radar X value - needs to be verified
            //Base Gump Objects
            AddPage( 0 );
            AddImage( 0, 0, 5011 );
            AddImage( 134, 134, 1209 );
            //Positioning of Icon gumps on radar
            Party p = Engines.PartySystem.Party.Get( from );
            foreach ( PartyMemberInfo mi in p.Members )
            {
                PlayerMobile pl = mi.Mobile as PlayerMobile;
                if ( pl != from )
                {
                    gumpX = 0;
                    gumpY = 0;
                    Point3D myLoc = new Point3D( from.X, from.Y, from.Z);
                    Point3D theirLoc = new Point3D( pl.X, pl.Y, pl.Z);
                    double distanceX = Math.Sqrt(Math.Pow(theirLoc.X - myLoc.X, 2) ); // calculate distance from player to party member on X axis
                    double distanceY = Math.Sqrt(Math.Pow(theirLoc.Y - myLoc.Y, 2) ); // calculate distance from player to party member on Y axis
                    if ( pl.X < from.X )
                    {
                        gumpX = (134 - (Convert.ToInt32(distanceY))); // converts (center of gump - distance between players to integer = X Axis =
                    }
                    else
                    {
                        gumpX = (134 + Convert.ToInt32(distanceY)); // converts (center of gump - distance between players to integer = X Axis =
                    }
                    if (pl.Y < from.Y )
                    {
                        gumpY = (134 - (Convert.ToInt32(distanceX))); // converts (center of gump - distance between players to integer = Y Axis =
                    }
                    else
                    {
                        gumpY = (134 + Convert.ToInt32(distanceX)); // converts (center of gump - distance between players to integer = Y Axis =
                    }
                    if ( pl == p.Leader)
                    {
                        if ( gumpX < minX )
                        {
                            gumpX = minX;
                        }
                        if ( gumpX > maxX )
                        {
                            gumpX = maxX;
                        }
                        if ( gumpY < minY )
                        {
                            gumpY = minY;
                        }
                        if ( gumpY > maxY )
                        {
                            gumpY = maxY;
                        }
                        AddImage( gumpX, gumpY, 2361, 0x489 ); // Add a blue 'dot' for party leader
                        AddLabel( (gumpX - 12), (gumpY -17), 0x489, pl.Name ); // Add party leader's name above dot
                    }
                    else
                    {
                        if ( gumpX < minX )
                        {
                            gumpX = minX;
                        }
                        if ( gumpX > maxX )
                        {
                            gumpX = maxX;
                        }
                        if ( gumpY < minY )
                        {
                            gumpY = minY;
                        }
                        if ( gumpY > maxY )
                        {
                            gumpY = maxY;
                        }
                        AddImage( gumpX, gumpY, 2361, 0x559 ); // Add a green 'dot' for party member
                        AddLabel( (gumpX - 12), (gumpY - 17), 0x559, pl.Name ); // Add party member's name above dot
                    }
                    if ( pm.InRange ( from, 30 ) ) // display indication arrow until player is within 30 tiles
                    {
                        if ( from.QuestArrow != null ) // stop arrow tracking for members within range
                        {
                            from.QuestArrow.Stop();
                        }
                    }
                    else
                    {
                        if ( pm.InRange( from, 200 ) && pm.Map == from.Map)
                        {
                            from.QuestArrow = new TrackArrow( from, pm, 200 ); // uses arrow from Tracking to indicate direction of member outside of radar
                        }
                        else if ( from.QuestArrow != null ) // stop arrow tracking if too far out of range or different map
                        {
                            from.QuestArrow.Stop();
                        }
                    }
                }
            }
            GumpTimer gumpTimer = new GumpTimer( from, pm );
            gumpTimer.Start();
        }
              
       
        private class TrackArrow : QuestArrow
        {
            private Mobile m_From;
            private Timer m_Timer;
            public TrackArrow(Mobile from, Mobile target, int range) : base(from, target)
            {
                m_From = from;
              //  m_Timer = new TrackTimer(from, target, range, this);
                m_Timer.Start();
            }
            public override void OnClick(bool rightClick)
            {
                if (rightClick)
                {
                    Tracking.ClearTrackingInfo(m_From);
                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();
                    m_From = null;
                    Stop();
                }
            }
            public override void OnStop()
            {
                m_Timer.Stop();
                if (m_From != null)
                {
                    Tracking.ClearTrackingInfo(m_From);
                    m_From.LocalOverheadMessage(MessageType.Regular, 906, true, string.Format("Has perdido la pista"));
                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();
                }
            }
        }
    }
      public TrackTimer (Mobile from, Mobile target, int range, QuestArrow arrow) : base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(2.5))
            {
                m_From = from;
                m_Target = target;
                m_Range = range;
                m_Arrow = arrow;
                if (from is PlayerMobile)
                    ((PlayerMobile)from).ResetPlayerAction(this);
            }
            protected override void OnTick()
            {
                if (!m_Arrow.Running)
                {
                    if (m_From is PlayerMobile)
                        ((PlayerMobile)m_From).EndPlayerAction();
                    Stop();
                    return;
                }
                if (m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map || !m_From.InRange(m_Target, m_Range) || (m_Target.Hidden && m_Target.AccessLevel > m_From.AccessLevel))
                {
                    m_Arrow.Stop();
                    Stop();
                    return;
                }
                if (m_LastX != m_Target.X || m_LastY != m_Target.Y)
                {
                    m_LastX = m_Target.X;
                    m_LastY = m_Target.Y;
                    m_Arrow.Update();
                }
            }
    public class GumpTimer : Timer
    {
        private Mobile m_From, m_Target;
        private int m_LastX, m_LastY;
        public GumpTimer( Mobile from, Mobile member ) : base( TimeSpan.FromSeconds( 0.5 ))
        {
            m_From = from;
            m_Target = member;
        }
        protected override void OnTick()
        {
            if ( m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map )
            {
                Stop();
                return;
            }
            Party p = Engines.PartySystem.Party.Get( m_From );
            if ( p != null )
            {
                //Refresh Gump
                m_From.CloseGump( typeof (PartyRadarGump));
                              
                     NetState ns = m_From.NetState;
                    if (ns != null)
                {
  
                        List<Gump> gumps = new List<Gump>( ns.Gumps );
                      
            for ( int i = 0; i < gumps.Count; ++i )
            {
                                if (gumps[i].GetType() == typeof(PartyRadarGump) )
                {
                                          ns.RemoveGump(i);
                }
            }
                }
                if (! m_From.HasGump( typeof( PartyRadarGump)))
                {
                    PartyRadarGump pr = new PartyRadarGump( m_From, m_Target );
                    m_From.SendGump( pr ); // Custom Radar Gump
                }
                // can switch pages instead of resending/recycling?
            }
            else
            {
                m_From.CloseGump( typeof (PartyRadarGump));
                Stop();
                return;
            }
        }
    }
}
 
OK. Try it this way. There was a close brace around line 157 that had to be moved to around line 189.
 

Attachments

  • PartyRadarGump.cs
    9.2 KB · Views: 3
:O theres something wrong with that script, it dont let me start the server


Scripts: Compiling C# scripts...ScriptCompiler: CS1520: Method must have a retur
n type
ScriptCompiler: CS1002: ; expected
ScriptCompiler: CS1519: Invalid token '(' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token '(' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token '=' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token ';' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token '=' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token ';' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token '=' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token ';' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token '=' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token ';' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token 'is' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token ')' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token ')' in class, struct, or interface member
declaration
ScriptCompiler: CS1519: Invalid token ')' in class, struct, or interface member
declaration
ScriptCompiler: CS1520: Method must have a return type
ScriptCompiler: CS1031: Type expected
ScriptCompiler: CS1518: Expected class, delegate, enum, interface, or struct
ScriptCompiler: CS1022: Type or namespace definition, or end-of-file expected
done (0 errors, 0 warnings)
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 
Try this one. Don't know how that got only partially copied.
 

Attachments

  • PartyRadarGump.cs
    9.4 KB · Views: 2
Server dont start, got no errors tho, only warnings from other scripts i always get those whenever i run the server



Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

edit: i thought wonderland was a good place
 
Server dont start, got no errors tho, only warnings from other scripts i always get those whenever i run the server



Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

edit: i thought wonderland was a good place

No, Wonderland is a bizarre place. Can you copy paste the console output to [ code ] tags?
 
Can you copy paste the console output to [ code ] tags?

managed to capture some of the console errors:

144warningslol.png

when the console stops loading stuff even if i scroll up those errors are gone... due the high amount of warnings that i got from lot of custom scripts :D

So how alice survive there?
 
This makes the TrackTimer use the IAction interface.
 

Attachments

  • PartyRadarGump.cs
    9.8 KB · Views: 8
Back