Go Back   RunUO - Ultima Online Emulation > RunUO > Server Support on Windows

Server Support on Windows Get (and give) support on general questions related to the RunUO server itself.

Reply
 
Thread Tools Display Modes
Old 05-08-2008, 01:32 PM   #1 (permalink)
Newbie
 
Join Date: Jun 2006
Age: 26
Posts: 12
Default trouble with custom race

hi everyone, i did a custom race editing RaceDefinition.cs, and i added the Drow Race.

I also created 3 gates for switching races, HumanGate, ElvenGate and DrowishGate...

the compiler as no problem with human and elven ones, but it says:
Quote:
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Custom/Mie Razze/DrowGate.cs:
CS0117: Line 30: 'Server.Race' does not contain a definition for 'Drow'
how can i fix it?

here's my racedefinition.cs (only the part after the elven race)
Code:
...


		private class Drow : Race
		{
			private static int[] m_SkinHues = new int[]
				{
					0x381, 0x382, 0x383, 0x389, 0x3E5, 0x3E6, 0x4DE, 0x51D, 0x76B
				};

			private static int[] m_HairHues = new int[]
				{
					0x034, 0x035, 0x036, 0x037, 0x038, 0x039, 0x058, 0x08E,
					0x08F, 0x090, 0x091, 0x092, 0x101, 0x159, 0x15A, 0x15B,
					0x15C, 0x15D, 0x15E, 0x128, 0x12F, 0x1BD, 0x1E4, 0x1F3,
					0x207, 0x211, 0x239, 0x251, 0x26C, 0x2C3, 0x2C9, 0x31D,
					0x31E, 0x31F, 0x320, 0x321, 0x322, 0x323, 0x324, 0x325,
					0x326, 0x369, 0x386, 0x387, 0x388, 0x389, 0x38A, 0x59D,
					0x6B8, 0x725, 0x853
				};

			public Drow( int raceID, int raceIndex )
				: base( raceID, raceIndex, "Drow", "Drow", 605, 606, 607, 608, Expansion.ML )
			{
			}

			public override bool ValidateHair( bool female, int itemID )
			{
				if( itemID == 0 )
					return true;

				if( (female && (itemID == 0x2FCD || itemID == 0x2FBF)) || (!female && (itemID == 0x2FCC || itemID == 0x2FD0)) )
					return false;

				if( itemID >= 0x2FBF && itemID <= 0x2FC2 )
					return true;

				if( itemID >= 0x2FCC && itemID <= 0x2FD1 )
					return true;

				return false;
			}
			public override int RandomHair( bool female )	//Random hair doesn't include baldness
			{
				switch( Utility.Random( 8 ) )
				{
					case 0: return 0x2FC0;	//Long Feather
					case 1: return 0x2FC1;	//Short
					case 2: return 0x2FC2;	//Mullet
					case 3: return 0x2FCE;	//Knob
					case 4: return 0x2FCF;	//Braided
					case 5: return 0x2FD1;	//Spiked
					case 6: return (female ? 0x2FCC : 0x2FBF);	//Flower or Mid-long
					default: return (female ? 0x2FD0 : 0x2FCD);	//Bun or Long
				}
			}

			public override bool ValidateFacialHair( bool female, int itemID )
			{
				return (itemID == 0);
			}
			public override int RandomFacialHair( bool female )
			{
				return 0;
			}

			public override int ClipSkinHue( int hue )
			{
				for( int i = 0; i < m_SkinHues.Length; i++ )
					if( m_SkinHues[i] == hue )
						return hue;

				return m_SkinHues[0];
			}

			public override int RandomSkinHue()
			{
				return m_SkinHues[Utility.Random( m_SkinHues.Length )] | 0x8000;
			}

			public override int ClipHairHue( int hue )
			{
				for( int i = 0; i < m_HairHues.Length; i++ )
					if( m_HairHues[i] == hue )
						return hue;

				return m_HairHues[0];
			}

			public override int RandomHairHue()
			{
				return m_HairHues[Utility.Random( m_HairHues.Length )];
			}
		}
	}
}
and here my gate...

Code:
using System;

namespace Server.Items
{
	public class DrowGate : Item
	{
		[Constructable]
		public DrowGate() : base(0xF6C)
		{
			Movable = false;
			Light = LightType.Circle300;
			Hue = 0x0BF; 
			Name = "Drow Race Gate"; 
		}

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

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

			writer.Write((int) 0);
		}

	public override bool OnMoveOver( Mobile m ) 
		{ 
			m.SendMessage( "Ora sei un Drow" ); // You're now a Drow
			m.Race = Race.Drow;
			m.Hue = Utility.RandomList ( 0x381, 0x382, 0x383, 0x389, 0x3E5, 0x3E6, 0x4DE, 0x51D, 0x76B );
			return false; //Changed this to false
		}

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

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

Last edited by alex92; 05-08-2008 at 03:49 PM.
alex92 is offline   Reply With Quote
Old 05-08-2008, 03:04 PM   #2 (permalink)
Forum Novice
 
Soteric's Avatar
 
Join Date: Aug 2006
Location: Russia, Rostov-on-Don
Posts: 763
Send a message via ICQ to Soteric
Default

From Race.cs (core file):
Code:
public static Race Human { get { return m_Races[0]; } }
public static Race Elf { get { return m_Races[1]; } }
So I think you should add a new Drow variable here as minimum... Maybe some other changes should be done also
Soteric is online now   Reply With Quote
Old 05-08-2008, 04:05 PM   #3 (permalink)
Newbie
 
Join Date: Jun 2006
Age: 26
Posts: 12
Default

Quote:
Originally Posted by Soteric View Post
From Race.cs (core file):
Code:
public static Race Human { get { return m_Races[0]; } }
public static Race Elf { get { return m_Races[1]; } }
So I think you should add a new Drow variable here as minimum... Maybe some other changes should be done also
uhm... i can't find that file in my script folders (i'm using RunUO 2.0 RC2)...

but in game "[set race drow" works as well, it's only when i try to change the race from scripts...
alex92 is offline   Reply With Quote
Old 05-08-2008, 04:48 PM   #4 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 41
Posts: 1,424
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Quote:
Originally Posted by alex92 View Post
uhm... i can't find that file in my script folders (i'm using RunUO 2.0 RC2)...

but in game "[set race drow" works as well, it's only when i try to change the race from scripts...
The "Core" is the Server core files (the ones you don't normally see, like Mobile.cs, Skills.cs, etc. which are in the Server folder.) You have to recompile the core with your new Race added to Race.cs, like he said.
Lokai is offline   Reply With Quote
Old 05-08-2008, 04:55 PM   #5 (permalink)
Newbie
 
Join Date: Jun 2006
Age: 26
Posts: 12
Default

Quote:
Originally Posted by Lokai View Post
The "Core" is the Server core files (the ones you don't normally see, like Mobile.cs, Skills.cs, etc. which are in the Server folder.) You have to recompile the core with your new Race added to Race.cs, like he said.
sorry for my inexperience, but i still don't understand how/where can i find race.cs...

please, don't kill me
alex92 is offline   Reply With Quote
Old 05-08-2008, 05:02 PM   #6 (permalink)
Forum Novice
 
Soteric's Avatar
 
Join Date: Aug 2006
Location: Russia, Rostov-on-Don
Posts: 763
Send a message via ICQ to Soteric
Default

You need RunUO source files. After downloading make changes in Race.cs and recompile .exe file. This thread can help you
Soteric is online now   Reply With Quote
Old 05-08-2008, 05:22 PM   #7 (permalink)
Newbie
 
Join Date: Jun 2006
Age: 26
Posts: 12
Default

ok, thank you both

p.s.

after
Code:
		public static Race Human { get { return m_Races[0]; } }
		public static Race Elf { get { return m_Races[1]; } }
i have to put
Code:
		public static Race Drow { get { return m_Races[2]; } }
OR

Code:
		public static Race Drow { get { return m_Races[32]; } }
(the same ID that i used in RaceDefinition.cs) ?

Last edited by alex92; 05-08-2008 at 05:34 PM.
alex92 is offline   Reply With Quote
Old 05-08-2008, 06:38 PM   #8 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 41
Posts: 1,424
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Yes, and in RaceDefinition, you will use 32, 32 for the initializer.
Lokai is offline   Reply With Quote
Old 05-08-2008, 07:11 PM   #9 (permalink)
Newbie
 
Join Date: Jun 2006
Age: 26
Posts: 12
Default

Quote:
Originally Posted by Lokai View Post
Yes, and in RaceDefinition, you will use 32, 32 for the initializer.
ok, got it, thanks again
alex92 is offline   Reply With Quote
Old 05-10-2008, 06:34 AM   #10 (permalink)
Forum Expert
 
Join Date: Oct 2002
Age: 45
Posts: 4,363
Default

You can also add new custom races without core edits by defining them in racedefinitions.cs, only you can't reference them by name - you have to reference them by their index number.
__________________
HellRazor is offline   Reply With Quote
Old 05-10-2008, 10:12 AM   #11 (permalink)
Forum Expert
 
Lokai's Avatar
 
Join Date: Aug 2003
Location: Bergen, NY (Rochester)
Age: 41
Posts: 1,424
Send a message via ICQ to Lokai Send a message via MSN to Lokai Send a message via Yahoo to Lokai
Default

Quote:
Originally Posted by HellRazor View Post
You can also add new custom races without core edits by defining them in racedefinitions.cs, only you can't reference them by name - you have to reference them by their index number.
This is correct. If you do not do any core edit, you would reference the new race like this, for example:

if (m_From.Race == Race.Races[32]) m_From.RemoveItem(tool);
Lokai is offline   Reply With Quote
Old 05-10-2008, 10:26 AM   #12 (permalink)
Newbie
 
Join Date: Jun 2006
Age: 26
Posts: 12
Default

too late, i already edited the core, and now the drowish gate works as expected

thanks anyway
alex92 is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5