Simulacrum Dismissal
#1
Posté 29 décembre 2010 - 10:48
I've coded a Simulacrum spell which "summons" a copy of the caster at 60% his level but with all abilities and spells intact.
Now whenever I cast a dispel or dismissal / banishment at the Simulcrum, which is a Copy of the Summoner (CopyObject) it will vanish but it won't remove itself from the caster as a henchman!
(They are dispelled through a custom scriptset, which registers those effects or spells being cast on them)
I've used the obvious function to remove hencmen and with other custom summons this works. The exception is the Simulacrum / caster copy which leaves an ugly empty portrait after being deleted.
For all intents and purposes it seems to skip the function that removes it as a henchman.
For example I have used that function at different times and intervals within the deleting script but to no avail. Why does this Simulacrum behave differently as a hencman then other, "normal" custom summons?
How can I fix this?
I appreciate your help!
#2
Posté 29 décembre 2010 - 04:55
I also wonder if by copying the PC you are copying different properties than if you do a simple summon spell where you create a new creature. In copying the PC you could be copying parameters that require different scripting to be removed from the party. I have never done this before, so I can only give vague suggestions. Hope it helps some.
Best of luck!
#3
Posté 29 décembre 2010 - 06:18
#4
Posté 29 décembre 2010 - 06:44
You could also try to run the same script with a different type of creature that wan't a copy of the PC to see if that yields different results.
#5
Posté 29 décembre 2010 - 07:38
#6
Posté 29 décembre 2010 - 08:15
"spell_simulacrum"
#include "X0_I0_SPELLS"
#include "jx_inc_magic"
#include "x2_inc_spellhook"
#include "ginc_vectors"
void mainSpell();
void main()
{
AssignCommand(JXGetCaster(), mainSpell());
}
void mainSpell()
{
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
{ JXPostSpellCastCode(); return; }
}
// End of Spell Cast Hook
///Declare major variables
int nID = JXGetSpellId();
object oCaster = JXGetCaster(OBJECT_SELF);
object oTarget = JXGetSpellTargetObject(OBJECT_SELF);
int nCasterLvl = JXGetCasterLevel(OBJECT_SELF);
float fDuration = RoundsToSeconds(nCasterLvl);
effect eSummon;
string sSummon;
int iVFX = VFX_FNF_SUMMON_MONSTER_2;
effect eVisual;
effect eVis = EffectVisualEffect( VFX_DUR_CUTSCENE_INVISIBILITY );
effect eDeath = EffectDeath(FALSE, TRUE, TRUE);
object oArea = GetNearestObjectByTag("combat_state", OBJECT_SELF, 0);
int iIn_Combat = GetLocalInt(OBJECT_SELF, "in_combat");
int iGlobalRound = GetLocalInt(oArea, "at_turn"); //combat state turn
location lCaster = LocLSideOfObj(oCaster, 3.0);
location lSummon = CalcSafeLocation(oCaster, lCaster, 3.0, TRUE, TRUE);
//Metamagic duration & duration type
fDuration = ApplyMetamagicDurationMods(fDuration);
int nDurType = ApplyMetamagicDurationTypeMods(DURATION_TYPE_TEMPORARY);
object oSummon1 = CopyObject(oCaster, lSummon, OBJECT_INVALID, GetName(oCaster) + "_simulacrum");
SetLocalInt(oSummon1, "summoned", 1);
SetLocalInt(oSummon1, "com_controllable", 1);
eVisual = EffectVisualEffect(iVFX, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oSummon1, 0.0);
ChangeToStandardFaction(oSummon1, STANDARD_FACTION_DEFENDER);
if(iIn_Combat == 0)
{
DelayCommand(fDuration, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oSummon1, 0.0));
DelayCommand(fDuration, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oSummon1, 0.0));
}
if(GetIsObjectValid(oArea)==TRUE)
{
SetLocalInt(oSummon1, "summoned_until", iGlobalRound + nCasterLvl);
SetCommandable(FALSE, oSummon1);
}
SetLootable(oSummon1, FALSE);
string sNewName = "the other "+ GetFirstName(oCaster);
SetFirstName(oSummon1, sNewName);
int iXP = GetXP(oCaster) - ((GetXP(oCaster) / 5) * 2); //60%
int iLevels = GetTotalLevels(oCaster, TRUE);
int iDrainLvl = (iLevels / 5) * 2;
effect eDrain = SupernaturalEffect(EffectNegativeLevel(iDrainLvl, FALSE));
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDrain, oSummon1, 0.0);
SetXP(oSummon1, iXP);
SetCreatureScriptsToSet(oSummon1, 5);
SetLocalInt(oSummon1, "dispel_level", 11 + nCasterLvl);
AddHenchman(OBJECT_SELF, oSummon1);
ExecuteScript("combat_nexus", oSummon1); //involve enemy in combat
JXPostSpellCastCode();
}
#7
Posté 30 décembre 2010 - 05:36
Regards
#8
Posté 30 décembre 2010 - 10:04





Retour en haut






