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

JMB Networks

Wanderer
move to ground

Can somone help me with this peice of code?

Code:
		private void MoveToGround()
		{
				MoveToWorld( GetWorldLocation(), Map );
		}

		public override DeathMoveResult OnInventoryDeath( Mobile parent )
		{
			parent.SolidHueOverride = -1;
			return DeathMoveResult.MoveToWorld;
		}


the error is Server.DeathMoveResult does not contain a definition for "MoveToWorld

(i realize there is no defintion for the MoveToWorld or MoveToGround)

I just cant think right now.
 
would need to see the whole code to see what is up there

but simply put i would just combine them up

Code:
		public override DeathMoveResult OnInventoryDeath( Mobile parent )
		{
			parent.SolidHueOverride = -1;
			MoveToWorld( GetWorldLocation(), Map );
			return ; // this line is not realy needed
		}
 

JMB Networks

Wanderer
error

same error i have been getting, when trying around different things.

An object of a type convertible to 'Server.DeathMoveResults' is required
 

JMB Networks

Wanderer
Line

I couldent concentrate anymore so i stopped, if anyone wants to try and solve the problem go right ahead because i cant right now.

I want it so OnDeath (of the player holding item in their pack) the item drops to the ground.

you can see passed code we were using * up above *

and heres what im messing with now. Solving this will be much apreciated.

Code:
		public override DeathMoveResult OnDeath( Mobile parent )
                {
                    base.MoveToWorld(parent.Location, parent.Map);
                }

        public void DropBall(Mobile from, Point3D loc, Map map)
        {
            {
                base.MoveToWorld(loc, map);
            }
        }
 

remnant

Wanderer
Try this:
Code:
        public override DeathMoveResult OnInventoryDeath(Mobile parent)
        {
            YourItemClass item = new YourItemClass();
            item.MoveToWorld(parent.Location, parent.Map);
            return DeathMoveResult.MoveToBackpack;
        }

Replace YourItemClass with the name of the class for this Item.

This should create a new item, move it to the ground, and move the old one to their backpack (not their corpse). When the corpse disappears, the item in the backpack will be deleted. It will remain inaccessible to players.
 

JMB Networks

Wanderer
Error

That dosnt work because i need the actual item dropped on death, there cant be more than one.

I just cant seem to figure this out for some reason. Its probabaly becauase ive spent so long on it i cant see a obvious answer. Does anyone have any ideas?
 

Malaperth

Wanderer
I'm not sure if this is the correct place in the Death code path to put this, but...

Code:
           public override DeathMoveResult OnInventoryDeath(Mobile parent)
        {
	    Container pack = parent.Backpack;
	    if(pack != null)
            {
                Item item = pack.FindItemByType(typeof(MyItem));
	        if(item != null)
                {
            	    item.MoveToWorld(parent.Location, parent.Map);
                    return DeathMoveResult.RemainEquiped;
                }
            }
            return DeathMoveResult.MoveToBackpack;
        }
 

JMB Networks

Wanderer
MoveToWorld

I dont think i fully said what im trying to make it do. Its not that the passed code hasnt worked, it just hasnt fully done what i want.

The code you just gave me left the item in their pack when they die.

I want it to be moved to the floor.

basically, oninventorydeath, ( i want the item) to movetoworld.

I cannot seem to get it right for some reason.
 

JMB Networks

Wanderer
.

Im not sure what you mean, i directly copied what you posted.

When i killed the player, instead of dropping the item to the ground it kept it in his ghosts pack.

I want it so oninventorydeath the item drops on the ground
 

Malaperth

Wanderer
I guess I should have been more specific. I don't know exactly what Item you are trying to drop to the ground so I had to put in a 'dummy' name here:

Code:
 Item item = pack.FindItemByType(typeof([COLOR="Red"]MyItem[/COLOR]));

You will need to change the part in red to whatever the class is you are trying to drop to the ground in order for that code to have any chance to work.
 

Malaperth

Wanderer
Then it would be my guess that the method you put the code in is the wrong place in the codepath to put your code. At that point in the death sequence, there are several things going on transferring items from place to place and container to container if I am not mistaken. I think I would try putting it in the OnBeforeDeath method and see if it works there.
 

JMB Networks

Wanderer
.

I think what im going to do is take this

Code:
        public override DeathMoveResult OnInventoryDeath(Mobile parent)
        {
            YourItemClass item = new YourItemClass();
            item.MoveToWorld(parent.Location, parent.Map);
            return DeathMoveResult.MoveToBackpack;
        }

Atm that code will put one on the ground on death, and then the other one stays in ghosts pack.

Im going to change the DeathMoveResult to Remove the item instead of MoveToBackpack. Although i havent been able to find the right remove or delete code yet.

return DeathMoveResult.???;
 

Malaperth

Wanderer
JMB Networks;660780 said:
I think what im going to do is take this

Code:
        public override DeathMoveResult OnInventoryDeath(Mobile parent)
        {
            YourItemClass item = new YourItemClass();
            item.MoveToWorld(parent.Location, parent.Map);
            return DeathMoveResult.MoveToBackpack;
        }

Atm that code will put one on the ground on death, and then the other one stays in ghosts pack.

Im going to change the DeathMoveResult to Remove the item instead of MoveToBackpack. Although i havent been able to find the right remove or delete code yet.

return DeathMoveResult.???;

You would have to add a new DeathMoveResult and supporting code to do that, which is why I suggested the OnBeforeDeath method. Try this:

Code:
           public override DeathMoveResult OnInventoryDeath(Mobile parent)
        {
                Console.WriteLine("parent is type:  " + parent.GetType().ToString());
	    Container pack = parent.Backpack;
	    if(pack != null)
            {
                Item item = pack.FindItemByType(typeof(MyItem));
	        if(item != null)
                {
            	    item.MoveToWorld(parent.Location, parent.Map);
                    return DeathMoveResult.RemainEquiped;
                }
            }
            return DeathMoveResult.MoveToBackpack;
        }

That way, we can find out exactly what 'parent' is and then we can go about finding the item. The 'parent' may be a Corpse at that point, I'm not sure, which would make it so it does not have a pack to find your item in.
 
Top