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!

[RunUO 2.0 RC1] Levelable Items System 3.0

dracana

Sorceror
Dreadfull said:
how do the weapons gain exp? I killed a few mobs with my gm testing it out and no exp was gained to the items.

Did you make this change to BaseCreature.cs as noted in first post...

2. Now that you have created levelable items, you need to make the following changes to BaseCreature.cs to let these items gain experience...

Open up your basecreature.cs and find the following in the OnDamage method

Code:
   if ( speechType != null && !willKill )
    speechType.OnDamage( this, amount );

Add this immediately after...

Code:
   [B]if ( !Summoned && willKill )
    LevelItemManager.CheckItems( from, this );[/B]
 

dracana

Sorceror
Tech102 said:
Not 100% how to go about to add these to monster drops like paragon monsters and such

Different ways you can do this, depending on if you want only certain mobs to drop or all, etc.

While probably not likely, if you only want one mobile to drop one or more levelable items, you would add something like...
Code:
			public override bool OnBeforeDeath()
			{
				switch ( Utility.Random( 20 ) )
				{
					case 0: PackItem( new LevelKryss() ); break;
					case 1: PackItem( new LevelScimitar()  ); break;
				}

				return base.OnBeforeDeath();

			}

This would give something along the lines of a 1 in 20 chance that the mobile drops either a levelable kryss or scimitar. Once again, this is probably not the way you want to go as it is not very realistic (since you probably have 50+ levelable items and you want to have more than one mobile drop them :) )

A better way to handle the drops for a few mobiles would be to create a new class that handles drops of levelables. See my attached script LevelableItems.cs.

To use something along these lines,

  • edit LevelableItems.cs to include all levelable items that you want to have a chance to drop. Save LevelableItems.cs to your RunUO Scripts\Custom directory.
  • Add the following code to each mobile that you would like to drop levelable items...
    Code:
    			public override bool OnBeforeDeath()
    			{
    				switch ( Utility.Random( 20 ) )
    				{
    					case 0: PackItem( LevelableItems.CreateRandomLevelable() ); break;
    				}
    
    				return base.OnBeforeDeath();
    
    			}
  • Save each mobile script and restart server

Now both methods above are only if you want to drop levelables on a handful of mobiles. If you want all mobiles (or a large number of mobiles) to have a chance to drop levelable items, then you will need to modify the distro scripts Loot.cs and LootPack.cs. The discussion on doing this can be found in quite a few threads. I recommend searching the forums if this is the way you want to go.

Hope this helps!! If you have any questions, please let me know.
 

Attachments

  • LevelableItems.cs
    1.6 KB · Views: 173

CosmoSpira

Sorceror
maybe you could modify the paragon scripts so theres a chance that the levelable items will drop in the paragon chests? just a suggestion as i am not a scripter:rolleyes:
 

Dreadfull

Sorceror
yeah that would work nicely. use the windows search on your scripts folder for paragon and then do the edits as needed.
 
D

DragonDan

Guest
Enhancing???

I know I would have to alter the enhance.cs script but not quite sure what to add or alter can some one help me out there? Thanks in advance for your help and for such a nice system it has enriched gameplay on my shard! :)
 

garthro

Wanderer
can it be done

i want 2 make everything on my shard levable even the armor u buy from the vendors it just lvls up you can add attributes as it lvls up thanks for all ur help
 

dracana

Sorceror
I am sure you can take the code from my BaseLevelxxx scripts and incorporate it into the corresponding Basexxx distro script (I.e from BaseLevelAxe.cs to BaseAxe.cs, BaseLevelShield to BaseShield.cs, etc.). I have not done this or tested it and it may take a bit of work, but it should work.
 
How do i Add Max Level Increase Deeds

Could i ask, how to add Max Level Increase Deeds so i can add them to a Vendor Stone to sell. i cannot for the life of me figure it out. i have looked up the LevelUpScroll.cs script as well but ( LevelUpScroll ) wont add them either. Any pointers on this one i could get from somebody would be greatly appreciated.!!
Thanks Again
Soultaker
 

dracana

Sorceror
partystuffcloseouts;633983 said:
Could i ask, how to add Max Level Increase Deeds so i can add them to a Vendor Stone to sell. i cannot for the life of me figure it out. i have looked up the LevelUpScroll.cs script as well but ( LevelUpScroll ) wont add them either. Any pointers on this one i could get from somebody would be greatly appreciated.!!
Thanks Again
Soultaker

Here is an updated version of LevelUpScroll.cs that should help you. Basically the way to do it is create new items for each of the levels of LevelUpScroll. This new script will do that, I added WonderousLevelUpScroll, ExaltedLevelUpScroll, MythicalLevelUpScroll, and LegendaryLevelUpScroll items. You can now add these to vendor stones using the item names above.

To install, simply overwrite the old LevelUpScroll.cs under Levelable Items\Items, with this new script. Then restart shard.

If you have any questions, please let me know.

Dracana
 

Attachments

  • LevelUpScroll.cs
    8.6 KB · Views: 115

Emillio

Sorceror
making weapons for 1.0

hi,

my shard is on 1.0 and im a little new at the scripting stuff. I tried to make a levelable bow, but im running into this error:

RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Customs\Levelable Items\Items\Levelbow.cs: CS0246: (line 12, c
olumn 26) The type or namespace name 'bow' could not be found (are you missing a
using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.


this is my bow
Code:
using System;
using System.Text;
using Server;
using Server.Mobiles;
using Server.ContextMenus;
using System.Collections;
using Server.Gumps;

namespace Server.Items
{
	[FlipableAttribute( 0x13B2, 0x13B1 )]
	public class Levelbow : bow, ILevelable // ILevelable is the interface that gives us all the leveling functionality
	{
		/* These private variables store the exp, level, and *
		 * points for the item */
		private int m_Experience;
		private int m_Level;
		private int m_Points;

		[Constructable]
		public Levelbow() : base()
		{
			/* Invalidate the level and refresh the item props
			 * Extremely important to call this method */
			LevelItemManager.InvalidateLevel( this );
		}

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

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

			writer.Write( (int) 0 );

			// DONT FORGET TO SERIALIZE LEVEL, EXPERIENCE, AND POINTS
			writer.Write( m_Experience );
			writer.Write( m_Level );
			writer.Write( m_Points );
		}

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

			int version = reader.ReadInt();

			// DONT FORGET TO DESERIALIZE LEVEL, EXPERIENCE, AND POINTS
			m_Experience = reader.ReadInt();
			m_Level = reader.ReadInt();
			m_Points = reader.ReadInt();
		}

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

			/* Display level in the properties context menu.
			 * Will display experience as well, if DisplayExpProp.
			 * is set to true in LevelItemManager.cs */
			list.Add( 1060658, "Level\t{0}", m_Level );
			if ( LevelItemManager.DisplayExpProp )
				list.Add( 1060659, "Experience\t{0}", m_Experience );
		}

		public override void GetContextMenuEntries(Mobile from, ArrayList list)
		{
			base.GetContextMenuEntries (from, list);

			/* Context Menu Entry to display the gump w/
			 * all info */

			list.Add( new LevelInfoEntry( from, this, AttributeCategory.Melee ) );
		}

		// ILevelable Members that MUST be implemented
		#region ILevelable Members

		// This one will return our private m_Experience variable.
		[CommandProperty( AccessLevel.GameMaster )]
		public int Experience
		{
			get
			{
				return m_Experience;
			}
			set
			{
				m_Experience = value;

				// This keeps gms from setting the level to an outrageous value
				if ( m_Experience > LevelItemManager.ExpTable[LevelItemManager.Levels - 1] )
					m_Experience = LevelItemManager.ExpTable[LevelItemManager.Levels - 1];

				// Anytime exp is changed, call this method
				LevelItemManager.InvalidateLevel( this );
			}
		}

		// This one will return our private m_Level variable.
		[CommandProperty( AccessLevel.GameMaster )]
		public int Level
		{
			get
			{
				return m_Level;
			}
			set
			{
				// This keeps gms from setting the level to an outrageous value
				if ( value > LevelItemManager.Levels )
					value = LevelItemManager.Levels;

				// This keeps gms from setting the level to 0 or a negative value
				if ( value < 1 )
					value = 1;

				// Sets new level.
				if ( m_Level != value )
				{
					m_Level = value;
				}
			}
		}

		// This one will return our private m_Points variable.
		[CommandProperty( AccessLevel.GameMaster )]
		public int Points
		{
			get
			{
				return m_Points;
			}
			set
			{
				//Sets new points.
				m_Points = value;
			}
		}
		#endregion
	}
}


im very new at this so bear with me. Could you give us newer scripters a short little explanation on how to convert the items? thanks again for this script. It's incredible. I plan on using it on my shard.

ps - i changed the one reference of melee up there with ranged. I also tried to change bow for baseranged but it didnt find that either.
 

dracana

Sorceror
Emillio;644787 said:
hi,

my shard is on 1.0 and im a little new at the scripting stuff. I tried to make a levelable bow, but im running into this error:

RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Customs\Levelable Items\Items\Levelbow.cs: CS0246: (line 12, c
olumn 26) The type or namespace name 'bow' could not be found (are you missing a
using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.


this is my bow
Code:
using System;
using System.Text;
using Server;
using Server.Mobiles;
using Server.ContextMenus;
using System.Collections;
using Server.Gumps;

namespace Server.Items
{
	[FlipableAttribute( 0x13B2, 0x13B1 )]
	public class Levelbow : bow, ILevelable // ILevelable is the interface that gives us all the leveling functionality
	{
		/* These private variables store the exp, level, and *
		 * points for the item */
		private int m_Experience;
		private int m_Level;
		private int m_Points;

		[Constructable]
		public Levelbow() : base()
		{
			/* Invalidate the level and refresh the item props
			 * Extremely important to call this method */
			LevelItemManager.InvalidateLevel( this );
		}

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

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

			writer.Write( (int) 0 );

			// DONT FORGET TO SERIALIZE LEVEL, EXPERIENCE, AND POINTS
			writer.Write( m_Experience );
			writer.Write( m_Level );
			writer.Write( m_Points );
		}

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

			int version = reader.ReadInt();

			// DONT FORGET TO DESERIALIZE LEVEL, EXPERIENCE, AND POINTS
			m_Experience = reader.ReadInt();
			m_Level = reader.ReadInt();
			m_Points = reader.ReadInt();
		}

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

			/* Display level in the properties context menu.
			 * Will display experience as well, if DisplayExpProp.
			 * is set to true in LevelItemManager.cs */
			list.Add( 1060658, "Level\t{0}", m_Level );
			if ( LevelItemManager.DisplayExpProp )
				list.Add( 1060659, "Experience\t{0}", m_Experience );
		}

		public override void GetContextMenuEntries(Mobile from, ArrayList list)
		{
			base.GetContextMenuEntries (from, list);

			/* Context Menu Entry to display the gump w/
			 * all info */

			list.Add( new LevelInfoEntry( from, this, AttributeCategory.Melee ) );
		}

		// ILevelable Members that MUST be implemented
		#region ILevelable Members

		// This one will return our private m_Experience variable.
		[CommandProperty( AccessLevel.GameMaster )]
		public int Experience
		{
			get
			{
				return m_Experience;
			}
			set
			{
				m_Experience = value;

				// This keeps gms from setting the level to an outrageous value
				if ( m_Experience > LevelItemManager.ExpTable[LevelItemManager.Levels - 1] )
					m_Experience = LevelItemManager.ExpTable[LevelItemManager.Levels - 1];

				// Anytime exp is changed, call this method
				LevelItemManager.InvalidateLevel( this );
			}
		}

		// This one will return our private m_Level variable.
		[CommandProperty( AccessLevel.GameMaster )]
		public int Level
		{
			get
			{
				return m_Level;
			}
			set
			{
				// This keeps gms from setting the level to an outrageous value
				if ( value > LevelItemManager.Levels )
					value = LevelItemManager.Levels;

				// This keeps gms from setting the level to 0 or a negative value
				if ( value < 1 )
					value = 1;

				// Sets new level.
				if ( m_Level != value )
				{
					m_Level = value;
				}
			}
		}

		// This one will return our private m_Points variable.
		[CommandProperty( AccessLevel.GameMaster )]
		public int Points
		{
			get
			{
				return m_Points;
			}
			set
			{
				//Sets new points.
				m_Points = value;
			}
		}
		#endregion
	}
}


im very new at this so bear with me. Could you give us newer scripters a short little explanation on how to convert the items? thanks again for this script. It's incredible. I plan on using it on my shard.

ps - i changed the one reference of melee up there with ranged. I also tried to change bow for baseranged but it didnt find that either.

Emillio,

This error can be fixed by changing bow to Bow in the following line (line 12)...

Code:
	public class Levelbow : [B]bow[/B], ILevelable // ILevelable is the interface that gives us all the leveling functionality

That is a reference to the items subclass and it must match the case of the class you are referring to (Bow as found in Bow.cs)

If you have any other issues, let me know.
 

Emillio

Sorceror
worked

wow that worked. So make sure you use the shift button on important words! :) thank you! You are wonderful.
 

EGYPT

Wanderer
public abstract class BaseLevelSword:BaseSword,ILevelable

in base sword tried changing it to all items levelable fixed all erros except here
tells me basesword couldnt be found so i changed it to BaselevelSword
gives me an error saying circular base class dependency involving server items to baselelevel sword and server items.baselevel sword so i am lost could ya help me?
 
everything works perfectly only one problem

the anceint smithy

hard as heck but i like that. only when he dies client crashes. server don't just hte client. also it wont let that char log back in either!

i was able to create a NEW char log in go to that spot and pick up the scrolls but what could be causing that char to ot be able to log in? could it be cause EVERYTHING he is wearing is levelable? every slot is full of levelable items all level 1

LMMFAO ok i figured out why it crashed. i forgot i deleted my char's backpack and when i killed the smithy it tried to put 2 scrolls into my pack which wasnt there lol
 

glyth

Wanderer
Code:
Errors:
 + custum/level/Items/Armor/Artifacts/LevelInquisitorsResolution.cs:
    CS0246: Line 6: The type or namespace name 'LevelPlateGloves' could not be f
ound (are you missing a using directive or an assembly reference?)
 + custum/level/Items/Jewels/Artifacts/LevelBraceletOfHealth.cs:
    CS0246: Line 6: The type or namespace name 'LevelGoldBracelet' could not be
found (are you missing a using directive or an assembly reference?)
 + custum/level/Items/Shields/Artifacts/LevelAegis.cs:
    CS0246: Line 6: The type or namespace name 'LevelHeaterShield' could not be
found (are you missing a using directive or an assembly reference?)

wat i do wrong:/
 

EGYPT

Wanderer
just remove the artifacts cause they cant find scripts for level heater etc.. so either download the all levelable items package and u should be ok or just remove these ones
 
Top