Aller au contenu

Photo

Simulacrum Dismissal


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
BartjeD

BartjeD
  • Members
  • 249 messages
Hello everybody,

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
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
'When the script gets rid of the simulcrum, does it destroy the object? If so do you remove the simulcrum from the party before destroying it? I think if you destroy it without removing it from the party first, that could be the cause of the problem.



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
BartjeD

BartjeD
  • Members
  • 249 messages
No I remove the creature as a henchman before it is destroyed. I'm at a loss.

#4
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
When I am debugging a script sometimes I try doing other actions to the object of the script. Maybe instead of destroying the henchman, you could just remove it and see what happens then, if you haven't already tried it.



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
MasterChanger

MasterChanger
  • Members
  • 686 messages
How does the Shadow Simulacrum spell do it?

#6
BartjeD

BartjeD
  • Members
  • 249 messages
This is the Simulacrum script - It's essentially a henchman except it won't be removed as such before being destroyed.

"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
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
Try doing RemoveFromParty() before doing the RemoveHenchman(). The scripts in module E of MotB do this when expelling the duplicate party member.



Regards

#8
BartjeD

BartjeD
  • Members
  • 249 messages
Alright I'll try that, thanks!