HiddenTradition_PRC8/_module/nss/wiztp_effects.nss
2024-06-20 15:47:42 -04:00

99 lines
2.6 KiB
Plaintext

#include "wiztp_clear"
void DecrementTalentIndex(int iIndex, object oPC)
{
int iDecrementIndex;
talent tSpell;
talent tFeat;
tSpell = TalentSpell(iIndex);
tFeat = TalentFeat(iIndex);
if (GetIsTalentValid(tSpell))
{
if (GetHasSpell(GetIdFromTalent(tSpell), oPC))
{
for (iDecrementIndex = 1; iDecrementIndex < 20; iDecrementIndex++)
{
DecrementRemainingSpellUses(oPC, GetIdFromTalent(tSpell));
if(!GetHasSpell(GetIdFromTalent(tSpell), oPC))
iDecrementIndex=20;
}
}
}
if (GetIsTalentValid(tFeat))
{
if (GetHasFeat(GetIdFromTalent(tFeat), oPC))
{
for (iDecrementIndex = 1; iDecrementIndex < 20; iDecrementIndex++)
{
DecrementRemainingFeatUses(oPC, GetIdFromTalent(tFeat));
if(!GetHasFeat(GetIdFromTalent(tFeat), oPC))
iDecrementIndex=20;
}
}
}
}
void WizTPEffect(object oPC, location oPCLoc)
{
if(GetIsInCombat(oPC))
return;
effect eLightning = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
effect eGate = EffectVisualEffect(VFX_FNF_SUMMON_CELESTIAL);
effect eGate2 = EffectVisualEffect(VFX_FNF_SUMMON_GATE);
AssignCommand(oPC,ActionCastFakeSpellAtObject(SPELL_GATE,oPC));
int iIndex;
for (iIndex = 1; iIndex < 1000; iIndex++)
{
DecrementTalentIndex(iIndex, oPC);
}
DecrementRemainingSpellUses(oPC,SPELL_ALL_SPELLS);
DelayCommand(4.0,AssignCommand(oPC,ActionRandomWalk()));
DelayCommand(6.4,AssignCommand(oPC,ClearAllActions()));
DelayCommand(7.0,AssignCommand(oPC,SetFacing(GetFacing(oPC)+180.0)));
DelayCommand(8.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eLightning,oPCLoc));
DelayCommand(11.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eLightning,oPCLoc));
DelayCommand(14.5,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eGate,oPCLoc));
DelayCommand(14.5,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eGate2,oPCLoc));
}
void kPortal(object portal)
{
object oPC = GetLocalObject(portal,"wizTPOwner");
DeleteLocalObject(portal,"wizTP");
ClearWizTP();
DeleteLocalObject(portal,"wizTPOwner");
DestroyObject(portal);
return;
}
void dPortal(object oPC, object wizTP, location oPCLoc)
{
object portal = CreateObject(OBJECT_TYPE_PLACEABLE,"wiztp_portal",oPCLoc);
SetCustomToken(796,GetName(GetArea(wizTP)));
DelayCommand(30.0,kPortal(portal));
SetLocalObject(portal,"wizTP",wizTP);
SetLocalObject(portal,"wizTPOwner",oPC);
return;
}