RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

move to ground

Malaperth

Wanderer
try this:

Code:
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Network;


namespace Server.Items
{
	public class FlagItem : Item
	{
		[Constructable]
		public FlagItem() : this( 1 )
		{
		}

		[Constructable]
		public FlagItem( int amount ) : base( 3699 )
		{
			Weight = 5.0;
			Hue = 0x496;
			Movable = false;
		}

		public FlagItem( Serial serial ) : base( serial )
		{
		}

        public override DeathMoveResult OnInventoryDeath(Mobile parent)
        {
            this.MoveToWorld(parent.Location, parent.Map);
            return DeathMoveResult.RemainEquiped;
        }

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			if ( Hue == 0 )
				Hue = 0x8AC;
		}
	}
}
 

Malaperth

Wanderer
Ok, try removing this:

Code:
            this.MoveToWorld(parent.Location, parent.Map);

and replace it with this:

Code:
this.Bounce(parent);
 

Malaperth

Wanderer
try adding this and commenting out the OnInventoryDeath method:

Code:
		public override DeathMoveResult OnParentDeath( Mobile parent )
		{
			this.Bounce(parent);
            return DeathMoveResult.RemainEquiped;
		}
 

Malaperth

Wanderer
Ok, in that new method I posted, change this:

Code:
			this.Bounce(parent);

to this:

Code:
            this.MoveToWorld(parent.Location, parent.Map);

and see what happens.

I have a feeling that this is not possible using the methods you are using now, but we will see.
 

JMB Networks

Wanderer
.

Corpse again, i dont understand why we cant just OnInventoryDeath.DropToFeet or something of the sort. then it will explain where feet are afterwards.

Im not sure how i could do it though
 

JMB Networks

Wanderer
.

As a matter of fact, i think the closest one we had was when he died, it sent one to his corpse and one to his feet, because we told it to make a brand new one. If we told it to make a new one at his feet and then delete the old one in corpse, maybe we can get it to work.
 

Malaperth

Wanderer
JMB Networks;660841 said:
Corpse again, i dont understand why we cant just OnInventoryDeath.DropToFeet or something of the sort. then it will explain where feet are afterwards.

Im not sure how i could do it though

Well, it appears that since it returns a DeathMoveResult, that it may actually move the item to the ground, but after the DeathMoveResult is returned and used, the item is then moved again into where the code thinks it is supposed to go according to the DeathMoveResult.

I know what you want to do is possible, it just may not be possible at the exact point in the code that you want to do it. I'm also not sure it is possible from the Item code itself. You may have to put it in PlayerMobile.
 

JMB Networks

Wanderer
.

What about an onmoverover.

This code will be in the item script, not sure how to add it to the backpack

Basically, OnMoveOver, if player, and then i want it to put the flag into their pack. What do you think?


Code:
		public override bool OnMoveOver( Mobile m )
		{
			if ( m.Player )
				????( m, 0 );

			return true;
		}
 

Malaperth

Wanderer
Well, that is possible, but it wouldn't do anything when the player died.

If you want it to go into the players pack OnMoveOver, it would require something like this:

Code:
        public override bool OnMoveOver(Mobile m)
		{
			if ( m.Player )
            {
                Container cont = m.Backpack;
                cont.AddItem(this);
            }

			return true;
		}
 

remnant

Wanderer
I think he wants to use OnMoveOver for capturing the flag.

You could do something like:
Code:
        public override bool HandlesMovement { get { return true; } }
        public override bool OnMoveOver(Mobile m)
        {
            if (m is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)m;
                if( pm.Backpack != null )
                    pm.Backpack.DropItem( this );
            }
        }

Oh, and btw, what Mal posted should work.
 
Top