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
In what class are you putting this code? As long as using System; is at the top of the script you are using, that debug line should work, unless I'm missing something right in front of my nose again.
 

Malaperth

Wanderer
Ok, paste this at the very top inside of the OnBeforeDeath method so we can see a bit more of what's going on:

Code:
Container pack = this.Backpack;
if(pack != null)
{
	Console.WriteLine("found backpack");	
	Item testItem = pack.FindItemByType(typeof(FlagItem));
	if(testItem != null)
	{
		Console.WriteLine("player has FlagItem at this point OnBeforeDeath");
	}
	else
	{
		Console.WriteLine("player does NOT have FlagItem at this point OnBeforeDeath");
	}
}
 

JMB Networks

Wanderer
script

heres the script


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;
		}

//////////////////////////////////////////////////////////////////////////////////////////
Container pack = this.Backpack;
if(pack != null)
{
	Console.WriteLine("found backpack");	
	Item testItem = pack.FindItemByType(typeof(FlagItem));
	if(testItem != null)
	{
		Console.WriteLine("player has FlagItem at this point OnBeforeDeath");
	}
	else
	{
		Console.WriteLine("player does NOT have FlagItem at this point OnBeforeDeath");
	}
}

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

		

		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
First, that code I most recently gave you belongs in the OnBeforeDeath method in PlayerMobile.cs.

Second, where is the OnInventoryDeath method you have been editing?
 
Top