Announcement

Collapse
No announcement yet.

Pet stat increse

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pet stat increse

    I'm trying to make a scroll/deed that increses the max hitpoints of a pet.
    It works when i increse the stats like str, int and dex but when i try increseing hits i get this message.
    Anyone know what im doing wrong?


    HTML Code:
    using System;
    using Server.Network;
    using Server.Prompts;
    using Server.Items;
    using System.Collections;
    using Server.Gumps;
    using Server.Targeting;
    using Server.Misc;
    using Server.Accounting;
    using System.Xml;
    using Server.Mobiles;
    
    namespace Server.Items
    {
    public class PetHitScroll : Item
    {
    [Constructable]
    public PetHitScroll() : base( 0x14F0 )
    {
    base.Weight = 1.0;
    base.Name = "a Minor Companion Health Scroll";
    base.Hue = 0x481;
    LootType = LootType.Cursed;
    }
    
    public override void OnDoubleClick( Mobile from )
    {
    if ( IsChildOf( from.Backpack ) )
    {
    from.Target = new HitTarget(from, this);
    }
    else
    {
    from.SendMessage("That must be in your backpack for you to use it.");
    }
    }
    
    public PetHitScroll( Serial serial ) : base( serial )
    {
    }
    
    public override void Serialize( GenericWriter writer )
    {
    base.Serialize( writer );
    
    writer.Write( (int) 0 ); // version
    }
    
    public override void Deserialize( GenericReader reader )
    {
    base.Deserialize( reader );
    
    int version = reader.ReadInt();
    }
    
    }
    
    public class HitTarget : Target
    {
    private Mobile m_From;
    private PetHitScroll m_Deed;
    
    public HitTarget( Mobile from, PetHitScroll deed ) : base ( 3, false, TargetFlags.None )
    {
    m_Deed = deed;
    m_From = from;
    from.SendMessage("Select the companion you want to make healthier.");
    
    }
    
    protected override void OnTarget( Mobile from, object targeted )
    {
    
    if (m_Deed.IsChildOf( m_From.Backpack ) )
    {
    if ( targeted is Mobile )
    {
    if ( targeted is BaseCreature )
    {
    BaseCreature creature = (BaseCreature)targeted;
    if( !creature.Tamable ){
    from.SendMessage("This animal is not tame.");
    }
    else if( !creature.Controlled || creature.ControlMaster != from ){
    from.SendMessage("This is not you animal.");
    }
    else if( creature.IsDeadPet ){
    from.SendMessage("This animal is dead.");
    }
    else if( creature.Summoned ){
    from.SendMessage("You can not make a summoned creature healthier.");
    }
    else if( creature.Body.IsHuman ){
    from.SendMessage("You can not make a human healthier.");
    }
    else if( creature.IsBonded == false ){
    from.SendMessage("You need to bond with your companion to use that.");
    }
    else if( from.Skills[SkillName.AnimalLore].Base < creature.MinTameSkill ){
    from.SendMessage("You do not know enough about your companion to make it healthier.");
    }
    else if( creature.m_HitsMax >= 100 ){
    from.SendMessage("Your companion can not become any healthier.");
    }
    else
    creature.m_HitsMax += 10;
    from.SendMessage("You companion seems healthier.");
    m_Deed.Delete();
    
    
    }
    }
    }
    }
    }
    }

  • #2
    I found the answer myself.

    Insted of using m_HitsMax i needed to use HitsMaxSeed.

    As for mana and stam it increses when you raise dex and int.

    Comment

    Working...
    X