Thread: Target & Effect
View Single Post
Old 05-11-2008, 07:32 AM   #2 (permalink)
Lokai
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 41
Posts: 1,414
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Try this (not sure about the Land Target part, but it compiled fine):

Code:
using System;
using System.Xml;
using Server;
using System.IO;
using Server.Commands;
using Server.Items;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;
using Server.Engines.Quests;
using System.Collections;
using Server.Guilds;
using Server.Targeting;

namespace Server.Commands
{
    public static class gmad
    {
        public static void Initialize()
        {
            CommandSystem.Register("fb", AccessLevel.Player, new CommandEventHandler(eff_OnCommand));
        }
        [Usage("eff")]
        [Description("eff")]
        private static void eff_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;
            PlayerMobile pm = (PlayerMobile)from;
            //pm.FixedEffect(0x36E4,0,40,0,7);
            //pm.FixedParticles(0x36E4,0,40,5004,EffectLayer.LeftFoot);
            //pm.MovingParticles(pm,0x36E4,0,40,false,true);
            /*foreach ( Object obj in pm.GetObjectsInRange(10) )
            {
                if ( obj != null && obj is Mobile && obj != pm)
                    pm.MovingParticles((Mobile)obj,0x36E4,5,17,false,true,0,0,0);
            }*/
            pm.Target = new fbtarget();
        }
        private class fbtarget : Target
        {
            public fbtarget()
                : base(15, true, TargetFlags.None)
            {
            }
            protected override void OnTarget(Mobile from, object targ)
   {
                IPooledEnumerable mobiles;
                from.SendMessage("im from");
                if (targ is Mobile)
                {
                    mobiles = ((Mobile)targ).GetMobilesInRange(1);
                }
                else if (targ is StaticTarget)
                {
                    Item i = new Item(((StaticTarget)targ).ItemID);
                    i.Location = ((StaticTarget)targ).Location;
                    mobiles = i.GetMobilesInRange(1);
                    i.Delete();
                }
                else if (targ is LandTarget)
                {
                    Item i = new Item(((LandTarget)targ).TileID | 0x3FF);
                    i.Location = ((LandTarget)targ).Location;
                    mobiles = i.GetMobilesInRange(1);
                    i.Delete();
                }
                else return;
                foreach (Mobile m in mobiles)
                {
                    m.SendMessage("im Mobile in range 1");
                }
   }
        }
    }
}
Lokai is online now   Reply With Quote