Full Version : GM Recall command
xmlspawner >>Scripting Support >>GM Recall command


<< Prev | Next >>

Erica- 09-25-2007
Hi was wondering what i would have to add on this script so bonded pets recall with the gm.
CODE
using Server;
using Server.Network;
using Server.Items;
using Server.Mobiles;
using Server.Misc;
using Server.Targeting;
using Server.Commands;

namespace Server.Scripts.Commands
{
  public class GMRecall
  {
     public static void Initialize()
     {
        Register();
     }

     public static void Register()
     {
        CommandSystem.Register( "Recall", AccessLevel.Counselor, new
CommandEventHandler( GMRecall_OnCommand ) );
     }

     private class RecallTarget : Target
     {
        public RecallTarget( Mobile m ) : base( 1, false,
TargetFlags.None )
        {
        }

        protected override void OnTarget( Mobile from, object target )
        {
           if ( target is RecallRune )
           {
              RecallRune t = ( RecallRune )target;

              if ( t.Marked == true )
              {
                 from.Location = t.Target;
                 from.Map = t.TargetMap;
              }
       else
   from.SendLocalizedMessage( 502354 ); // Target is not marked.
           }
           else
    if ( target is Runebook )
    {
 RunebookEntry e = ((Runebook)target).Default;

 if ( e != null )
 {
    from.Location = e.Location;
    from.Map = e.Map;
 }
 else
    from.SendLocalizedMessage( 502354 ); // Target is not marked.
           }
           else
           {
              from.SendMessage( "That can not be done,!" );
           }
        }
     }

     [Usage( "Recall" )]
     [Description( "Recall on rune." )]
     private static void GMRecall_OnCommand( CommandEventArgs e )
     {
        e.Mobile.SendMessage( "Target A Default Runebook" );
        e.Mobile.Target = new RecallTarget( e.Mobile );
     }
  }
}
Now it works recalling off a default rune book or off a recall rune as well but would like it to make it if im off my bonded pet for him to come as well Thank You.

ArteGordon- 09-25-2007
add a call to TeleportPets here

QUOTE

if ( t.Marked == true )
             {
BaseCreature.TeleportPets(from, t.Target, t.TargetMap, true);
                from.Location = t.Target;
                from.Map = t.TargetMap;
             }

Erica- 09-25-2007
QUOTE (ArteGordon @ September 25, 2007 04:17 am)
add a call to TeleportPets here

QUOTE

if ( t.Marked == true )
              {
BaseCreature.TeleportPets(from, t.Target, t.TargetMap, true);
                from.Location = t.Target;
                from.Map = t.TargetMap;
              }

Did That ArteGordon and got 1 error.
CODE
Errors:
+ Custom Scripts 2.0/Heal And Recall/GMRecall.cs:
   CS1502: Line 39: The best overloaded method match for 'Server.Mobiles.BaseCr
eature.TeleportPets(Server.Mobile, Server.Point3D, Server.Map)' has some invalid
arguments
   CS1503: Line 39: Argument '2': cannot convert from 'Server.Map' to 'Server.P
oint3D'
   CS1503: Line 39: Argument '3': cannot convert from 'bool' to 'Server.Map'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

ArteGordon- 09-25-2007
I dont think that you added the call correctly. Check to make sure you got all the arguments right.

Erica- 09-25-2007
QUOTE (Erica @ September 25, 2007 04:59 am)
QUOTE (ArteGordon @ September 25, 2007 04:17 am)
add a call to TeleportPets here

QUOTE

if ( t.Marked == true )
              {
BaseCreature.TeleportPets(from, t.Target, t.TargetMap, true);
                from.Location = t.Target;
                from.Map = t.TargetMap;
              }

Did That ArteGordon and got 1 error.
CODE
Errors:
+ Custom Scripts 2.0/Heal And Recall/GMRecall.cs:
   CS1502: Line 39: The best overloaded method match for 'Server.Mobiles.BaseCr
eature.TeleportPets(Server.Mobile, Server.Point3D, Server.Map)' has some invalid
arguments
   CS1503: Line 39: Argument '2': cannot convert from 'Server.Map' to 'Server.P
oint3D'
   CS1503: Line 39: Argument '3': cannot convert from 'bool' to 'Server.Map'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Nevermind forgot to add t.Target.

Erica- 09-25-2007
ok it complies but the pet thats bonded doesnt recall with me at all as owner since this command [recall is for staff.

ArteGordon- 09-25-2007
Show the code that you added. Also, you have to make sure they are within 3 tiles of you and they have to be bonded.
If you want to also teleport them when you recall using a book, then you have to add that code in here as well

QUOTE

if ( e != null )
{
BaseCreature.TeleportPets(from, e.Location, e.Map, true);

    from.Location = e.Location;
    from.Map = e.Map;
}

Erica- 09-25-2007
QUOTE (ArteGordon @ September 25, 2007 05:07 am)
Show the code that you added. Also, you have to make sure they are within 3 tiles of you and they have to be bonded.
If you want to also teleport them when you recall using a book, then you have to add that code in here as well

QUOTE

if ( e != null )
{
BaseCreature.TeleportPets(from, e.Location, e.Map, true);

    from.Location = e.Location;
    from.Map = e.Map;
}

Ok now it works Thanks.