Files
HeroesStone_PRC8/_module/nss/inc_multisummon.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

65 lines
2.6 KiB
Plaintext

#include "x3_inc_horse"
//multiple summon wrapper
//replaces EffectSummonCreature
//also incorporates the duration from ApplyEffect
//sSummon is the resref
//nFNF_Effect is the VFX
//lLoc is the location
//nDurationType is the duration type of the summon
//fDuration is the duration of the summon, assuming nDurationType is temporary
//fSummonDelay is the delay between the command and the summon NOT IMPLEMENTED
//fVisDelay is the delay between the command and the VFX
//nUseAppearAnimation is passed to CreateObject
void PrimoEffectSummonCreature(string sSummon, int nFNF_Effect, location lLoc,int nDurationType, float fDuration=0.0, float fSummonDelay = 0.0, float fVisDelay = 1.0, int nUseAppearAnimation = FALSE);
//this determies the rate of a pseudoHB that checks
//for removal from party and master death
//Higher = less lag / less accuracy
//Lower = more lag / more accuracy
const float CHECK_RATE = 5.0;
//minimum number of rounds a summon should exist for
//PnP has none, but because sometime the AI takes a while deciding what to do
//a minimum is a good thing for low level characters.
//If you change this, recompile all the scripts
const int SUMMON_DURATION_MIN = 20;
//if you want to toggle between biowares 24h summmons
//and PnP 1 round per level summons
//change the varaible "PnPSummonDuration" on the module to 1
//for the PnP rules, or 0 for bioware rules.
//private function, no prototype
void PrimoSummonCheckmaster()
{
object oMaster = GetMaster();
if(!GetIsObjectValid(oMaster)
||GetIsDead(oMaster)
||GetIsDead(OBJECT_SELF))
{
effect eVis = EffectVisualEffect(VFX_IMP_UNSUMMON);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, GetLocation(OBJECT_SELF));
SetIsDestroyable(TRUE, FALSE, FALSE);
DestroyObject(OBJECT_SELF);
return;
}
DelayCommand(CHECK_RATE, PrimoSummonCheckmaster());
}
void PrimoEffectSummonCreature(string sSummon, int nFNF_Effect, location lLoc, int nDurationType, float fDuration=0.0, float fSummonDelay = 0.0, float fVisDelay = 1.0, int nUseAppearAnimation = FALSE)
{
effect eVis = EffectVisualEffect(nFNF_Effect);
DelayCommand(fVisDelay, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis, lLoc));
object oSummon = CreateObject(OBJECT_TYPE_CREATURE, sSummon, lLoc, nUseAppearAnimation);
int nHenchies = GetMaxHenchmen();
SetMaxHenchmen(nHenchies+5);
AddHenchman(OBJECT_SELF, oSummon);
SetMaxHenchmen(nHenchies);
SetLocalInt(oSummon, "bIsSummon", TRUE);
AssignCommand(oSummon, DelayCommand(CHECK_RATE, PrimoSummonCheckmaster()));
if(nDurationType == DURATION_TYPE_TEMPORARY)
DestroyObject(oSummon, fDuration+fSummonDelay);
}