HoS_PRC8/_mod/_module/nss/wazoo_s0_astproj.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

127 lines
4.5 KiB
Plaintext

// wazoo_s0_astproj - astral projection
#include "x2_inc_spellhook"
void fnDoProj(object oCreature)
{
effect eVFX=EffectVisualEffect(VFX_DUR_GLOW_BLUE);
object oBody=GetLocalObject(oCreature,"oWazooBody");
effect eRes=EffectResurrection();
if (GetLocalInt(oCreature,"bWAZOOASTRAL")==TRUE&&GetIsObjectValid(oBody))
{ // active
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVFX,oCreature,4.2);
if (GetIsDead(oCreature)==FALSE)
{ // not dead
DelayCommand(4.0,fnDoProj(oCreature));
} // not dead
else
{ // died
ExecuteScript("wazoo_s0_astret",oCreature);
} // died
} // active
else if (GetIsDead(oCreature))
{ // make sure res
ExecuteScript("wazoo_s0_astret",oCreature);
} // make sure res
} // fnDoProj()
object fnCreateLikeness(object oCreature)
{ // create likeness
object oBody=CreateObject(OBJECT_TYPE_PLACEABLE,"wazoo_plc_astp",GetLocation(oCreature));
SetLocalObject(oCreature,"oWazooBody",oBody);
SetLocalObject(oBody,"oOwner",oCreature);
SetLocalInt(oCreature,"bWAZOOASTRAL",TRUE);
fnDoProj(oCreature);
return oBody;
} // fnCreateLikeness()
void main()
{
object oMe=OBJECT_SELF;
object oWP=GetWaypointByTag("PLANESHIFT_ASTRAL");
effect eBeam=EffectBeam(VFX_BEAM_HOLY,oMe,BODY_NODE_CHEST);
object oAssoc;
object oBody;
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
oBody=fnCreateLikeness(oMe);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oMe,JumpToObject(oWP)));
oAssoc=GetAssociate(ASSOCIATE_TYPE_FAMILIAR,oMe);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
oAssoc=GetAssociate(ASSOCIATE_TYPE_SUMMONED,oMe);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
oAssoc=GetAssociate(ASSOCIATE_TYPE_ANIMALCOMPANION,oMe);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
oAssoc=GetAssociate(ASSOCIATE_TYPE_DOMINATED,oMe);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
oAssoc=GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oMe);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
oAssoc=GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oMe,2);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
oAssoc=GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oMe,3);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
oAssoc=GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oMe,4);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
oAssoc=GetAssociate(ASSOCIATE_TYPE_HENCHMAN,oMe,5);
if (oAssoc!=OBJECT_INVALID)
{
eBeam=EffectBeam(VFX_BEAM_HOLY,oAssoc,BODY_NODE_CHEST);
oBody=fnCreateLikeness(oAssoc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eBeam,oBody,10.0);
DelayCommand(6.0,AssignCommand(oAssoc,JumpToObject(oWP)));
}
CreateItemOnObject("wazoo_it_astret",oMe);
}