Chucl

Member
ServUO Version
Publish Unknown
Ultima Expansion
The Second Age
Title, im playing with onmoveover, for some reason it doesnt work


In basecreature i added zombie then return true (also false for testing) and zombies just cant shove each other or moveover each other any clue?

im confused the Onmoveover method only apply to playermobile moving over something ?
 
Last edited:
Basecreature.cs
C#:
  public override bool OnMoveOver(Mobile m)
        {
      
          
BaseCreature baseCreature1 = (BaseCreature)this; // Casting explícito de 'this' a BaseCreature
BaseCreature baseCreature2 = m as BaseCreature; // Casting seguro

Zombie z1 = baseCreature1 as Zombie; // Casting a Zombie
Zombie z2 = baseCreature2 as Zombie; // Casting a Zombie

if (z1 != null && z2 != null) // Both zombies
{
    Console.WriteLine("debug");
    XmlValue fueratrono = (XmlValue)XmlAttach.FindAttachment(z1, typeof(XmlValue), "deadpet");
    XmlValue fueratrono2 = (XmlValue)XmlAttach.FindAttachment(z2, typeof(XmlValue), "deadpet");

    if (fueratrono != null && fueratrono2 != null)
    {
        z1.Say("Debug we should move over");
        return true;
    }
}

          
            if (m is BaseCreature && !((BaseCreature)m).Controlled)
                return (!Alive || !m.Alive || IsDeadBondedPet || m.IsDeadBondedPet)|| (Hidden && AccessLevel > AccessLevel.Player);

      

            return base.OnMoveOver(m);
        }

it does nothing, i feel like on move over method only works work playermobile is that right?


I tried to edit Mobile.cs in the core, whenever i add BaseCreature or even Zombie it says im missing a reference, weird
 
Hmm no, it works with everything. I'm not sure what are you trying with that XmlValue, but to override the normal BaseCreature for zombies to pass through other zombies should be as easy as going into the Zombie class and add this:

public override bool OnMoveOver(Mobile m)
{
return m is Zombie;
}

Of course, differences a part in your core.

For the missing reference, it's normal. The core doesn't have BaseCreature, neither Zombie...therefore the override possibility. Scripts reference Core, not vice-versa. So Scripts know about Mobile, Core doesn't know about BC or Zombie.
 
Added that ti Zombie.cs, it doesnt work :( , they keep blocking each other



i dont get it xD

My basecreature.cs

C#:
  public override bool OnMoveOver(Mobile m)
        {
        
  if (m is BaseCreature && !((BaseCreature)m).Controlled)
                return (!Alive || !m.Alive || IsDeadBondedPet || m.IsDeadBondedPet)|| (Hidden && AccessLevel > AccessLevel.Player);


            return base.OnMoveOver(m);
        }



my Zombie.cs

C#:
public override bool OnMoveOver(Mobile m)
{
return m is Zombie;
}


My mobile.cs



C#:
    /// <summary>
        /// Overridable. Event invoked when a Mobile <paramref name="m" /> moves over this Mobile.
        /// </summary>
        /// <returns>True if the move is allowed, false if not.</returns>
        public virtual bool OnMoveOver( Mobile m )
        {
            if( m_Map == null || m_Deleted )
                return true;
          
     
      
            return m.CheckShove( this );
        }

        public virtual bool CheckShove( Mobile shoved )
        {
          
          
          
            if( (m_Map.Rules & MapRules.FreeMovement) == 0 )
            {
                if( !shoved.Alive || !Alive || shoved.IsDeadBondedPet || IsDeadBondedPet)
                    return true;
                else if( shoved.m_Hidden && shoved.m_AccessLevel > AccessLevel.Player )
                    return true;


                if( !m_Pushing )
                {
                    m_Pushing = true;

                    int number;

                    if( this.AccessLevel > AccessLevel.Player )
                    {
                        number = shoved.m_Hidden ? 1019041 : 1019040;
                    }
                    else
                    {
                        if( Stam == StamMax )
                        {
                            number = shoved.m_Hidden ? 1019043 : 1019042;
                            Stam -= 10;

                            RevealingAction();
                        }
                        else
                        {
                            return false;
                        }
                    }

                    SendLocalizedMessage( number );
                }
            }
            return true;
        }
 
Last edited:
Your override probably works already (and you even skip CheckShove cause you don't return base.CheckShove on the overridden Zombie), I would rather check where in the mobiles pathing the OnMoveOver is called in your code and check if it's properly handled. For example, I don't have at all ChechShove, we check directly in the Move() of the mobile if it can or cannot move in a new sector based if it can or cannot move over who's already there.

Check your Mobile Move() or equivalent.
 

Active Shards

Donations

Total amount
$0.00
Goal
$500.00
Back