generated from Jaysyn/ModuleTemplate
79 lines
2.4 KiB
Plaintext
79 lines
2.4 KiB
Plaintext
//::///////////////////////////////////////////////
|
|
//:: Create Undead
|
|
//:: x2_s0_CrShadow.nss
|
|
//:: Copyright (c) 2001 Bioware Corp.
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
This spell will summon a shadow - 20% of the time,
|
|
the shadow will be hostile to the summoner.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: Keith Warner
|
|
//:: Created On: Jan 2/03
|
|
//:://////////////////////////////////////////////
|
|
|
|
#include "x2_inc_spellhook"
|
|
#include "inc_multisummon"
|
|
|
|
void main()
|
|
{
|
|
|
|
/*
|
|
Spellcast Hook Code
|
|
Added 2003-07-07 by Georg Zoeller
|
|
If you want to make changes to all spells,
|
|
check x2_inc_spellhook.nss to find out more
|
|
|
|
*/
|
|
|
|
if (!X2PreSpellCastCode())
|
|
{
|
|
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
|
|
return;
|
|
}
|
|
|
|
// End of Spell Cast Hook
|
|
|
|
|
|
//Declare major variables
|
|
int nMetaMagic = GetMetaMagicFeat();
|
|
int nCasterLevel = GetCasterLevel(OBJECT_SELF);
|
|
int nDuration = nCasterLevel;
|
|
if(nDuration < SUMMON_DURATION_MIN)
|
|
nDuration = SUMMON_DURATION_MIN;
|
|
if(GetLocalInt(GetModule(), "PnPSummonDuration")==FALSE)
|
|
nDuration = 24;
|
|
|
|
//Check for metamagic extend
|
|
if (nMetaMagic == METAMAGIC_EXTEND)
|
|
{
|
|
nDuration = nDuration *2; //Duration is +100%
|
|
}
|
|
//Set the summoned undead to the appropriate template based on the caster level
|
|
if (d100() > 20)
|
|
{
|
|
string sSummon = "x2shfiendfriend";
|
|
|
|
int nFNF_Effect = VFX_FNF_SUMMON_UNDEAD;
|
|
if(GetLocalInt(GetModule(), "PnPSummonDuration")==FALSE)
|
|
PrimoEffectSummonCreature(sSummon, nFNF_Effect,
|
|
GetSpellTargetLocation(), DURATION_TYPE_TEMPORARY, HoursToSeconds(nDuration));
|
|
else
|
|
PrimoEffectSummonCreature(sSummon, nFNF_Effect,
|
|
GetSpellTargetLocation(), DURATION_TYPE_TEMPORARY, RoundsToSeconds(nDuration));
|
|
}
|
|
else
|
|
{
|
|
effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_UNDEAD);
|
|
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetSpellTargetLocation());
|
|
object oShadow = CreateObject(OBJECT_TYPE_CREATURE, "x2shfiendfoe", GetSpellTargetLocation());
|
|
float fDelay;
|
|
if(GetLocalInt(GetModule(), "PnPSummonDuration")==FALSE)
|
|
fDelay = HoursToSeconds(nDuration);
|
|
else
|
|
fDelay = RoundsToSeconds(nDuration);
|
|
DestroyObject(oShadow, fDelay);
|
|
}
|
|
}
|
|
|