I do exactly this for certain boss fights.
//Additional Script for the Master of the Void Boss Fight - Damage event
#include "nwnx_funcs"
#include "invoke_inc"
#include "ritual_inc"
#include "nos_sounds_inc"
void DoCrystalHealing(int i)
{
object oCrystal = GetNearestObjectByTag("dark_crystal");
if(oCrystal == OBJECT_INVALID || !GetIsObjectValid(oCrystal))
{
return;
}
SetLocalObject(oCrystal,"INV_TARGET",OBJECT_SELF);
SetLocalInt(oCrystal,"INV_HEAL",i);
AssignCommand(oCrystal,DoSpell(22,oCrystal, OBJECT_SELF));
}
object GetAClone()
{
int i;
for(i=1;i<=10;i++)
{
object oClone = GetLocalObject(OBJECT_SELF,"SHADOW_COPY_"+IntToString(i));
if(GetIsObjectValid(oClone) && !GetIsDead(oClone))
{
return oClone;
}
}
return OBJECT_INVALID;
}
void WakfuFun2(object oPC)
{
DelayCommand(1.00,SpeakString("Hey there.... wana play?"));
NWNXFuncs_SetSkill(OBJECT_SELF,SKILL_SPELLCRAFT,127);
DelayCommand(2.00,DoSpell(5,OBJECT_SELF,OBJECT_SELF));
DelayCommand(6.00,ActionCastSpellAtObject(SPELL_EPIC_HELLBALL,oPC,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
DelayCommand(9.00,ActionCastSpellAtObject(SPELL_EPIC_RUIN,oPC,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
DelayCommand(15.00,ActionCastSpellAtObject(SPELL_EPIC_RUIN,oPC,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
DelayCommand(25.00,DoSpell(5,OBJECT_SELF,OBJECT_SELF));
DelayCommand(30.00,ToggleRitualMode(OBJECT_SELF));
DelayCommand(31.00,ProcessPossibleRitual(OBJECT_SELF,"Estuans Interius"));
DelayCommand(32.00,ProcessPossibleRitual(OBJECT_SELF,"Ira veh"));
DelayCommand(33.00,ProcessPossibleRitual(OBJECT_SELF,"Estuans Int"));
DelayCommand(34.00,ProcessPossibleRitual(OBJECT_SELF,"Ira Veh"));
DelayCommand(35.70,ProcessPossibleRitual(OBJECT_SELF,"Sephiroth"));
DelayCommand(38.00,SpeakString("This is a friend of mine... Meet Sephiroth"));
DelayCommand(48.00,SpeakString("Slow down... Relax!!"));
DelayCommand(49.00,DoSpell(5,OBJECT_SELF,OBJECT_SELF));
DelayCommand(50.00,ToggleRitualMode(OBJECT_SELF));
DelayCommand(52.00,ProcessPossibleRitual(OBJECT_SELF,"i curse all who enter"));
DelayCommand(54.00,ProcessPossibleRitual(OBJECT_SELF,"this circle ever pure"));
DelayCommand(56.00,ProcessPossibleRitual(OBJECT_SELF,"be they friend or foe"));
DelayCommand(58.00,ProcessPossibleRitual(OBJECT_SELF,"their feet grow ever old"));
effect eImmob = EffectCutsceneImmobilize();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eImmob,OBJECT_SELF,15.00);
DelayCommand(69.00,DoSpell(5,OBJECT_SELF,OBJECT_SELF));
}
void WakfuFun(object oPC)
{
DelayCommand(1.00,SpeakString("Im gonna enjoy ripping you apart!!"));
NWNXFuncs_SetSkill(OBJECT_SELF,SKILL_SPELLCRAFT,127);
DelayCommand(2.00,DoSpell(5,OBJECT_SELF,OBJECT_SELF));
DelayCommand(6.00,ActionCastSpellAtObject(SPELL_EPIC_HELLBALL,oPC,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
DelayCommand(9.00,ActionCastSpellAtObject(SPELL_EPIC_RUIN,oPC,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
DelayCommand(15.00,ActionCastSpellAtObject(SPELL_EPIC_RUIN,oPC,METAMAGIC_ANY,TRUE,0,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
DelayCommand(25.00,DoSpell(5,OBJECT_SELF,OBJECT_SELF));
DelayCommand(30.00,ToggleRitualMode(OBJECT_SELF));
DelayCommand(31.00,ProcessPossibleRitual(OBJECT_SELF,"Bird of Flame"));
DelayCommand(33.00,ProcessPossibleRitual(OBJECT_SELF,"Phoenix Take Flight"));
DelayCommand(35.00,ProcessPossibleRitual(OBJECT_SELF,"We Summon your Grace"));
DelayCommand(37.00,ProcessPossibleRitual(OBJECT_SELF,"To win the fight"));
DelayCommand(38.00,SpeakString("Come forth Dark Phoenix!!"));
DelayCommand(48.00,SpeakString("How about a little mind control?"));
DelayCommand(49.00,DoSpell(5,OBJECT_SELF,OBJECT_SELF));
DelayCommand(50.00,ToggleRitualMode(OBJECT_SELF));
DelayCommand(52.00,ProcessPossibleRitual(OBJECT_SELF,"Hear me slaves"));
DelayCommand(54.00,ProcessPossibleRitual(OBJECT_SELF,"do my will "));
DelayCommand(56.00,ProcessPossibleRitual(OBJECT_SELF,"hear my voice "));
DelayCommand(58.00,ProcessPossibleRitual(OBJECT_SELF,"see the world with new eyes"));
effect eImmob = EffectCutsceneImmobilize();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eImmob,OBJECT_SELF,15.00);
DelayCommand(69.00,DoSpell(5,OBJECT_SELF,OBJECT_SELF));
}
void CreateDopplegangers(object oDamager)
{
object oFac = GetFirstFactionMember(oDamager);
int i = 1;
while(oFac != OBJECT_INVALID)
{
if(GetArea(oFac) == GetArea(oDamager))
{
effect eVisual = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVisual,oFac);
object oClone = CopyObject(oFac,GetLocation(oFac));
if(GetLevelByclass(class_TYPE_SORCERER,oFac)>=20)
{
AssignCommand(oClone,WakfuFun(oFac));
}else if(GetLevelByclass(class_TYPE_FIGHTER,oFac)>=20)
{
AssignCommand(oClone,WakfuFun2(oFac));
}
if(GetStringLowerCase(GetSubRace(oFac))=="vampire" ||GetStringLowerCase(GetSubRace(oFac))=="wraith" || GetStringLowerCase(GetSubRace(oFac))=="lich")
{
NWNXFuncs_SetRace(oClone,RACIAL_TYPE_UNDEAD);
}
SetPlotFlag(oClone,TRUE);
object oItem = GetFirstItemInInventory(oClone);
while(oItem != OBJECT_INVALID)
{
SetPlotFlag(oItem,FALSE);
DestroyObject(oItem,0.01);
oItem = GetNextItemInInventory(oClone);
}
int iFaction = NWNXFuncs_GetFactionID(OBJECT_SELF);
NWNXFuncs_SetFactionID(oClone,iFaction);
SetIsTemporaryEnemy(oFac,oClone,FALSE);
SetLootable(oClone,FALSE);
SetName(oClone,GetName(oFac)+"'s Shadow");
int i;
for(i = 0;i<=12;i++)
{
string sScript = NWNXFuncs_GetEventScript(OBJECT_SELF,i);
NWNXFuncs_SetEventScript(oClone,sScript,i);
}
int nSlot;
for (nSlot=0; nSlot<NUM_INVENTORY_SLOTS; nSlot++)
{
oItem=GetItemInSlot(nSlot, OBJECT_SELF);
if(oItem != OBJECT_INVALID)
{
//SetPlotFlag(oItem,FALSE);
//DestroyObject(oItem,0.01);
SetPickpocketableFlag(oItem,FALSE);
SetDroppableFlag( oItem,FALSE);
}
}
int iGold = GetGold(oClone);
TakeGoldFromCreature(iGold,oClone,TRUE);
SetPlotFlag(oClone,FALSE);
NWNXFuncs_SetEventScript(oClone,"dopple_gdeath",10);
SetLocalInt(oClone,"DIVINITY_C_POINTS",20);
AssignCommand(oClone,ActionAttack(oFac));
effect eVis = SupernaturalEffect(EffectVisualEffect(VFX_DUR_PROT_SHADOW_ARMOR));
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eVis,oClone);
SetLocalObject(OBJECT_SELF,"SHADOW_COPY_"+IntToString(i),oClone);
i++;
}
oFac = GetNextFactionMember(oDamager);
}
}
void SendMessageToParty(object oDamager, string sText)
{
object oFac = GetFirstFactionMember(oDamager);
while(oFac != OBJECT_INVALID)
{
SendMessageToPC(oFac,sText);
oFac = GetNextFactionMember(oDamager);
}
}
void ApplyEffectToParty(object oDamager, effect eEffect, float fDur)
{
object oFac = GetFirstFactionMember(oDamager);
while(oFac != OBJECT_INVALID)
{
if(GetArea(oFac) == GetArea(oDamager))
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eEffect,oFac,fDur);
}
oFac = GetNextFactionMember(oDamager);
}
}
int iRandomSpell()
{
int i = d6(1);
switch(i)
{
case 1: return SPELL_ISAACS_GREATER_MISSILE_STORM; break;
case 2: return SPELL_WORD_OF_FAITH; break;
case 3: return SPELL_WOUNDING_WHISPERS; break;
case 4: return SPELL_WAIL_OF_THE_BANSHEE; break;
case 5: return SPELL_ENERGY_DRAIN; break;
case 6: return SPELL_BIGBYS_FORCEFUL_HAND; break;
}
return 0;
}
void CastSpellAgainstParty(object oDamager)
{
object oFac = GetFirstFactionMember(oDamager);
SetPlotFlag(OBJECT_SELF,TRUE);
while(oFac != OBJECT_INVALID)
{
if(GetArea(oFac) == GetArea(oDamager))
{
AssignCommand(OBJECT_SELF,ActionCastSpellAtObject(iRandomSpell(),oFac,TRUE,40,PROJECTILE_PATH_TYPE_DEFAULT,TRUE));
}
oFac = GetNextFactionMember(oDamager);
}
SetPlotFlag(OBJECT_SELF,FALSE);
}
void main()
{
object oBoss = OBJECT_SELF;
object oDamager = GetLastDamager();
int iCurrentHealth = GetCurrentHitPoints(oBoss);
int iMax = GetMaxHitPoints(oBoss);
int iRegen = GetLocalInt(OBJECT_SELF,"REGEN_");
int iImmune = GetLocalInt(OBJECT_SELF,"IMMS_DONE");
float fPercent = (IntToFloat(iCurrentHealth)/IntToFloat(iMax))*100.00;
if(GetAClone() != OBJECT_INVALID)
{
effect eHeal2 = EffectHeal(150);
effect eVisHeal2 = EffectVisualEffect(VFX_IMP_EVIL_HELP);
effect eRegen = EffectRegenerate(50,2.00);
//effect eLink2 = EffectLinkEffects(eVisHeal2,eHeal2);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eHeal2,OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eVisHeal2,OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eRegen,OBJECT_SELF,15.00);
}
if(!iImmune)
{
effect e = EffectImmunity(IMMUNITY_TYPE_PARALYSIS);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,e,OBJECT_SELF);
e = EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,e,OBJECT_SELF);
SetLocalInt(OBJECT_SELF,"IMMS_DONE",1);
}
if(iRegen)
{
int i = GetDamageDealtByType(DAMAGE_TYPE_MAGICAL);
i = i + GetDamageDealtByType(DAMAGE_TYPE_NEGATIVE);
i = (d6(2)* 3)+i;
if(i >= 1)
{
effect eHeal = EffectHeal(i*2);
effect eVisHeal = EffectVisualEffect(VFX_IMP_EVIL_HELP);
effect eLink = EffectLinkEffects(eVisHeal,eHeal);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eLink,OBJECT_SELF);
FloatingTextStringOnCreature("Healed:"+IntToString(i),OBJECT_SELF);
DoCrystalHealing(i);
}
}
if(fPercent >= 1.00 && fPercent <= 8.00)
{
int HasDone0103 = GetLocalInt(oBoss,"HASDONE0103");
if(!HasDone0103)
{
SpeakString("Please.... Nooooo......");
SetLocalInt(oBoss,"HASDONE0103",1);
CastSpellAgainstParty(oDamager);
effect eRegen2 = SupernaturalEffect(EffectRegenerate(75,3.00));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eRegen2,oBoss,60.00);
return;
}
}
if(fPercent >= 10.00 && fPercent <= 15.00)
{
int HasDone1015 = GetLocalInt(oBoss,"HASDONE1015");
if(!HasDone1015)
{
SetAILevel(OBJECT_SELF,AI_LEVEL_HIGH);
//SpeakString("This... Cannot Be!!!");
PlayNosgothSound(OBJECT_SELF,"diablo_t2","Not even death will save you from me!!",0.75);
SetLocalInt(oBoss,"HASDONE1015",1);
effect eDarkness = SupernaturalEffect(EffectBlindness());
effect eSilence = SupernaturalEffect(EffectSilence());
effect eDazed = SupernaturalEffect(EffectDazed());
effect eVuln = SupernaturalEffect(EffectDamageImmunityDecrease(DAMAGE_TYPE_NEGATIVE,90));
ApplyEffectToParty(oDamager,eDarkness,60.00);
ApplyEffectToParty(oDamager,eSilence,60.00);
ApplyEffectToParty(oDamager,eVuln,60.00);
ApplyEffectToParty(oDamager,eDazed,10.00);
effect eDamage = SupernaturalEffect(EffectDamageIncrease(DAMAGE_BONUS_20,DAMAGE_TYPE_NEGATIVE));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eDamage,OBJECT_SELF,240.00);
SendMessageToParty(oDamager,"The Master of the Void is making his last stand...");
AssignCommand(GetModule(),SpeakString("The Master of the Void is making his final Stand.",TALKVOLUME_SHOUT));
return;
}
}
if(fPercent >= 20.00 && fPercent <= 25.00)
{
int HasDone2025 = GetLocalInt(oBoss,"HASDONE2025");
if(!HasDone2025)
{
SpeakString("The Shadows themselves renew me!! Hahahaaaa");
SetLocalInt(oBoss,"HASDONE2025",1);
effect eRegen = SupernaturalEffect(EffectRegenerate(50,2.00));
effect eResist1 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_SLASHING,25));
effect eResist2 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_PIERCING,25));
effect eResist3 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_BLUDGEONING,25));
effect eResist4 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_BASE_WEAPON,75));
effect eResist5 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_FIRE,25));
effect eResist6 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE,100));
effect eResist7 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_SONIC,25));
effect eResist8 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_ELECTRICAL,25));
effect eResist9 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_ACID,25));
effect eResist10 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_COLD,25));
effect eResist11 = SupernaturalEffect(EffectDamageImmunityIncrease(DAMAGE_TYPE_MAGICAL,25));
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist1,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist2,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist3,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist4,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist5,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist6,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist7,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist8,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist9,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist10,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eResist11,oBoss,120.00);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eRegen,oBoss,120.00);
SetLocalInt(OBJECT_SELF,"REGEN_",1);
DelayCommand(120.00,SetLocalInt(OBJECT_SELF,"REGEN_",0));
SendMessageToParty(oDamager,"The Master of the Void has entered a Regeneration Phase.");
AssignCommand(GetModule(),SpeakString("The Master of the Void has entered a Regeneration Phase. Magic and Negative Energy will heal him for the next 2 minutes.",TALKVOLUME_SHOUT));
return;
}
}
if(fPercent >= 30.00 && fPercent <= 40.00)
{
int HasDone3040 = GetLocalInt(oBoss,"HASDONE3040");
if(!HasDone3040)
{
SpeakString("You will not destroy us....Destroy yourselves instead....");
SetLocalInt(oBoss,"HASDONE3040",1);
CreateDopplegangers(oDamager);
return;
}
}
if(fPercent >= 50.00 && fPercent <= 65.00)
{
int HasDone5065 = GetLocalInt(oBoss,"HASDONE5065");
if(!HasDone5065)
{
//SpeakString("We shall not be stopped by the likes of you!!!");
PlayNosgothSound(OBJECT_SELF,"diablo_t1","Baaaah... the smell of life surrounds me!!",0.75);
SetLocalInt(oBoss,"HASDONE5065",1);
effect eKnockDownImmunity = EffectImmunity(IMMUNITY_TYPE_KNOCKDOWN);
effect s = EffectDamageImmunityIncrease(DAMAGE_TYPE_SLASHING,60);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,s,OBJECT_SELF);
ApplyEffectToObject(DURATION_TYPE_PERMANENT,eKnockDownImmunity,OBJECT_SELF);
SetBaseAttackBonus(6,oBoss);
return;
}
}
}
It allows me to enable certain things at certain points during the bosses battle.
Eg- When close to death ... say certain things,
or when at certain points of health, spawn shadow clones of the players.