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

dracana

Sorceror
[RunUO 2.0 RC1] Levelable Items

Levelable Items (for RunUO 2.0 rc1)
Current Version: 2.0


This is a RunUO 2.0 (rc1) compatible update to the Levelable items system.

***** Disclaimer *****
This system was written and intended for AOS/SE enabled shards, as it is based on AOS Attributes. It will not break a pre-AOS shard, but the attributes will have no effect!!
*******************


Here are the features...
This system allows you to create levelable weapons, armor, clothing, and jewelry. Upon killing creatures, the levelable items will gain experience. Once experience reaches certain points, the item will gain a level. Upon gaining levels, the item will receive "spending points". These points can be used to purchase attribute enhancements to the item via use of a gump.

Here is what is included...
  • Leveling system (based off of OutkastDev's Levelable Items system) - This is the core to the system and how your items will gain experience when a creature is killed.
  • Item Experience Gump - This gump allows the players to view the items experience, experience to next level, spending points available, and attributes on the item. It is also where they can spend the available spending points! Here is an image of the interface...


  • Item Experience Command - Players can single click a levelable item and click on information context menu to bring up the Item Experience Gump. Alternatively, players can use the commands [itemexp or [ixp to bring up the gump.

Here are the main differences between this system and OutkastDev's...
  • Items gain experience by fighting any monsters.
  • The experience at which an item levels is based on a calculation, rather than hardcoded numbers. this allows you to easily change the number of levels available by changing one line of code.
  • Spending points added to allow players to pick their own attributes.
  • Context menu removed and gump/command added as the interface.

To install
Download the attached file and unrar it to your customs directory. Now you are ready to setup your items.

1. I have included a few examples, a normal kryss, a normal bracelet, a normal cloak, and two artifacts (Aegis and Inquisitors Resolution). These are commented and will get you started on creating your own levelable versions of items.
*NOTE* You could also always modify baseweapon.cs, basearmor.cs, etc to have all items levelable, but this has not been tested and I will not support issues if you decide to do it this way!

*1.2. New for RunUO 2.0: If you have custom items already created from my RunUO 1.0 version, they can still be used with the following two modifications…

A. Add this line to the top of script…
Code:
 using System.Collections.Generic;
then, look for the following…
Code:
 public override void GetContextMenuEntries(Mobile from, ArrayList list)
and replace it with…
Code:
 public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)

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]

3. Now you can modify the definable parameters of the leveling system. To do this,
* Open LevelableItems\New\LevelItemManager.cs and modify the following code to your preference...
Code:
	public const int Levels = 100; //Number of levels items can go up to.
        public const int PointsPerLevel = 5; //How many spending points an item gets per level.
        public const bool EnableExpCap = true; //true = Cap experience per level.  false = no cap.
        public const bool DisplayExpProp = false; //true = Display experience on item onmouseover/click.

Description of parameters...
Levels & PointsPerLevel
At 100 levels and 5 points gained each level (with 5 extra points every 10th level), that gives players 550 points to spend on attributes. You can create an item like the following...


If you want uber weapons or if you think this is too much already, you will need to either increase/decrease Levels or increase/decrease PointsPerLevel to meet your needs.

EnableExpCap
If set to true, their will be a cap of how many experience points an item can gain per creature/per item level. As the levels increase, this cap increases. If false, there is no cap. For example, if an item is level 2 and a player kills a Titan. With EnableExpCap set to true, the item will be capped at around 40 points of experience. If false, the item will gain more like 50-60 points.

DisplayExpProp
If set to true, the total experience points will show OnMouseOver for the item. If false, only the level will show.​
4. Modify the definable property in the gump. To do this,
* Open LevelableItems\Gumps\ItemExperienceGump.cs and modify the following code to your preference...
Code:
        public const bool DoubleArtifactCost = true; //true = Artifact attributes will cost double points.

Description of parameter...
DoubleArtifactCost
If set to true, Artifacts will cost double the spending points for each attribute. If false, artifacts attributes will cost the same as non-artifacts. In my opinion, this create VERY unbalanced items if set to false!​
5. Modify Attribute parameters. To do this,
* Open LevelableItems\New\LevelAttributes.cs and modify each of the attribute parameters to your preference...
You want to modify the lines like

Code:
	new AttributeInfo( AosAttribute.RegenHits, "Regen Hits", AttributeCategory.Stats, 2, 4 ),

Your options are...
  • Delete an entire line to remove the ability to increase the given attribute.
  • Modify the "Cost" of increasing an attribute (the second to last number).
  • Modify the max value to the given attribute (last number).

6. Now, restart your server and you are ready to go.​

Obviously you will need a way to distribute the levelable items as well (i.e., loot, token stone, rewards, etc), but I will leave that up to you :)

Warning
If you use Daat99's OWLTR, you will need to make one change to BaseArmor.cs to fix an issue with Armor resistances. Please read the following post for instructions...
http://www.runuo.com/forums/showthread.php?p=496234#post496234

Credit:
******************
OutkastDev - For the original Levelable Items script and for the Race/Class system, which I used for the calculation of points to each level.
tindin156 - For his contribution of allowing Clothing items to be levelable and the context menu addition.
******************

Feel free to post any bugs or critical feedback

Thanks and hope you enjoy!
 

Attachments

  • [2.0]Levelable Items 2.0.rar
    15.6 KB · Views: 383
Crashing Error LevelControlStone

i am having an error the following
it crashes as soon as i double click on ( LevelControlStone )


Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Gumps.LevelControlStoneGump..ctor()
at Server.LevelSystem.LevelControlStone.OnDoubleClick(Mobile from)
at Server.Mobile.Use(Item item)
at Server.Network.PacketHandlers.UseReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
 

dracana

Sorceror
partystuffcloseouts said:
i am having an error the following
it crashes as soon as i double click on ( LevelControlStone )


Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.Gumps.LevelControlStoneGump..ctor()
at Server.LevelSystem.LevelControlStone.OnDoubleClick(Mobile from)
at Server.Mobile.Use(Item item)
at Server.Network.PacketHandlers.UseReq(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)

Hrmm, not exactly sure what LevelControlStone is?? This was not in my scripts, was it something that you scripted or got from somewhere else? Can you post the code to LevelControlStone?
 
Top