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!

How to modify Resistance cap

Loyd123

Wanderer
How to modify Resistance cap without playing in the core

Server default resistance for a player character is 70, here's how to change it.


Open your Playermobile.cs
path = ....\Scripts\Mobiles\Playermobiles.cs

CTRL+F and search the following word : Elf


This should take you around these lines


public override int GetMaxResistance( ResistanceType type )
{
if ( AccessLevel > AccessLevel.Player )
return int.MaxValue;

int max = base.GetMaxResistance( type );

if ( type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) )
max = 60;

if( Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy ) <=== This check the Elf race and state the Energy Resistance
max += 5; <==== Add 5 resistance cap to the default 70 resistance cap, wich would bring an elf to 75 max resistance for Energy.

return max;


To change resistance cap, for regular players (assuming they are human) change the part where it says Race.Elf to Race.Human and where it says max+= 5; put whatever you want to add to the current 70 cap. Here's an exemple i made for my server



public override int GetMaxResistance( ResistanceType type )
{
if ( AccessLevel > AccessLevel.Player )
return int.MaxValue;

int max = base.GetMaxResistance( type );

if ( type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect( this ) )
max = 60;

if( Core.ML && this.Race == Race.Human && type == ResistanceType.Energy )
max += 10; //Intended to go after the 60 max from curse

if( Core.ML && this.Race == Race.Human && type == ResistanceType.Fire )
max += 10; //Intended to go after the 60 max from curse

if( Core.ML && this.Race == Race.Human && type == ResistanceType.Cold )
max += 10; //Intended to go after the 60 max from curse

if( Core.ML && this.Race == Race.Human && type == ResistanceType.Poison )
max += 10; //Intended to go after the 60 max from curse

if( Core.ML && this.Race == Race.Human && type == ResistanceType.Physical )
max += 10; //Intended to go after the 60 max from curse


return max;
}


I searched and have'nt found anyone that explain how to change max resistance cap without complication and going into the core n stuff, so here it is.



Tadah, no need to modify the core ;)!



Edit : Also if you want to reduce the resistance cap i suppose you could use the value 10 and write max-= insteand.

You might aslo want to edit the curse spell if you still want to drop all resists to 60, since the script add +10 to max, and curse spell put the max at 60 it does 60 +10, in my case i modifyed the curse spell max resist at 50 so my 50+10 gives me the default value for the curse spell reduction.



Please post if it helped you :)!
 
Top