Adding Abilities to the FS animal taming system

ReApEr

Citizen
Jan 6, 2015
13
1
3
29
Hey guys and gals.
Now i'm not entirely sure what i'm doing wrong.
I've edited the PetLevelGump.cs to contain;

C#:
                    //Test HowlOfCacophony
        if ( bc.Level > 17 )
            {
                    AddLabel(60, 300, 1149, @"250 Ability Points Required per ability");
                
                    AddLabel(60, 400, 1149, @"Howl Of Cacophony");
                if ( bc.HasAbility(SpecialAbility.HowlOfCacophony))
                {
                    AddLabel(330, 400, 38, @"Learned");
                }
                else
                {
                    AddButton(24, 400, 4005, 4006, 18, GumpButtonType.Reply, 0);
                }
                    //End Test
and


C#:
                    //Test HowlOfCacophony
        if ( info.ButtonID == 18 )
            {
            if ( bc.HasAbility(SpecialAbility.HowlOfCacophony))  //Does it already have the ability?
                {
                    if ( bc.AbilityPoints != 0 )
                        from.SendGump( new PetLevelGump( bc ) );
                }
            }
            else if ( bc.AbilityPoints <= 249 ) //Send message 250 points are needed?
            {
                        from.SendMessage( "You need 250 points to give this skill" );
                        from.SendGump( new PetLevelGump( bc ) );
            }           
            else
            {
                    bc.AbilityPoints -= 250; //increase points needed to 250
                    
                    bc.SetSpecialAbility(SpecialAbility.HowlOfCacophony);
                    //End test
What i want it to do is when said pet reaches level 17 it adds a new field.
you can then spend 250 points to give the pet the OSI ability HowlOfCacophony.
it then sets the "learn" field and removes the button once your pet has the ability.


Now the strange part... It works..
but it takes like 10 seconds before it gives said pet the ability and changes the field to "learned"
 

Falkor

Squire
Apr 11, 2018
298
105
43
wpshard.com
Shard Name
Whispering Pines
From my understanding that's the next tick of the timer that re-asses the situation. I believe other scripts make the change immediate by using

Code:
InvalidateProperties();
immediately after the value is changed.

I could be wrong though -- I'm completely self-taught without having ever seen C# before getting into RunUO!
 

ReApEr

Citizen
Jan 6, 2015
13
1
3
29
Thank you!
This worked, also cleaned it up a little.
and fixed a few things with it. I'm still learning too!
Thanks again.