Skudklatten
Wanderer
Custom Animal Taming and Animal Lore gain
Not quite sure if this is the place to show these... I just started to script bout a week ago and just getting into how this works.
But after hours and hours of figuring out where and how to change the thing I wanted to do I finaly figured it out.
Hope there is some people out there who has it like me with animal taming. I hate doing it but love using it.. And the time it takes to gain in it is just not fun. And I really feel that it should be fun playing. So I changed it so when your pet fights you can gain in Animal Lore and Animal Taming. That way you can gain in those skills while having fun and get your veterany up and other skills at same time, instead of how it is normaly.. gaining taming first then all the others which I find stupid.
But here is what I changed.
Everything I changed is in BaseWeapon.cs (!!!!)
First I added the Animal Lore gain into the CheckHit method.
The stuff I added is between the //DrBroX comments
Next I added Animal Taming gains into the ScaleDamageAOS method.
again the stuff I added is between the //DrBroX comments.
There also was a ScaleDamageOld method where I did the same change.. but not sure if it is nessesary..
Hope this was usefull for some and yay for my first script (c;
But still not sure if what I did was the right way to do but I just tested it a bit myself and seemed to work ok (c;
So comments and suggestions are very welcome (c;
Not quite sure if this is the place to show these... I just started to script bout a week ago and just getting into how this works.
But after hours and hours of figuring out where and how to change the thing I wanted to do I finaly figured it out.
Hope there is some people out there who has it like me with animal taming. I hate doing it but love using it.. And the time it takes to gain in it is just not fun. And I really feel that it should be fun playing. So I changed it so when your pet fights you can gain in Animal Lore and Animal Taming. That way you can gain in those skills while having fun and get your veterany up and other skills at same time, instead of how it is normaly.. gaining taming first then all the others which I find stupid.
But here is what I changed.
Everything I changed is in BaseWeapon.cs (!!!!)
First I added the Animal Lore gain into the CheckHit method.
The stuff I added is between the //DrBroX comments
Code:
public virtual bool CheckHit( Mobile attacker, Mobile defender )
{
BaseWeapon atkWeapon = attacker.Weapon as BaseWeapon;
BaseWeapon defWeapon = defender.Weapon as BaseWeapon;
Skill atkSkill = attacker.Skills[atkWeapon.Skill];
Skill defSkill = defender.Skills[defWeapon.Skill];
double atkValue = atkWeapon.GetAttackSkillValue( attacker, defender );
double defValue = defWeapon.GetDefendSkillValue( attacker, defender );
//attacker.CheckSkill( atkSkill.SkillName, defValue - 20.0, 120.0 );
//defender.CheckSkill( defSkill.SkillName, atkValue - 20.0, 120.0 );
double ourValue, theirValue;
int bonus = GetHitChanceBonus();
if ( Core.AOS )
{
if ( atkValue <= -20.0 )
atkValue = -19.9;
if ( defValue <= -20.0 )
defValue = -19.9;
// Hit Chance Increase = 45%
int atkChance = AosAttributes.GetValue( attacker, AosAttribute.AttackChance );
if ( atkChance > 45 )
atkChance = 45;
bonus += atkChance;
if ( Spells.Chivalry.DivineFurySpell.UnderEffect( attacker ) )
bonus += 10; // attacker gets 10% bonus when they're under divine fury
if ( CheckAnimal( attacker, typeof( GreyWolf ) ) || CheckAnimal( attacker, typeof( BakeKitsune ) ) )
bonus += 20; // attacker gets 20% bonus when under Wolf or Bake Kitsune form
if ( HitLower.IsUnderAttackEffect( attacker ) )
bonus -= 25; // Under Hit Lower Attack effect -> 25% malus
ourValue = (atkValue + 20.0) * (100 + bonus);
// Defense Chance Increase = 45%
bonus = AosAttributes.GetValue( defender, AosAttribute.DefendChance );
if ( bonus > 45 )
bonus = 45;
if ( Spells.Chivalry.DivineFurySpell.UnderEffect( defender ) )
bonus -= 20; // defender loses 20% bonus when they're under divine fury
if ( HitLower.IsUnderDefenseEffect( defender ) )
bonus -= 25; // Under Hit Lower Defense effect -> 25% malus
int blockBonus = 0;
if ( Block.GetBonus( defender, ref blockBonus ) )
bonus += blockBonus;
int surpriseMalus = 0;
if ( SurpriseAttack.GetMalus( defender, ref surpriseMalus ) )
bonus -= surpriseMalus;
int discordanceEffect = 0;
// Defender loses -0/-28% if under the effect of Discordance.
if ( SkillHandlers.Discordance.GetEffect( attacker, ref discordanceEffect ) )
bonus -= discordanceEffect;
theirValue = (defValue + 20.0) * (100 + bonus);
bonus = 0;
}
else
{
if ( atkValue <= -50.0 )
atkValue = -49.9;
if ( defValue <= -50.0 )
defValue = -49.9;
ourValue = (atkValue + 50.0);
theirValue = (defValue + 50.0);
}
double chance = ourValue / (theirValue * 2.0);
chance *= 1.0 + ((double)bonus / 100);
if ( Core.AOS && chance < 0.02 )
chance = 0.02;
WeaponAbility ability = WeaponAbility.GetCurrentAbility( attacker );
if ( ability != null )
chance *= ability.AccuracyScalar;
SpecialMove move = SpecialMove.GetCurrentMove( attacker );
if ( move != null )
chance *= move.GetAccuracyScalar( attacker );
[COLOR="Red"]//DrBroX's Custom Animal taming Gain start
if (attacker is BaseCreature)
{
BaseCreature bc = (BaseCreature)attacker;
if (bc.Controlled == true && bc.ControlMaster != null && bc.Summoned == false)
bc.ControlMaster.CheckSkill(SkillName.AnimalLore, chance); // Passively check AnimalTaming for gain
}
//DrBroX's Custom Animal taming Gain stop[/COLOR]
return attacker.CheckSkill( atkSkill.SkillName, chance );
//return ( chance >= Utility.RandomDouble() );
}
Next I added Animal Taming gains into the ScaleDamageAOS method.
again the stuff I added is between the //DrBroX comments.
Code:
public virtual double ScaleDamageAOS( Mobile attacker, double damage, bool checkSkills )
{
if ( checkSkills )
{
attacker.CheckSkill( SkillName.Tactics, 0.0, 120.0 ); // Passively check tactics for gain
attacker.CheckSkill( SkillName.Anatomy, 0.0, 120.0 ); // Passively check Anatomy for gain
[COLOR="red"]//DrBroX's Custom Animal taming Gain start
if (attacker is BaseCreature)
{
BaseCreature bc = (BaseCreature)attacker;
if (bc.Controlled == true && bc.ControlMaster != null && bc.Summoned == false)
bc.ControlMaster.CheckSkill(SkillName.AnimalTaming, 0.0, 120.0); // Passively check AnimalTaming for gain
}
//DrBroX's Custom Animal taming Gain stop[/COLOR]
if ( Type == WeaponType.Axe )
attacker.CheckSkill( SkillName.Lumberjacking, 0.0, 100.0 ); // Passively check Lumberjacking for gain
}
There also was a ScaleDamageOld method where I did the same change.. but not sure if it is nessesary..
Hope this was usefull for some and yay for my first script (c;
But still not sure if what I did was the right way to do but I just tested it a bit myself and seemed to work ok (c;
So comments and suggestions are very welcome (c;