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!

Need help with mobile.cs

MrBurston

Traveler
ok so Im editing mobile.cs

reason being im adding a GetResistanceMod function for my equipment mods system.

ive had to change
public ResistanceMod( ResistanceType type, string name )

to

public ResistanceMod( ResistanceType type, string name, int offset, TimeSpan duration )

but this obviously has stuffed up any script with a resistance mod.

by default runUO only uses name, value.

My question is how to i make it so it will allow 2 arguments?
 

Arvoreen

Sorceror
Create another method with the old name
public ResistanceMod( ResistanceType type, string name )
and then have it call the method you changed that takes 4 parameters, sending defaults for the extra parameters.
 

haazen

Sorceror
Hope this makes sense.

public ResistanceMod( ResistanceType type, string name )
{
ResistanceMod( type, name, 0, 0 );
}

public ResistanceMod( ResistanceType type, string name, int offset, TimeSpan duration )
{
all the stuff to be done bla bla bla;
}

When a script calls ResistanceMod with just 2 args, type and name it hits the fist method and it calls the second and sends zeros for offset and duration. Instead of zeros you can set them to values that better suits your needs.
 

MrBurston

Traveler
Thanks haazen, that worked a treat!

only problem i have now is it wont add the resistance buff lol. I've added my mod for it as an upload (adds directly to the player).
 

Attachments

  • ResistanceModBonus.cs
    4.1 KB · Views: 1
Top