Working publish 57, thanks to Quasar :) , problem with finding the proper wording for a script. Anyone know the proper code expression for player mobiles, Max Resistance value. Trying to make an item ( which is consumed after use ), that changes the players Total max Resistance value permanently by +1.

I've tried: MaxResistBonus, MaxResistanceType.Energy, MaxResistance.Physical. Uggg wish I could do this at home, currently using my phone to try script out, not fun at all.
Post automatically merged:

So far I think is super close " mobile.GetMaxResistance(ResistanceType Physical) += 1; " but now I get

syntax error ',' expected error I get now. Feel like this is super close, errrr
 

Attachments

  • FireResistStone.cs
    1.4 KB · Views: 6
Last edited:
server error ' PlayerMobile ' does not contain definition for ' ResistanceType '

I'm just glad someone even tried to help :)

I won't give up, trying to learn coding while I work, but I've not had a day off in 71 days, at 10+ hours a day.

Appreciate the concern Zerodowned
 
PlayerMobile.ColdResistance, PlayerMobile.EnergyResistance, PlayerMobile.FireResistance, PlayerMobile.PoisonResistance, PlayerMobile.PhysicalResistance

Try those, since that is the field modified via props command.
 
Tried those awhile back, error states ' playermobile ' does not contain definition for ' PlayerMobile.EnergyResistance '

Very odd problem, i've been trying for weeks now, nothing I can come up with works. Your welcome to try and implement the tries yourself, I don't care about credit for anything. I just like to play a game :)
 
Only other oddity I can think of, is Resistances are considered read-only values, or at least, they can't be modified by someone with Administrator access.
 
There don't have any properties with MaxResistance, only methods to calculate them.
You can add new properties to your PlayerMobile class, e.g.:
public int FireResistBonus { get; set; }
+ don't forget add this property to serialize/deserialize methods to save your value.

after it you can find in PlayerMobile.cs next method:
public override int GetMaxResistance(ResistanceType type)
There you can see how calculating max value of all resistance types.
C#:
            int max = base.GetMaxResistance(type); // get default value of max resistance
             // add overcap mods
            #region SA
            max += Spells.Mystic.StoneFormSpell.GetMaxResistMod(this);
            #endregion
// add overcap mods
            max += BaseArmor.GetRefinedResist(this, type);

            if (type != ResistanceType.Physical && 60 < max && Spells.Fourth.CurseSpell.UnderEffect(this))
                max = 60;
// add overcap mods
            if (Core.ML && this.Race == Race.Elf && type == ResistanceType.Energy)
                max += 5; //Intended to go after the 60 max from curse
So now you can understand what you need to do, to add your custom values to these calculations. e.g.:

C#:
if(type == ResistanceType.Fire && FireResistBonus > 0)
max += FireResistBonus;

So you can now finish your FireStone script, where need just use new property in OnDoubleClick method:
C#:
PlayerMobile pm = from as PlayerMobile;
pm.FireResistBonus += 1;
 
That is amazing, and will take me some time to understand, so I can write the code without help. When i get sometime tomorrow, I'll write back, but 14+ hours days are kicking my energy. Seriously, your effort is really Appreciated. :)
 
Back