Why the player is not hidding after he gets teleported to the taget location?

all my desperate attemps are marked as //my fail edit :D


Code:
        public void Target( object op )
        {
            IPoint3D p = op as IPoint3D;
            Mobile mobileTarget = op as Mobile;

            IPoint3D orig = p;
            Map map = Caster.Map;

            SpellHelper.GetSurfaceTop( ref p );
         

       
            if ( !SpellHelper.CheckTravel( Caster, TravelCheckType.TeleportFrom ) )
            {
            }
        else if ( !SpellHelper.CheckTravel( Caster, map, new Point3D( p ), TravelCheckType.TeleportTo ) )
            {
            }
            else if (mobileTarget == null && ( map == null || !map.CanSpawnMobile(p.X, p.Y, p.Z)))
            {
                Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
            }
            else if (Region.Find(new Point3D(p),map) is HouseRegion)
            {
                Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
            }
            else if ( SpellHelper.CheckMulti( new Point3D( p ), map ) )
            {
                Caster.SendLocalizedMessage( 501942 ); // That location is blocked.
            }
            else if (SphereSpellTarget is BaseWand)
            {
                BaseWand bw = SphereSpellTarget as BaseWand;
                bw.RechargeWand(Caster, this);
            }
            else if ( CheckSequence())
            {
                if (op != null && Caster.InRange(new Point2D(p.X,p.Y),4))
                {
                    Mobile m = Caster;

                    Point3D from = m.Location;
                    Point3D to = new Point3D(p);
                    
                           
                         m.Location = to;
                         Caster.Hidden = true; //my fail edit
                        m.Hidden = true; //my fail edit
                         PlayerMobile pm = m as PlayerMobile;  //my fail edit
                          m.ProcessDelta();
                          m.Hidden = true;    ////my fail edit
                          if (pm != null)      ////my fail edit
                            ((PlayerMobile)pm).Hidden = true;      //my fail edit
                                            
                            
                              pm.IsStealthing = true; //my fail edit 
                                ((PlayerMobile)pm).IsStealthing = true;  //my fail edit      
                       ((PlayerMobile)Caster).IsStealthing = true;    //my fail edit                                   
               
                    Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023,84);

                }
                else
                    Caster.SendAsciiMessage("You cannot see that!");
            }

            FinishSequence();
        }
 
So you're trying to teleport a targeted player and make them hidden after they're teleported?

Mobile mobileTarget = op as Mobile; // this is already in place, so

mobileTarget.Hidden = true; // will make the targeted mobile hidden after teleport

place it after the line: m.Location = to;
 
So you're trying to teleport a targeted player and make them hidden after they're teleported?

No, player teleport himself to a location and i want it to hide right after he move to that location

I already tried that, and it crashed maybe because i didnt put it after the m.Location = to;

let me test :)

It crash yep, null reference on that line

m.Hidden = true; only hide the caster if GM is toggled on

As a player it doesnt
 
Last edited:
Back