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!

Exchange Stone

Shadow_2004

Wanderer
Exchange Stone

Im getting problems i want to exchange a ring you get from a quest to a horse in return but it is not working can you show me whats wrong please

Code:
using System; 
using Server.Items; 

namespace Server.Items 
{ 
[Serializable()] 
public class Qone : Item 
{ 
[Constructable] 
public Qone() : base( 0xED4 ) 
{ 
Movable = True; 
Hue = 0x85; 
Name = "A Quest 1 Exchange Stone"; 
} 


public override void GetProperties( ObjectPropertyList list ) 
{ 
base.GetProperties( list ); 

list.Add( "The Evil Mage Ring for The Shadow Horse"); 
} 

public override void OnDoubleClick( Mobile from ) 
{ 
Container pack = from.Backpack; 
if ( pack != null && pack.ConsumeItem( Qoner ) ) ;
{ 
from.Backpack.AddItem( new Shadowhorse(1) );

((Mobile)from).SendMessage("You Exchange The Ring For The Horse."); 

} 
else 
((Mobile)from).SendMessage("You do not have The Ring."); 
} 

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

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

writer.Write( (int) 0 ); // version 
} 

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

int version = reader.ReadInt(); 
} 
} 
}

thx
 

PerfectWing

Wanderer
What does it do wrong, and I'm actually suprised it'll even compile (assuming it does)?

Code:
if ( pack != null && pack.ConsumeItem( Qoner ) ) ;
Semicolon?
 

Geezer

Wanderer
Shadow_2004 said:
public override void OnDoubleClick( Mobile from )
{
Container pack = from.Backpack;
if ( pack != null && pack.ConsumeItem( Qoner ) ) ;
{
from.Backpack.AddItem( new Shadowhorse(1) );

((Mobile)from).SendMessage("You Exchange The Ring For The Horse.");

}
else
((Mobile)from).SendMessage("You do not have The Ring.");
}
Once you double click the exchange stone, this code would consume the stone and not the ring. Try this...
Code:
public override void OnDoubleClick( Mobile from ) 
{ 
	Container pack = from.Backpack; 
	if ( from.Backpack.ConsumeTotal( typeof( [COLOR=Red]NAMEOFTHERINGITEM[/COLOR] ), 1 ) )
	{
		from.AddToBackpack( new Shadowhorse() );
		from.SendMessage("You Exchange The Ring For The Horse."); 
	}
	else 
		from.SendMessage("You do not have The Ring."); 
}
Don't forget to change the red bit for whatever the name of your ring is.
 

Shadow_2004

Wanderer
i get this

this it wot i get

Error: Scripts\Custom\Town Quests\Reward Quest 1.cs: CS0103: (line 12, column
1) The name 'False' does not exist in the class or namespace 'Server.Items.Qone


and this is the script
Code:
using System; 
using Server.Items; 

namespace Server.Items 
{ 
[Serializable()] 
public class Qone : Item 
{ 
[Constructable] 
public Qone() : base( 0xED4 ) 
{ 
Movable = False; 
Hue = 0x85; 
Name = "A Quest 1 Exchange Stone"; 
} 


public override void GetProperties( ObjectPropertyList list ) 
{ 
base.GetProperties( list ); 

list.Add( "The Evil Mage Ring for The Shadow Horse"); 
} 

public override void OnDoubleClick( Mobile from ) 
{ 
Container pack = from.Backpack; 
if ( from.Backpack.ConsumeTotal( typeof( Qoner ), 1 ) )
{ 
from.Backpack.AddItem( new Shadowhorse(1) );

((Mobile)from).SendMessage("You Exchange The Ring For The Horse."); 

} 
else 
((Mobile)from).SendMessage("You do not have The Ring."); 
} 

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

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

writer.Write( (int) 0 ); // version 
} 

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

int version = reader.ReadInt(); 
} 
} 
}
 

Shadow_2004

Wanderer
its

its ok, it should be false not False but its having problems reading the horse it gives me this error

24) The name 'Shadowhorse' does not exist in the class or namespace 'Server.Ite
ms.Qone'

Code:
using System;
using Server.Mobiles;

namespace Server.Mobiles
{
	[CorpseName( "a Shadow Horse corpse" )]
	[TypeAlias( "Server.Mobiles.BrownHorse", "Server.Mobiles.DirtyHorse", "Server.Mobiles.GrayHorse", "Server.Mobiles.TanHorse" )]
	public class Shadowhorse : BaseMount
	{
		private static int[] m_IDs = new int[]
			{
				0xC8, 0x3E9F,
				0xE2, 0x3EA0,
				0xE4, 0x3EA1,
				0xCC, 0x3EA2
			};

		[Constructable]
		public Shadowhorse() : this( "a Shadow horse" )
		{
		}

		[Constructable]
		public Shadowhorse( string name ) : base( name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Agressor, 10, 1, 0.2, 0.4 )
		{
			int random = Utility.Random( 4 );

			Body = m_IDs[random * 2];
			ItemID = m_IDs[random * 2 + 1];
			BaseSoundID = 0xA8;

			SetStr( 82, 118 );
			SetDex( 56, 75 );
			SetInt( 6, 10 );

			SetHits( 28, 45 );
			SetMana( 0 );

			SetDamage( 7, 10 );

			SetDamageType( ResistanceType.Physical, 100 );

			SetResistance( ResistanceType.Physical, 15, 20 );

			SetSkill( SkillName.MagicResist, 25.1, 30.0 );
			SetSkill( SkillName.Tactics, 29.3, 44.0 );
			SetSkill( SkillName.Wrestling, 29.3, 44.0 );

			Fame = 300;
			Karma = 300;

			Tamable = true;
			ControlSlots = 1;
			MinTameSkill = 29.1;
		}

		public override int Meat{ get{ return 3; } }
		public override int Hides{ get{ return 10; } }
		public override FoodType FavoriteFood{ get{ return FoodType.FruitsAndVegies | FoodType.GrainsAndHay; } }

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

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

			writer.Write( (int) 0 ); // version
		}

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

			int version = reader.ReadInt();
		}
	}
}

and this is the exchange stone
Code:
using System; 
using Server.Items; 

namespace Server.Items 
{ 
[Serializable()] 
public class Qone : Item 
{ 
[Constructable] 
public Qone() : base( 0xED4 ) 
{ 
Movable = false; 
Hue = 0x85; 
Name = "A Quest 1 Exchange Stone"; 
} 


public override void GetProperties( ObjectPropertyList list ) 
{ 
base.GetProperties( list ); 

list.Add( "The Evil Mage Ring for The Shadow Horse"); 
} 

public override void OnDoubleClick( Mobile from ) 
{ 
Container pack = from.Backpack; 
if ( from.Backpack.ConsumeTotal( typeof( Qoner ), 1 ) )
{ 
from.Backpack.AddItem( Shadowhorse(1) );

((Mobile)from).SendMessage("You Exchange The Ring For The Horse."); 

} 
else 
((Mobile)from).SendMessage("You do not have The Ring."); 
} 

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

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

writer.Write( (int) 0 ); // version 
} 

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

int version = reader.ReadInt(); 
} 
} 
}
 

PerfectWing

Wanderer
using Server.Mobiles;

You need that using directive to allow that class access to the Server.Mobiles namespace that the horse class is in.
 

Shadow_2004

Wanderer
erm

ok i think i got it but now, it says this

- Error: Scripts\Custom\Town Quests\Reward Quest 1.cs: CS0119: (line 30, colum
24) 'Server.Mobiles.Shadowhorse' denotes a 'class' which is not valid in the g
ven context

:confused:
 

Phantom

Knight
Shadow_2004 said:
so at the top of my exahcnge i have

using System;
using Server.Items;
Using Server.Mobiles;

:confused: thx

The code you posted, doesn't have what you claim.

If you want help please post the current code, but the code you posted doesn't have what Spider suggested.

If you don't like the advice your getting, your welcome to figure it out on your own, otherwise lose the sarcastic replies.

If you continue to be sarcastic, I will be forced to not be nice, and report your sarcastic replies as being rude...

So please do yourself a favor and lose the sarcastic attitude or help yourself and go away.
 

Shadow_2004

Wanderer
o

ok i ahvent meant to sarcastic, sorry, this script well annoying me lol, If i have then Im Really Sorry

- Error: Scripts\Custom\Town Quests\Reward Quest 1.cs: CS0119: (line 30, colum
24) 'Server.Mobiles.Shadowhorse' denotes a 'class' which is not valid in the g
ven context

Code:
using System; 
using Server.Items;

namespace Server.Mobiles
{ 
[Serializable()] 
public class Qone : Item 
{ 
[Constructable] 
public Qone() : base( 0xED4 ) 
{ 
Movable = false; 
Hue = 0x85; 
Name = "A Quest 1 Exchange Stone"; 
} 


public override void GetProperties( ObjectPropertyList list ) 
{ 
base.GetProperties( list ); 

list.Add( "The Evil Mage Ring for The Shadow Horse"); 
} 

public override void OnDoubleClick( Mobile from ) 
{ 
Container pack = from.Backpack; 
if ( from.Backpack.ConsumeTotal( typeof( Qoner ), 1 ) )
{ 
from.Backpack.AddItem( Shadowhorse(1) );

((Mobile)from).SendMessage("You Exchange The Ring For The Horse."); 

} 
else 
((Mobile)from).SendMessage("You do not have The Ring."); 
} 

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

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

writer.Write( (int) 0 ); // version 
} 

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

int version = reader.ReadInt(); 
} 
} 
}

thx
 

Phantom

Knight
You didn't post the right class.

I cannot help, unless you post the class with the error.

The namespace for the item you posted, should be in the Server.Items namespace not Server.Mobiles considering its an Item
 

Shadow_2004

Wanderer
erm

well, the stone suppose to consume the ring and u get a shadow horse, but it seems not to work, i cant figure it out :( when i put namespace Server.Items, it cant find the horse?

this is the error i get wiv server.items
- Error: Scripts\Custom\Town Quests\Reward Quest 1.cs: CS0103: (line 30, colum
24) The name 'Shadowhorse' does not exist in the class or namespace 'Server.It
ms.Qone'

and this is the script
Code:
using System; 
using Server.Items;

namespace Server.Items
{ 
[Serializable()] 
public class Qone : Item 
{ 
[Constructable] 
public Qone() : base( 0xED4 ) 
{ 
Movable = false; 
Hue = 0x85; 
Name = "A Quest 1 Exchange Stone"; 
} 


public override void GetProperties( ObjectPropertyList list ) 
{ 
base.GetProperties( list ); 

list.Add( "The Evil Mage Ring for The Shadow Horse"); 
} 

public override void OnDoubleClick( Mobile from ) 
{ 
Container pack = from.Backpack; 
if ( from.Backpack.ConsumeTotal( typeof( Qoner ), 1 ) )
{ 
from.Backpack.AddItem( Shadowhorse(1) );

((Mobile)from).SendMessage("You Exchange The Ring For The Horse."); 

} 
else 
((Mobile)from).SendMessage("You do not have The Ring."); 
} 

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

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

writer.Write( (int) 0 ); // version 
} 

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

int version = reader.ReadInt(); 
} 
} 
}

thx
 

daat99

Moderator
Staff member
Try to add this at the top:
Code:
using Server;
using Server.Mobiles;
If that doesn't work then please post the shadowhorse script.

*edit*
Give etherkye reply a try first, he might be onto the problem.
 

Shadow_2004

Wanderer
yeh

i tried

using System;
using Server.Mobiles;
using Server.Items;,

at the top of exchange stone, no luck :(

- Error: Scripts\Custom\Town Quests\Reward Quest 1.cs: CS0246: (line 30, column
28) The type or namespace name 'Shadowhorse' could not be found (are you missin
g a using directive or an assembly reference?)

i think this bit cauing the problem
Code:
public override void OnDoubleClick( Mobile from ) 
{ 
Container pack = from.Backpack; 
if ( from.Backpack.ConsumeTotal( typeof( Qoner ), 1 ) )
{ 
from.Backpack.AddItem( new Shadowhorse() );
 

daat99

Moderator
Staff member
Shadow_2004 said:
i tried

using System;
using Server.Mobiles;
using Server.Items;,

at the top of exchange stone, no luck :(

- Error: Scripts\Custom\Town Quests\Reward Quest 1.cs: CS0246: (line 30, column
28) The type or namespace name 'Shadowhorse' could not be found (are you missin
g a using directive or an assembly reference?)

i think this bit cauing the problem
Code:
public override void OnDoubleClick( Mobile from ) 
{ 
Container pack = from.Backpack; 
if ( from.Backpack.ConsumeTotal( typeof( Qoner ), 1 ) )
{ 
from.Backpack.AddItem( new Shadowhorse() );
Please post the shadowhorse script like I asked you in my previus post, ty.
 

Shadow_2004

Wanderer
erm

yeh just tried that still get the same error

- Error: Scripts\Custom\Town Quests\Reward Quest 1.cs: CS0103: (line 30, column
24) The name 'ShadowHorse' does not exist in the class or namespace 'Server.Ite
ms.Qone'

this is my horse script
Code:
using System;
using Server.Mobiles;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "a Shadow Horse corpse" )]
	[TypeAlias( "Server.Mobiles.BrownHorse", "Server.Mobiles.DirtyHorse", "Server.Mobiles.GrayHorse", "Server.Mobiles.TanHorse" )]
	public class ShadowHorse : BaseMount
	{
		private static int[] m_IDs = new int[]
			{
				0xC8, 0x3E9F,
				0xE2, 0x3EA0,
				0xE4, 0x3EA1,
				0xCC, 0x3EA2
			};

		[Constructable]
		public ShadowHorse() : this( "a Shadow horse" )
		{
		}

		[Constructable]
		public ShadowHorse( string name ) : base( name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Agressor, 10, 1, 0.2, 0.4 )
		{
			int random = Utility.Random( 4 );

			Body = m_IDs[random * 2];
			ItemID = m_IDs[random * 2 + 1];
			BaseSoundID = 0xA8;

			SetStr( 82, 118 );
			SetDex( 56, 75 );
			SetInt( 6, 10 );

			SetHits( 28, 45 );
			SetMana( 0 );

			SetDamage( 7, 10 );

			SetDamageType( ResistanceType.Physical, 100 );

			SetResistance( ResistanceType.Physical, 15, 20 );

			SetSkill( SkillName.MagicResist, 25.1, 30.0 );
			SetSkill( SkillName.Tactics, 29.3, 44.0 );
			SetSkill( SkillName.Wrestling, 29.3, 44.0 );

			Fame = 300;
			Karma = 300;

			Tamable = true;
			ControlSlots = 1;
			MinTameSkill = 29.1;
		}

		public override int Meat{ get{ return 3; } }
		public override int Hides{ get{ return 10; } }
		public override FoodType FavoriteFood{ get{ return FoodType.FruitsAndVegies | FoodType.GrainsAndHay; } }

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

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

			writer.Write( (int) 0 ); // version
		}

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

			int version = reader.ReadInt();
		}
	}
}

I mite just give up LOL :( :eek:
 

daat99

Moderator
Staff member
C# is case sensitive language, that means it look for upper and lower cases.
Your shadow horse script is called ShadowHorse (notice upper case the S and H).
You tried to call it using Shadowhorse (Notice that the h is lower case this time).
Try using ShadowHorse instead of Shadorhorse.
 
Top