D4rkh0bb1T
Member
I want to create a NPC with player abilities.
I think if my NPC is set to AI.Mage they will cast Heal sometime but not sure?
***But I cant get my NPC to heal himself with Bandages, just like a player would do, even with bandages in backpack.***
(Added into spawn entry : SKILL,healing/120/)
I tried to write in the spawn entry : CanHeal/True
This report the following error : CanHeal : Property is read only.
So this Property need to be overriden?
I have a SpawnHelper.cs script with this in it :
I feel like i'm about to fix this but not sure how... How to override the read only property?
Or should I just put the above code into the XmlQuestNPC.cs, so every NPC would have this property?
While i'm here, i'll use this post to ask another quick question about Props Format.
I'm trying to make a Tunic Crafted by "name" on the NPC spawn entry like this :
EQUIP/<Tunic/CRAFTER/GETONSPAWN,1,serial>/
There's no error and the Tunic has no Crafter props... what's the format?
Thanks for reading.
I think if my NPC is set to AI.Mage they will cast Heal sometime but not sure?
***But I cant get my NPC to heal himself with Bandages, just like a player would do, even with bandages in backpack.***
(Added into spawn entry : SKILL,healing/120/)
I tried to write in the spawn entry : CanHeal/True
This report the following error : CanHeal : Property is read only.
So this Property need to be overriden?
I have a SpawnHelper.cs script with this in it :
C#:
public override bool CanHeal { get { return true; } }
public override void OnThink()
{
base.OnThink();
// Use bandages
if ( (this.IsHurt() || this.Poisoned) && m_Bandaging == false )
{
Bandage m_Band = (Bandage)this.Backpack.FindItemByType( typeof ( Bandage ) );
if ( m_Band != null )
{
m_Bandaging = true;
if ( BandageContext.BeginHeal( this, this ) != null )
m_Band.Consume();
BandageTimer bt = new BandageTimer( this );
bt.Start();
}
}
}
private class BandageTimer : Timer
{
private SpawnHelper pk;
public BandageTimer( SpawnHelper o ) : base( TimeSpan.FromSeconds( 4 ) )
{
pk = o;
Priority = TimerPriority.OneSecond;
}
protected override void OnTick()
{
pk.m_Bandaging = false;
}
}
Or should I just put the above code into the XmlQuestNPC.cs, so every NPC would have this property?
While i'm here, i'll use this post to ask another quick question about Props Format.
I'm trying to make a Tunic Crafted by "name" on the NPC spawn entry like this :
EQUIP/<Tunic/CRAFTER/GETONSPAWN,1,serial>/
There's no error and the Tunic has no Crafter props... what's the format?
Thanks for reading.