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!

Basic ML & Elf functionality

jaynigs said:
yes that part is fine, the problem sounds like you havent recompiled the core, or you have and forgot to copy the server.exe to your server directory.
ok, then I am missing a step. So after 1-7 steps, how do I compile?
 

Greystar

Wanderer
FreeshardNoob said:
ok, then I am missing a step. So after 1-7 steps, how do I compile?

First u need to make a valid project containing all of the necessary files (everything in the RunUO Source directory is needed, basically) along with maintaining file and folder structure. It is different based on what you use to compile it with (either Visual Studio or Shard Dev) if you are going to use VS I'd recommend using one that only uses .Net 1.1 framework or earlier. Besides that there is already information in the Faq forum for Compiling the Core. Creating a project can be done through a couple of methods the most common one is using a Third Party Program to make you a project file that is openable in either VS2kX (where X is the year) or ShardDev. Beyond that there isn't much more I can explain.
 

dashiznit_76

Wanderer
ok back to the original post of this thread. I added the said stuff compiled just fine but one problem in game. When a player dies they are changed back to human body form. any insight as to why this is?

I am thinking maybe something missing from Mobile.cs around the
Code:
		public virtual void Resurrect()
		{
			if ( !Alive )
			{
				if ( !Region.OnResurrect( this ) )
					return;

				if ( !CheckResurrect() )
					return;

				OnBeforeResurrect();

				BankBox box = FindBankNoCreate();

				if ( box != null && box.Opened )
					box.Close();

				Poison = null;

				Warmode = false;

				Hits = 10;
				Stam = StamMax;
				Mana = 0;

				BodyMod = (Body)0;
				Body = m_Female ? 0x191 : 0x190;
Area
 

arul

Sorceror
dashiznit_76 said:
ok back to the original post of this thread. I added the said stuff compiled just fine but one problem in game. When a player dies they are changed back to human body form. any insight as to why this is?

I am thinking maybe something missing from PlayerMobile.cs ?????
ah, yes, its in the Mobile.cs, line 3173
Code:
Body = m_Female ? 0x191 : 0x190;
But to get this work you should add an Elf property to the mobile class.
Code:
                if (Elf)
                {
                    Body = m_Female ? 0x25E : 0x25D;
                }
                else
                {
                    Body = m_Female ? 0x191 : 0x190;
                }
 

dashiznit_76

Wanderer
Well I added the Elf property to class, serialized, deserialized, compiled fine now I get OutOfMemoryExceptions on all my mobiles. any clues here?
Code:
World: Loading...failed to load mobile: System.OutOfMemoryException: Exception o
f type System.OutOfMemoryException was thrown.
An error was encountered while loading a saved object
 - Type: Server.Mobiles.PlayerMobile
 - Serial: 0x00008086
Delete the object? (y/n)
and my edits were
Code:
		private bool m_Female, [COLOR="Red"]m_Elf[/COLOR], m_Warmode, m_Hidden, m_Blessed;
in the public virtual void Resurrect section
Code:
				BodyMod = (Body)0;
				//Body = m_Female ? 0x191 : 0x190;
                if (m_Elf)
                {
                    Body = m_Female ? 0x25E : 0x25D;
                }
                else
                {
                    Body = m_Female ? 0x191 : 0x190;
                }
in the public virtual void OnDeath
Code:
				BodyMod = (Body)0;
				//Body = this.Female ? 0x193 : 0x192;
				if (m_Elf)
                {
                	Body = m_Female ? 0x260 : 0x25F;
                }
                else
                {
                	Body = m_Female ? 0x193 : 0x192;
                }
Deserialized
Code:
					m_Female = reader.ReadBool();
					[COLOR="red"]m_Elf = reader.ReadBool();[/COLOR]
					m_Warmode = reader.ReadBool();
Serialized
Code:
			writer.Write( m_Female );
			[COLOR="red"]writer.Write( m_Elf );[/COLOR]
			writer.Write( m_Warmode );
			writer.Write( m_Hidden );
and Added the CommandProperty
Code:
		[CommandProperty( AccessLevel.GameMaster )]
		public bool Elf
		{
			get
			{
				return m_Elf;
			}
			set
			{
				if ( m_Elf != value )
				{
					m_Elf = value;
				}
			}
		}
I might have missed something but I cant seem to figure out what it was

***EDIT*** I figured it out I was trying to read before it wrote the elf value to mobiles had to do 2 core compiles to fix it one that simply wote it...then the second that read and wrote. Now works perfectly.
 

haazen

Sorceror
I really hate asking but I am stumped.

I did all things in this post with a few minor differences.

I did edit BodyTyes.bin to inclued all things that are listed in bodies.html.

I also did not do 2 compiles of the core. I added m_Elf to Mobile.cs with a version increase to 29.

One thing I did that was not listed here was change Body.cs to include the 607 and 608 bodyid as ghosts.

All things work when elf dies like death shroud, grey screen, Do You Want To Report This Murder, body ID is 607 or 608. The only thing that does not get set correctly is the ReadOnly property Alive. Bool Alive stay True. So therefore the critter that killed the elf does not stop attacking and keeps killing the elf over and over again. Leaving a trail of Invisible corpses. Also can not resurrect because Alive is still set to True.

I can not find why or where Alive gets set to False. I assume it gets returned from the client?

What do I need to do to fix this please?
 

blueocean

Wanderer
Body.cs

Code:
/***************************************************************************
 *                                  Body.cs
 *                            -------------------
 *   begin                : May 1, 2002
 *   copyright            : (C) The RunUO Software Team
 *   email                : [email protected]
 *
 *   $Id: Body.cs,v 1.3 2005/01/22 04:25:04 krrios Exp $
 *   $Author: krrios $
 *   $Date: 2005/01/22 04:25:04 $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

using System;
using System.IO;

namespace Server
{
	public enum BodyType : byte
	{
		Empty,
		Monster,
		Sea,
		Animal,
		Human,
		Equipment
	}

	public struct Body
	{
		private int m_BodyID;

		private static BodyType[] m_Types;

		static Body()
		{
			if ( File.Exists( "Data/Binary/BodyTypes.bin" ) )
			{
				using ( BinaryReader bin = new BinaryReader( new FileStream( "Data/Binary/BodyTypes.bin", FileMode.Open, FileAccess.Read, FileShare.Read ) ) )
				{
					m_Types = new BodyType[(int)bin.BaseStream.Length];

					for ( int i = 0; i < m_Types.Length; ++i )
						m_Types[i] = (BodyType)bin.ReadByte();
				}
			}
			else
			{
				Console.WriteLine( "Warning: Data/Binary/BodyTypes.bin does not exist" );

				m_Types = new BodyType[0];
			}
		}

		public Body( int bodyID )
		{
			m_BodyID = bodyID;
		}

		public BodyType Type
		{
			get
			{
				if ( m_BodyID >= 0 && m_BodyID < m_Types.Length )
					return m_Types[m_BodyID];
				else
					return BodyType.Empty;
			}
		}

		public bool IsHuman
		{
			get
			{
				return m_BodyID >= 0
					&& m_BodyID < m_Types.Length
					&& m_Types[m_BodyID] == BodyType.Human
					&& m_BodyID != 402
					&& m_BodyID != 404
					&& m_BodyID != 970
					[b]&& m_BodyID != 605
					&& m_BodyID != 606[/b];
			}
		}

		public bool IsMale
		{
			get
			{
				return m_BodyID == 183
					|| m_BodyID == 185
					|| m_BodyID == 400
					|| m_BodyID == 402
					|| m_BodyID == 750
					[b]|| m_BodyID == 605
					|| m_BodyID == 607[/b];
			}
		}

		public bool IsFemale
		{
			get
			{
				return m_BodyID == 184
					|| m_BodyID == 186
					|| m_BodyID == 401
					|| m_BodyID == 403
					|| m_BodyID == 751
					[b]|| m_BodyID == 606
					|| m_BodyID == 608[/b];
			}
		}

		public bool IsGhost
		{
			get
			{
				return m_BodyID == 402
					|| m_BodyID == 403
					|| m_BodyID == 970
					[b]|| m_BodyID == 607
					|| m_BodyID == 608[/b];
			}
		}

		public bool IsMonster
		{
			get
			{
				return m_BodyID >= 0
					&& m_BodyID < m_Types.Length
					&& m_Types[m_BodyID] == BodyType.Monster;
			}
		}

		public bool IsAnimal
		{
			get
			{
				return m_BodyID >= 0
					&& m_BodyID < m_Types.Length
					&& m_Types[m_BodyID] == BodyType.Animal;
			}
		}

		public bool IsEmpty
		{
			get
			{
				return m_BodyID >= 0
					&& m_BodyID < m_Types.Length
					&& m_Types[m_BodyID] == BodyType.Empty;
			}
		}

		public bool IsSea
		{
			get
			{
				return m_BodyID >= 0
					&& m_BodyID < m_Types.Length
					&& m_Types[m_BodyID] == BodyType.Sea;
			}
		}

		public bool IsEquipment
		{
			get
			{
				return m_BodyID >= 0
					&& m_BodyID < m_Types.Length
					&& m_Types[m_BodyID] == BodyType.Equipment;
			}
		}

		public int BodyID
		{
			get
			{
				return m_BodyID;
			}
		}

		public static implicit operator int( Body a )
		{
			return a.m_BodyID;
		}

		public static implicit operator Body( int a )
		{
			return new Body( a );
		}

		public override string ToString()
		{
			return string.Format( "0x{0:X}", m_BodyID );
		}

		public override int GetHashCode()
		{
			return m_BodyID;
		}

		public override bool Equals( object o )
		{
			if ( o == null || !(o is Body) ) return false;

			return ((Body)o).m_BodyID == m_BodyID;
		}

		public static bool operator == ( Body l, Body r )
		{
			return l.m_BodyID == r.m_BodyID;
		}

		public static bool operator != ( Body l, Body r )
		{
			return l.m_BodyID != r.m_BodyID;
		}

		public static bool operator > ( Body l, Body r )
		{
			return l.m_BodyID > r.m_BodyID;
		}

		public static bool operator >= ( Body l, Body r )
		{
			return l.m_BodyID >= r.m_BodyID;
		}

		public static bool operator < ( Body l, Body r )
		{
			return l.m_BodyID < r.m_BodyID;
		}

		public static bool operator <= ( Body l, Body r )
		{
			return l.m_BodyID <= r.m_BodyID;
		}
	}
}
 

haazen

Sorceror
Thank you so much. I had that exact entries in Body.cs. I guess it helps to recompile after making the changes. I've been chasing this for 2 full days. But the idiot I am, I made the additions to Body.cs and did not recompile.

Thanks for getting my brain working again. A little anyway.
 

Lubomir

Wanderer
Elf changes to human upon death

I have made the changes to the mobile.cs suggested by dashiznit_76.

I added the command property like this:

Code:
		[CommandProperty( AccessLevel.Counselor )]
		public virtual int EnergyResistance
		{
			get{ return GetResistance( ResistanceType.Energy ); }
		}
		
		[CommandProperty( AccessLevel.GameMaster )]
		public bool Elf
		{
			get
			{
				return m_Elf;
			}
			set
			{
				if ( m_Elf != value )
				{
					m_Elf = value;
				}
			}
		}

the lines to the public virtual void Ressurect section like this:

Code:
		public virtual void Resurrect()
		{
			if ( !Alive )
			{
				if ( !Region.OnResurrect( this ) )
					return;

				if ( !CheckResurrect() )
					return;

				OnBeforeResurrect();

				BankBox box = FindBankNoCreate();

				if ( box != null && box.Opened )
					box.Close();

				Poison = null;

				Warmode = false;

				Hits = 10;
				Stam = StamMax;
				Mana = 0;

				BodyMod = 0;
								
				if (m_Elf)
				{
					Body = m_Female ? 0x25E : 0x25D;
				}
				else
				{
					Body = m_Female ? 0x191 : 0x190;
				}

				ProcessDeltaQueue();

				for ( int i = m_Items.Count - 1; i >= 0; --i )
				{
					if ( i >= m_Items.Count )
						continue;

					Item item = (Item)m_Items[i];

					if ( item.ItemID == 0x204E )
						item.Delete();
				}

				this.SendIncomingPacket();
				this.SendIncomingPacket();

				OnAfterResurrect();

				//Send( new DeathStatus( false ) );
			}
		}

and in the public virtual void OnDeath:

Code:
		public virtual void OnDeath( Container c )
		{
			int sound = this.GetDeathSound();

			if ( sound >= 0 )
				Effects.PlaySound( this, this.Map, sound );
			
			if ( !m_Player )
			{
				Delete();
			}
			else
			{
				Send( DeathStatus.Instantiate( true ) );

				Warmode = false;

				BodyMod = 0;
				//Body = this.Female ? 0x193 : 0x192;
				if (m_Elf)
				{
					Body = this.Female ? 0x260 : 0x25F;
				}
				else
				{
					Body = this.Female ? 0x193 : 0x192;
				}

				Item deathShroud = new Item( 0x204E );

				deathShroud.Movable = false;
				deathShroud.Layer = Layer.OuterTorso;

				AddItem( deathShroud );

				m_Items.Remove(deathShroud);
				m_Items.Insert(0,deathShroud);

				Poison = null;
				Combatant = null;

				Hits = 0;
				Stam = 0;
				Mana = 0;

				EventSink.InvokePlayerDeath( new PlayerDeathEventArgs( this ) );

				ProcessDeltaQueue();

				Send( DeathStatus.Instantiate( false ) );

				CheckStatTimers();
			}
		}

And updated the body.cs as suggested by blueocean.

I tried to increment the serialization like this:

inthe deserialization

Code:
				case 29:
				{
					m_Elf = reader.ReadBool();
					
					goto case 28;
				}

and in the serialization

Code:
			writer.Write( (int) 29 ); // version

			writer.Write( m_Elf );

Any guidance or suggestions would be greatly appreciated.

Thank you in advance.

Lubomir
 

Greystar

Wanderer
Lubomir said:
I have made the changes to the mobile.cs suggested by dashiznit_76.

I added the command property like this:

Code:
		[CommandProperty( AccessLevel.Counselor )]
		public virtual int EnergyResistance
		{
			get{ return GetResistance( ResistanceType.Energy ); }
		}
		
		[CommandProperty( AccessLevel.GameMaster )]
		public bool Elf
		{
			get
			{
				return m_Elf;
			}
			set
			{
				if ( m_Elf != value )
				{
					m_Elf = value;
				}
			}
		}

the lines to the public virtual void Ressurect section like this:

Code:
		public virtual void Resurrect()
		{
			if ( !Alive )
			{
				if ( !Region.OnResurrect( this ) )
					return;

				if ( !CheckResurrect() )
					return;

				OnBeforeResurrect();

				BankBox box = FindBankNoCreate();

				if ( box != null && box.Opened )
					box.Close();

				Poison = null;

				Warmode = false;

				Hits = 10;
				Stam = StamMax;
				Mana = 0;

				BodyMod = 0;
								
				if (m_Elf)
				{
					Body = m_Female ? 0x25E : 0x25D;
				}
				else
				{
					Body = m_Female ? 0x191 : 0x190;
				}

				ProcessDeltaQueue();

				for ( int i = m_Items.Count - 1; i >= 0; --i )
				{
					if ( i >= m_Items.Count )
						continue;

					Item item = (Item)m_Items[i];

					if ( item.ItemID == 0x204E )
						item.Delete();
				}

				this.SendIncomingPacket();
				this.SendIncomingPacket();

				OnAfterResurrect();

				//Send( new DeathStatus( false ) );
			}
		}

and in the public virtual void OnDeath:

Code:
		public virtual void OnDeath( Container c )
		{
			int sound = this.GetDeathSound();

			if ( sound >= 0 )
				Effects.PlaySound( this, this.Map, sound );
			
			if ( !m_Player )
			{
				Delete();
			}
			else
			{
				Send( DeathStatus.Instantiate( true ) );

				Warmode = false;

				BodyMod = 0;
				//Body = this.Female ? 0x193 : 0x192;
				if (m_Elf)
				{
					Body = this.Female ? 0x260 : 0x25F;
				}
				else
				{
					Body = this.Female ? 0x193 : 0x192;
				}

				Item deathShroud = new Item( 0x204E );

				deathShroud.Movable = false;
				deathShroud.Layer = Layer.OuterTorso;

				AddItem( deathShroud );

				m_Items.Remove(deathShroud);
				m_Items.Insert(0,deathShroud);

				Poison = null;
				Combatant = null;

				Hits = 0;
				Stam = 0;
				Mana = 0;

				EventSink.InvokePlayerDeath( new PlayerDeathEventArgs( this ) );

				ProcessDeltaQueue();

				Send( DeathStatus.Instantiate( false ) );

				CheckStatTimers();
			}
		}

And updated the body.cs as suggested by blueocean.

I tried to increment the serialization like this:

inthe deserialization

Code:
				case 29:
				{
					m_Elf = reader.ReadBool();
					
					goto case 28;
				}

and in the serialization

Code:
			writer.Write( (int) 29 ); // version

			writer.Write( m_Elf );

Any guidance or suggestions would be greatly appreciated.

Thank you in advance.

Lubomir


Can't give any guidance when you didn't state what the problem was...
 

Lubomir

Wanderer
RE: Elf changes to human upon death

Sorry,

the problem is that when an elf dies and is resurrected the body value is changed to human. After some investigation, I found that this also is true for the ghost body value, it is human true.

Thank you,

Lubomir
 

Greystar

Wanderer
Lubomir said:
Sorry,

the problem is that when an elf dies and is resurrected the body value is changed to human. After some investigation, I found that this also is true for the ghost body value, it is human true.

Thank you,

Lubomir

did you make sure the elf property is set to TRUE in CharacterCreation.cs file?

ie code
Code:
			newChar.AccessLevel = ((Account)args.Account).AccessLevel;
			newChar.Female = args.Female;
			newChar.Elf = args.Elf;
			if ( newChar.Elf )
			{
				body = newChar.Female ? 0x25E : 0x25D;
			}
			else
			{
				body = newChar.Female ? 0x191 : 0x190;
			}
			newChar.Body = body;
 

Lubomir

Wanderer
Thank you

Greystar,

Thank you, that fixed it. I followed the instructions in the first post. I changed it to what you posted and it works great.

Thank you again,

Lubomir
 

dashiznit_76

Wanderer
Sorry for leaving that part out I got in a hurry cuz I was excited to finally get it working correctly. LOL Hats become crowns on elves and is completely normal, this is a feature of being an elf :)
 

Greystar

Wanderer
dashiznit_76 said:
Sorry for leaving that part out I got in a hurry cuz I was excited to finally get it working correctly. LOL Hats become crowns on elves and is completely normal, this is a feature of being an elf :)

hmm... thats a tad sucky... what about helms? if that happens with helms too I guess I'll just have to add a flag the sets the hair visible = false if they are an elf wearing a hat/helm but leave it visible if wearing a crown... bah... its only to test what people offer as coremods/fixes anyway so I dont really care, but I do care about OVERALL look for when these features actually get added to RunUO.
 

blueocean

Wanderer
This is my core, it compiles fine and ( for the moment ) no bugs found
I added a compile batch command to automatically compile core with .net framework
 

Attachments

  • RunUO - 1.0.0 - Source - Elves Mod.rar
    200.6 KB · Views: 98

Arcanus

Wanderer
Question Ocean:

When you run the batch file, it should compile the source in order for you to use the RunUO.exe file, correct?

The file should be renamed Server.exe and replace your original Server.exe, correct?

Just seeing if I missed a step. If I didn't, then I found an error.


When I do as mentioned, to a fresh install, I get a fatal error and the server shuts down. Did I miss a step or am I failing to do something specific other than what I've mentioned above?


Thanx in advance!
 

Arcanus

Wanderer
I "think" I might have found the problem. The build # of the exe file is not the same as the one that is originaly found with RunUO 1.0. Perhaps an older build?
 
Top