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 :
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;
            }
        }
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'm trying to make a Tunic Crafted by "name" on the NPC spawn entry like this :
EQUIP/<Tunic/CRAFTER/GETONSPAWN,1,serial>/
Turns out I just needed to set 0 instead of 1.
Can't figure out how to get my npc to self heal tho...
 
i have a few pets that heal, that section looks like this
public virtual bool CanHeal { get { return true; } }
public virtual bool CanHealOwner { get { return true; } }
 
Yes, but how to include this into XmlSpawner book entry if this props is Read Only?
What is the proper format to make it happens when my mob spawn?
 
The squire system has npc self healing with bandages.

 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back