Pet damage cap for PvP. Needing help with AOS.cs

So I've tried rewriting some coding I found here on the forums for pet damage cap and I feel that I'm close to getting it to successfully compile for runuo. I'm only getting 1 error and stumped on how to resolve it. If someone would be so kind to help me out, it would be much appreciated :)

C#:
        public static int Damage( OnDamage, Mobile m, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy )
         {
error ------> if (OnDamage is PlayerMobile && from is BaseCreature && ((BaseCreature)from).Controlled)
            {
                damage = Math.Min(damage, 40); // Pet Dmg Cap to players
                phys = Math.Min(phys, 40); // Pet phys Cap to players
                fire = Math.Min(fire, 40); // Pet fire Cap to players
                cold = Math.Min(cold, 40); // Pet cold Cap to players
                pois = Math.Min(pois, 40); // Pet pois Cap to players
            }
        }

Thanks
 

Attachments

  • error.png
    error.png
    60.2 KB · Views: 6

PyrO

Moderator
Actually the error line is not the one marked. Your
Code:
... int Damage( OnDamage, ...
causes the issue. because OnDamage has no parameter type
 
So remove OnDamage from the first line and do I keep the second one in place?

The guy I found this from had IDamageable and it said that wasn't correct phrasing :/
 

PyrO

Moderator
Befor it was IDamagable it was Mobile, since you want the mobile to check, and you apparently use an older version just add Mobile infront
 
like this?
C#:
    if (Mobile Idamageable is PlayerMobile && from is BaseCreature && ((BaseCreature)from).Controlled)
Post automatically merged:

still getting an error on that line :/
 

Attachments

  • error 2.png
    error 2.png
    5 KB · Views: 3

PyrO

Moderator
I ment this
Code:
public static int Damage( OnDamage, Mobile m, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy )

This should be changed to
Code:
public static int Damage( Mobile OnDamage, Mobile m, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy )

since you said it didnt want IDamagable
 
ok i tried that aswell and still no luck. but i did get a new error :D
Post automatically merged:

Idk what to do.. Everytime I make an adjustment, I just get another error :(
 

Attachments

  • error 3.png
    error 3.png
    38.5 KB · Views: 9
Last edited:
So Damage instead of OnDamage..? I'm so confused
Post automatically merged:

Oh I get what you mean, Damage is capitalized on line 59
Post automatically merged:

still nothing
 
Last edited:
Even tried capitalizing Damage where the arrow is down below. Still getting an error unfortunately

C#:
        public static int Damage( Mobile OnDamage, Mobile m, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy )
         {
            if (OnDamage is PlayerMobile && from is BaseCreature && ((BaseCreature)from).Controlled)
            {
    ------>     Damage = Math.Min(Damage, 40); // Pet Dmg Cap to players
                Phys = Math.Min(Phys, 40); // Pet phys Cap to players
                Fire = Math.Min(Fire, 40); // Pet fire Cap to players
                Cold = Math.Min(Cold, 40); // Pet cold Cap to players
                Pois = Math.Min(Pois, 40); // Pet pois Cap to players
            }
        }