Full Version : Cusidhe Healing Problem
xmlspawner >>Scripting Support >>Cusidhe Healing Problem
<< Prev | Next >>
Erica- 03-05-2007
Ok see the cusidhe script

CODE
using Server; using Server.Items; using Server.Mobiles; using Server.Targeting; using System.Collections;
namespace Server.Mobiles
{
[CorpseName( "a Cu Sidhe corpse" )]
public class ACuSidhe : BaseMount
{
private DateTime m_Delay = DateTime.Now;
public override WeaponAbility GetWeaponAbility()
{
return WeaponAbility.BleedAttack;
}
public override int GetDeathSound()
{
return 0x575;
}
public override int GetAttackSound()
{
return 0x576;
}
public override int GetIdleSound()
{
return 0x577;
}
public override int GetAngerSound()
{
return 0x578;
}
public override int GetHurtSound()
{
return 0x579;
}
public override bool StatLossAfterTame{ get{ return true; } }
[Constructable]
public ACuSidhe() : this( "a Cu Sidhe" )
{
}
[Constructable]
public ACuSidhe( string name ) : base( name, 277, 0x3e91, AIType.AI_Animal, FightMode.Evil, 10, 1, 0.2, 0.4 )
{
//BaseSoundID = 0xE5;
Hue = Utility.RandomList( 0x0, 0x973, 0x966, 0x96D, 0x972, 0x8A5, 0x979, 0x89F, 0x8AB, 0x489, 1151, 1175 );
SetStr( 1200, 1225 );
SetDex( 150, 170 );// stratics has 150,170 but this is amount after taming so setting this to Hiryu Dex
SetInt( 450, 500 );
SetHits( 1010, 1170 );
//SetMana( 60, 65 );//from Hiryu
//SetStam( 170, 270 );//from hiryu
SetDamage( 21, 28 );//hiryu damage
SetDamageType( ResistanceType.Physical, 0 );
SetDamageType( ResistanceType.Cold, 50 );
SetDamageType( ResistanceType.Energy, 50 );
SetResistance( ResistanceType.Physical, 50, 65 );//used 5 over and 5 under what stratics posted
SetResistance( ResistanceType.Fire, 30, 45 );
SetResistance( ResistanceType.Cold, 70, 85 );
SetResistance( ResistanceType.Poison, 30, 50 );
SetResistance( ResistanceType.Energy, 70, 85 );
SetSkill( SkillName.Healing, 77.7, 99.9 );
SetSkill( SkillName.Anatomy, 77.7, 99.9 );
SetSkill( SkillName.MagicResist, 76.0, 89.7 );
SetSkill( SkillName.Tactics, 94.0, 97.6 );
SetSkill( SkillName.Wrestling, 93.9, 99.9 );
//SetFameLevel( 5 );
//SetKarmaLevel( 5 );
VirtualArmor = 75;
Fame = 5;
Karma = -5;
Tamable = true;
ControlSlots = 4;//assuming these take same ammount of slots as a Hiryu
MinTameSkill = 101.1;
PackGold( 750, 950 );//1500 1900 is the gold amount found on these
PackMagicItems( 1, 5 );
PackItem( new Bandage( 20 ) );// a total guess on the amount
}
public override void OnThink() // TODO: Please make sure, if you got Bloody bandages, that CuSidhe can NOT get them.
{
if ( DateTime.Now > m_Delay )
{
Bandage band;
if ( Controlled && ControlMaster != null )
{
IPooledEnumerable eable = Map.GetMobilesInRange( Location, 1 );
foreach ( Mobile m in eable )
{
if ( m == ControlMaster && m.Alive && m.Hits < m.HitsMax )
{
band = new Bandage();
PackItem( band );
band.OnDoubleClick( this );
if ( Target != null )
{
Target.Invoke( this, m );
DebugSay( "I heal Master." );
m_Delay = DateTime.Now + TimeSpan.FromSeconds( 7 );
}
break;
}
}
eable.Free();
}
else if ( Hits < HitsMax )
{
band = new Bandage();
PackItem( band );
band.OnDoubleClick( this );
if ( Target != null )
{
Target.Invoke( this, this );
DebugSay( "I start heal!" );
m_Delay = DateTime.Now + TimeSpan.FromSeconds( 7 );
}
}
}
base.OnThink();
}
public override void OnDoubleClick( Mobile from )
{
if ( /*from.IsElf ||*/ from.FindItemOnLayer( Layer.Shoes ) is PadsOfTheCuSidhe || from.AccessLevel > AccessLevel.Player ) // TODO: Elves check;)
{
base.OnDoubleClick( from );
}
else
from.SendMessage( "Only Elves may ride this" );
}
public override void GenerateLoot()
{
AddLoot( LootPack.Rich );// to add a couple more magic items and the additional gold to make the 1500 mark
}
/*public override int GetAngerSound()
{
if ( !Controlled )
return 0x16A;
return base.GetAngerSound();
}*/
public override double GetControlChance( Mobile m, bool useBaseSkill )
{
if ( m.Skills[SkillName.AnimalTaming].Base < 93.0 )
{
m.SendMessage( "You would not be able to control this creature." );
return 0;
}
else
{
return 1.0;
}
}
public override int Meat{ get{ return 3; } }
public override int Hides{ get{ return 10; } }
public override FoodType FavoriteFood { get { return FoodType.FruitsAndVegies | FoodType.GrainsAndHay; } }
public override int TreasureMapLevel { get { return 5; } }
public ACuSidhe( 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();
/*if ( BaseSoundID == 0x16A )
BaseSoundID = 0xA8;*/
}
}
}

Now im not sure what might be wrong here but will tell you what he should do ok on osi i got one of theses crearures bonded now when i go take it to fight ogre lords on osi i bandage him but he also does it to himself he does bandage to him self like 95% of the time and does heal the owner player on osi no magic heal bandage way ive got on my shard runuo 2.0 and ive done the samething make him fight orge lords but he doesnt bandage him self like the way i describe on top like osi not sure where to fix this and what to change so he can bandage himself and bandage his master if you see any problems here please help me out to get it to work almost like osi thanks.
ArteGordon- 03-05-2007
the issue is here in your OnThink

CODE
else if ( Hits < HitsMax )

what that means is that the Hits check will only occur if the earlier check

CODE
if ( Controlled && ControlMaster != null )

fails. Which means it will only heal itself if it is no longer controlled.
To change it so that it will heal both the master and itself, just take out the 'else'

CODE
if ( Hits < HitsMax )

Erica- 03-05-2007
hmm its not bandaging itself i tell it to attack and ogre lord he gets hit heatlth goes little by little down and doesnt bandage self on osi without the player fighting just telling it to all kill any monsters he gets hit health goes down little by little but he also bandage self once in a while when get hit now if master is fighting as well then he does bandage master as well.
Erica- 03-05-2007
Also you know when you bandage someone with bandages well when he bandages himself or master you hear the sound of the bandage applied. cant hear that so needs that sound any idea ?.
Erica- 03-05-2007
Also read more information on him here looks like they can rez themself if they die just click link and read and keep scrolling down trying to make it work like osi im sure its possible if you keep helping me out here to make this pet awesome heres link .
http://uo.stratics.com/database/view.php?d...hunters&id=2440
koluch- 03-07-2007
This is what we were using for 2.0 but we went back to our old stable heavily modified 1.0 SE that starts in 30 seconds rather then the 2.0 that takes 5-10 min.
This may or may not help but who knows.
This seemed to work fine

CODE
using Server; using System; using Server.Items; using Server.Mobiles; using Server.Targeting;
using System.Collections;
namespace Server.Mobiles
{
[CorpseName( "a cu sidhe corpse" )]
public class CuSidhe1 : BaseMount
{
//public override bool OverrideBardingDifficulty { get { return true; } } //Osiris Mod
//public override double BardingDifficulty { get { return 126.9; } } //Osiris Mod
public override WeaponAbility GetWeaponAbility() { return WeaponAbility.BleedAttack; }
public override bool StatLossAfterTame { get { return true; } }
public override bool CanAngerOnTame { get { return true; } }
[Constructable]
public CuSidhe1() : this( "a cu sidhe" )
{
}
[Constructable]
public CuSidhe1( string name ) : base( name, 277, 0x3e91, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
BaseSoundID = 0xE5;
Hue = Utility.RandomList ( 897, 593, 1153, 1161, 2425, 2419, 2219, 33, 2406, 2413, 2207, 2418, 2213, 1278, 26, 0, 96, 900 );
SetStr( 1100, 1325 );
SetDex( 150, 170 );
SetInt( 250, 285 );
SetHits( 800, 1170 );
SetMana( 250, 285 );//from Hiryu
SetStam( 170, 270 );//from hiryu
SetDamage( 20, 28 );//hiryu damage
SetDamageType( ResistanceType.Physical, 0 );
SetDamageType( ResistanceType.Cold, 50 );
SetDamageType( ResistanceType.Energy, 50 );
SetResistance( ResistanceType.Physical, 50, 65 );//used 5 over and 5 under what stratics posted
SetResistance( ResistanceType.Fire, 25, 45 );
SetResistance( ResistanceType.Cold, 70, 85 );
SetResistance( ResistanceType.Poison, 30, 50 );
SetResistance( ResistanceType.Energy, 70, 85 );
SetSkill( SkillName.Anatomy, 65.2, 99.9 );
SetSkill( SkillName.MagicResist, 75.0, 89.7 );
SetSkill( SkillName.Tactics, 85.0, 97.6 );
SetSkill( SkillName.Wrestling, 88.9, 99.9 );
SetSkill( SkillName.Healing, 40.1, 50.0 );
SetSkill( SkillName.Veterinary, 40.1, 50.0 );
SetSkill( SkillName.AnimalLore, 40.1, 50.0 );
SetFameLevel( 5 );
SetKarmaLevel( 5 );
VirtualArmor = 75;
Tamable = true;
ControlSlots = 4;
MinTameSkill = 101.1;
PackGold(750, 950);
PackMagicItems( 1, 5 );
PackItem( new Bandage( Utility.RandomMinMax( 1, 25 ) ) );
}
#region Healing
private DateTime m_BandageStart;
private DateTime m_NextHeal;
private static TimeSpan m_HealDelay = TimeSpan.FromSeconds( 10.0 );
public override void OnThink()
{
if( DateTime.Now < m_BandageStart + m_HealDelay )
return;
bool r = false;
if( !Deleted && Alive && Controlled && !ControlMaster.Deleted )
{ //Priority for ControlMaster //Do these resurrect?
if( ControlMaster.Hits < ControlMaster.HitsMax && ControlMaster.InRange( this, 2 ) && ControlMaster.Alive )
r = HealTarget( ControlMaster );
else if( Hits < HitsMax )
r = HealTarget( this );
}
if( r )
DebugSay( "Healing..." );
else
DebugSay( "Not healing..." );
base.OnThink();
}
public bool HealTarget( Mobile tgt )
{
if( tgt == null )
return false;
if( BandageContext.GetContext( this ) == null ) //If not already healing
{
Item bandage = Backpack.FindItemByType( typeof( Bandage ) );
if( bandage == null )
{
bandage = new Bandage();
Backpack.DropItem( bandage );
}
BandageContext.BeginHeal( this, tgt );
m_BandageStart = DateTime.Now;
return BandageContext.GetContext( this ) != null;
}
else
return false;
}
#endregion
public override void GenerateLoot()
{
AddLoot( LootPack.FilthyRich );
}
public override int GetAngerSound()
{
if ( !Controlled )
return 0x16A;
return base.GetAngerSound();
}
public override int Meat{ get{ return 3; } }
public override int Hides{ get{ return 5; } }
public override HideType HideType{ get{ return HideType.Barbed; } }
public override FoodType FavoriteFood{ get{ return FoodType.Meat; } }
public override void OnDoubleClick( Mobile from )
{
/* if( Core.ML && from.Race == Race.Elf )
{
base.OnDoubleClick( from );
}*/
if ( from.Race == Race.Elf || from.FindItemOnLayer( Layer.Shoes ) is PadsOfTheCuSidhe || from.AccessLevel > AccessLevel.Player )
{
base.OnDoubleClick( from );
}
else
{
from.SendLocalizedMessage( 1072203 ); // Only Elves may use this.
}
}
public CuSidhe1( 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();
// if ( BaseSoundID == 0x16A )
//BaseSoundID = 0xA8;
}
}
}

Let us know how it goes
Good Luck