Add respawn timer to smartscript despawn

This commit is contained in:
hondacrx
2017-07-24 14:05:36 -04:00
parent cbf11e07ae
commit 4b447a3aa4
3 changed files with 8 additions and 4 deletions
+5 -2
View File
@@ -95,7 +95,7 @@ namespace Game.AI
mDespawnState++;
}
else
me.DespawnOrUnsummon();
me.DespawnOrUnsummon(0, TimeSpan.FromSeconds(mRespawnTime));
}
else
mDespawnTime -= diff;
@@ -549,6 +549,7 @@ namespace Game.AI
public override void JustRespawned()
{
mDespawnTime = 0;
mRespawnTime = 0;
mDespawnState = 0;
mEscortState = SmartEscortState.None;
me.SetVisible(true);
@@ -907,9 +908,10 @@ namespace Game.AI
public void SetInvincibilityHpLevel(uint level) { mInvincibilityHpLevel = level; }
public void SetDespawnTime(uint t)
public void SetDespawnTime(uint t, uint r = 0)
{
mDespawnTime = t;
mRespawnTime = r;
mDespawnState = (uint)(t != 0 ? 1 : 0);
}
@@ -945,6 +947,7 @@ namespace Game.AI
uint mInvincibilityHpLevel;
uint mDespawnTime;
uint mRespawnTime;
uint mDespawnState;
public uint mEscortQuestID;
+1
View File
@@ -2348,6 +2348,7 @@ namespace Game.AI
public struct ForceDespawn
{
public uint delay;
public uint respawn;
}
public struct InvincHP
{
+2 -2
View File
@@ -1071,11 +1071,11 @@ namespace Game.AI
Creature target = obj.ToCreature();
if (target.IsAlive() && IsSmart(target))
{
((SmartAI)target.GetAI()).SetDespawnTime(e.Action.forceDespawn.delay + 1); // Next tick
((SmartAI)target.GetAI()).SetDespawnTime(e.Action.forceDespawn.delay + 1, e.Action.forceDespawn.respawn); // Next tick
((SmartAI)target.GetAI()).StartDespawn();
}
else
target.DespawnOrUnsummon(e.Action.forceDespawn.delay);
target.DespawnOrUnsummon(e.Action.forceDespawn.delay, TimeSpan.FromSeconds(e.Action.forceDespawn.respawn));
}
else if (obj.IsTypeId(TypeId.GameObject))
{