So, the basics: I have a custom monster that I'm writing, he has a few abilities. One of which he spawns an add, if there is an add already spawned, he does not spawn another until the first one is gone. His current OnThink method checks if he is out of combat and if so, he will regenerate his health very rapidly. My question is this: is there a way to add onto that, that if there is an add spawned and in range, he will have some form of damage shield ie take no damage until the add is dead. I can post the script or the onthink method if necessary.
 
Not totally sure it'd work but you could try override the damage method which would probably stop the creature from taking any damage at all, something like:

Code:
public override void Damage( int amount, Mobile from )
{
	if( !AddsAliveCondition )
		base.Damage( amount, from );
}
 
Seems more like you need to modify the monster script itself. I would look at maybe Damage, see if he has an add, and make basically negate the damage there.
 
I think, after much hair pulling, and without being tested yet *crosses fingers* I may have gotten it to work. It compiles at least haha
 
C#:
private long _NextProtectorSpawn;

[CommandProperty(AccessLevel.GameMaster)]
public Mobile Protector { get; set; }

[CommandProperty(AccessLevel.GameMaster)]
public bool IsProtected { get{ return Protector != null && !Protector.Deleted && Protector.Alive && Protector.InRange(this, 10); } }

public override bool CanBeDamaged()
{
    return base.CanBeDamaged() && !IsProtected;
}

public override void OnDelete()
{
    base.OnDelete();

    Protector = null;
}

protected void CheckProtector()
{
    if( Protector != null && (Protector.Deleted || !Protector.Alive) )
    {
        Protector = null;
         _NextProtectorSpawn = Core.TickCount + 30000; // 30 secs between spawns
    }
}

public override void OnThink()
{
    base.OnThink();

    CheckProtector();

    if( Protector == null && _NextProtectorSpawn < Core.TickCount )
    {
         _NextProtectorSpawn = Core.TickCount + 30000; // 30 secs between spawns

         Protector = new Mongbat();
         Protector.MoveToWorld( Location, Map );
    }
}

Hope that helps :)
 
That does in fact help! Thanks a ton! I had it written so vastly more complicated and only partially working haha
 
Back