Jump to content

[LE] Making Summoned NPCs summon multiple NPCs?


Recommended Posts

I'm busy this morning and won't be able to test this myself. I will when I get the time, but I thought if I posted here, I might be able to get some insight before I get the chance.

For a master level conjuration spell, the player will summon a Xivkyn Lord.

I want that Xivkyn Lord to summon TWO of it's own, much weaker followers.

Do NPCs have a summon limit? Can I use the vanilla conjuration perk on an NPC to raise their limit?


And lastly, is the correct way to make a single spell summon 2 NPCs by making a normal summon spell for 1 npc, and attaching a script onto the magic effect that tells it to cast the 2nd NPCs summon spell like this?

NPC#1 Summon spell MGEF Script:

Event OnEffectStart(akcaster, aktarget)
  NPC#2SummonSpell.Cast(akcaster, akcaster)
EndEvent

Or is there a better way to go about it?


EDIT:
Actually, if NPCs do not have a limit OR if the perk works on NPCs, couldn't I just put NPC1 magic effect AND NPC2 magic effect on the same spell to make it summon both?

Edited by saintgrimm92
Link to comment
Share on other sites

This is something I do a lot in my last quest mod (ACT II) in different ways.

If you want your summoned NPC to summon 2 more npcs you can do it easily with 2 ways.


1) Duplicate the perk that rises the summon number and give it a unique ID (I can't remember the name of the perk), add that perk to your actor, and from here is plain simple.


2) Create a 'Chain' of summon spells, for example:

Your main actor will have a normal summon spell that will summon an actor, that summoned actor will be also carrying his own summon spell, the end result is the same.

- First summon actor > Summons second actor > Which the second actor summons the third actor


* One of my boss fights has this 'Summon Shade Chain' function, which the boss summons shades of herself (up to 5 summons, or 6... I can't remember) to confuse the player. This is a kind of a 'combat puzzle', you can't survive if you go fighting all the actors that the boss will summon, so you have to find and kill the first summoned actor in the chain to kill instantly all the other summoned actors.


* An other one: when a guardian boss dies he summons 4 actors around the player to avenge him.


An a bunch of other different summon multiple actors, I'm giving you a few ideas here...



SCRIPT

If the actor which does the first summon does not have the required perk to allow to summon 2 actors, then when the second actor's magic effect fires the script, it will cast a summon on the first actor (the akCaster), but the second summoned actor will instantly die so the third can take its summon slot.

* I hope I'm clear and I'm not confusing you.

Edited by maxarturo
Link to comment
Share on other sites

 

This is something I do a lot in my last quest mod (ACT II) in different ways.
If you want your summoned NPC to summon 2 more npcs you can do it easily with 2 ways.
1) Duplicate the perk that rises the summon number and give it a unique ID (I can't remember the name of the perk), add that perk to your actor, and from here is plain simple.
2) Create a 'Chain' of summon spells, for example:
Your main actor will have a normal summon spell that will summon an actor, that summoned actor will be also carrying his own summon spell, the end result is the same.
- First summon actor > Summons second actor > Which the second actor summons the third actor
* One of my boss fights has this 'Summon Shade Chain' function, which the boss summons shades of herself (up to 5 summons, or 6... I can't remember) to confuse the player. This is a kind of a 'combat puzzle', you can't survive if you go fighting all the actors that the boss will summon, so you have to find and kill the first summoned actor in the chain to kill instantly all the other summoned actors.
* An other one: when a guardian boss dies he summons 4 actors around the player to avenge him.
An a bunch of other different summon multiple actors, I'm giving you a few ideas here...
SCRIPT
If the actor which does the first summon does not have the required perk to allow to summon 2 actors, then when the second actor's magic effect fires the script, it will cast a summon on the first actor (the akCaster), but the second summoned actor will instantly die so the third can take its summon slot.
* I hope I'm clear and I'm not confusing you.

 

 

 

That sounds doable. Thank you again! Just got home, need to figure out dinner, then I'll get it implemented :)

Link to comment
Share on other sites

It's all set up and working!!

There's only 1 issue, and I'm not sure if it's fixable, as the script seems correct to me.

I opted for a script instead of ai package to force the xivkyn lord to cast the summon when entering combat, as it's a voice power anyway and wouldn't use the typical cast animations; the Lord variants use either sword+shield or 2h sword, so no room to equip spells to hands so I made it's unique summon spell into a voice power instead of spell.

I think it looks pretty cool, just as he's pulling out his weapon, the summonFX appears nearby.

However, he casts the spell twice. Both at the start of combat AND at the end of combat. He re-summons the NPCs as he's sheathing his sword after his target is dead.

Here's the script I have on the Xivkyn Lord to make him cast the spell:

Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
if (aeCombatState == 1)
  EquipSpell(SummonSpell,2)
  DoCombatSpellApply(SummonSpell, self)
EndIf
EndEvent
Edited by saintgrimm92
Link to comment
Share on other sites

The function 'DoCombatSpellApply()' is used for completely different application, there is no need for this here.
If a spell is declared inside a script, then there is no need to add that spell to the actor, the script will cast it no matter if it is in the actor's inventory or not.
A simple summon spell will do just fine, and is what you need here.
* I assume the script is living in the actor so I'm using 'Self'.
Spell Property MySummonSpell01 Auto
 
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If (aeCombatState == 1)
        MySummonSpell01.Cast(Self, Self)
EndIf
ENDEVENT
Now, if you want to add a 'Fail Safe' or add a restriction to the script, so that the spell is casted only one time and no more, you can do this with a Bool.
Spell Property MySummonSpell01 Auto
Bool Property isCasted = False Auto Hidden
 
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If (aeCombatState == 1)
      If ( isCasted == False )
           isCasted = True
           MySummonSpell01.Cast(Self, Self)
   EndIf
EndIf
ENDEVENT
Now, if you want the script above to go into a 'inactive' state, to not fire at all again or to process anything anymore.
Spell Property MySummonSpell01 Auto
Bool Property isCasted = False Auto Hidden
 
AUTO STATE WaitingCombat
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If (aeCombatState == 1)
       If ( isCasted == False )
            isCasted = True
            MySummonSpell01.Cast(Self, Self)
            GoToState("AllDone")
   EndIf
EndIf
ENDEVENT
ENDSTATE
 
STATE AllDone
ENDSTATE
Now, if you want to the script above to make it reusable and to ensure that only one cast of the spell will be done per combat, then you do something like this.
Spell Property MySummonSpell01 Auto
Bool Property isCasted = False Auto Hidden
 
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If (aeCombatState == 1)
       If ( isCasted == False )
            isCasted = True
            MySummonSpell01.Cast(Self, Self)
   EndIf
ElseIf (aeCombatState == 0)
        isCasted = False
EndIf
ENDEVENT

 

I don't know why your actor is casting twice, it could be a number of reasons, and I don't have all the necessary data to pinpoint the issue.

Edited by maxarturo
Link to comment
Share on other sites

Wow that's a lot of stuff I never knew lmao.

 

It looks like the very last script is probably what I need.

I was thinking there might be some kinda hardcoded thing that hits the state==1 when entering and leaving combat or something (thus the reason i thought it might be unfixable). But either way the last script should prevent it from summoning again when sheathing his sword, at least from my understanding.

I will get this implemented and tested this evening :smile:

Not that it needs tested lol... Everything you've helped me with so far has worked FLAWLESSLY. Thank you so much, I really, really appreciate all the help!

Edited by saintgrimm92
Link to comment
Share on other sites

If you will be using the last script, you can add to it one more 'fail safe', just to be sure that your issue won't happen again, by dividing the script into 'States', which each state is responsible in handling only the combat state the actor is in.

- The first 'State' (SEQ01) will be handling ONLY the > aeCombatState == 1.

- After firing > aeCombatState == 1, the script will jump to SEQ02 waiting to execute ONLY > aeCombatState == 0.

- And when aeCombatState == 0 is completed, it will return to SEQ01 to wait to execute again > aeCombatState == 1.

- And this goes on and on forever....



Spell Property MySummonSpell01 Auto
Bool Property isCasted = False Auto Hidden

AUTO STATE SEQ01
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
If (aeCombatState == 1)
If ( isCasted == False )
isCasted = True
MySummonSpell01.Cast(Self, Self)
GoToState("SEQ02")
EndIf
EndIf
ENDEVENT
ENDSTATE

STATE SEQ02
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
If (aeCombatState == 0)
isCasted = False
GoToState("SEQ01')
EndIf
ENDEVENT
ENDSTATE

Edited by maxarturo
Link to comment
Share on other sites

Pretty neat approach to doing it. If you wanted it more immersive, you could make them visually (animations) cast the summon if you assign their actorbase an AIPack with UseMagic. They dont need to have the spell here either to cast it, and I dare say the whole deal could likely be pulled off without scripts. Though there might be an aspect or two where scripts could still be a good idea

Link to comment
Share on other sites

Pretty neat approach to doing it. If you wanted it more immersive, you could make them visually (animations) cast the summon if you assign their actorbase an AIPack with UseMagic. They dont need to have the spell here either to cast it, and I dare say the whole deal could likely be pulled off without scripts. Though there might be an aspect or two where scripts could still be a good idea

 

I WAS going to do AI package, but my understanding of that is it would make him unequip his shield/2h sword, which I didn't want. I use AI packages on other NPCs, but they're also different. I know there's more than 1 NPC, but the only thing coming to mind right now is a boss that uses an AI package to summon a mini-boss during a scene. But he's a magic-based NPC and doesn't have gear to remove in order to equip the spell for the animation.

 

If there was a cool animation for the 2h version to hold his sword in 1 hand then cast and go back to normal 2h anims, or the other variation to do the animation while still holding his shield, that'd be perfection, but if there's one thing I know for a fact I can't do, it's making new animations lol.

 

The way it is currently, I don't think it looks bad or anything. If it was any spell other than a summon, I probably wouldn't like it, for example, if a fireball just flew out of him instead of being cast, that would probably bother me. But just being a summon, with no projectile or anything, it looks pretty cool for the summonfx to play while he's unsheathing his sword, in my opinion at least lol.

 

 

If you will be using the last script, you can add to it one more 'fail safe', just to be sure that your issue won't happen again, by dividing the script into 'States', which each state is responsible in handling only the combat state the actor is in.
- The first 'State' (SEQ01) will be handling ONLY the > aeCombatState == 1.
- After firing > aeCombatState == 1, the script will jump to SEQ02 waiting to execute ONLY > aeCombatState == 0.
- And when aeCombatState == 0 is completed, it will return to SEQ01 to wait to execute again > aeCombatState == 1.
- And this goes on and on forever....
Spell Property MySummonSpell01 Auto
Bool Property isCasted = False Auto Hidden
 
AUTO STATE SEQ01
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If (aeCombatState == 1)
       If ( isCasted == False )
            isCasted = True
            MySummonSpell01.Cast(Self, Self)
            GoToState("SEQ02")
   EndIf
EndIf
ENDEVENT
ENDSTATE
 
STATE SEQ02
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If (aeCombatState == 0)
        isCasted = False
        GoToState("SEQ01')
EndIf
ENDEVENT
ENDSTATE

 

 

I haven't even gotten around to testing the first one yet, started making my merchant NPCs and wanted to get that finished first lol. But a 2nd failsafe couldn't possibly hurt, I'll add this in :)

 

 

Link to comment
Share on other sites

 

If you will be using the last script, you can add to it one more 'fail safe', just to be sure that your issue won't happen again, by dividing the script into 'States', which each state is responsible in handling only the combat state the actor is in.
- The first 'State' (SEQ01) will be handling ONLY the > aeCombatState == 1.
- After firing > aeCombatState == 1, the script will jump to SEQ02 waiting to execute ONLY > aeCombatState == 0.
- And when aeCombatState == 0 is completed, it will return to SEQ01 to wait to execute again > aeCombatState == 1.
- And this goes on and on forever....
Spell Property MySummonSpell01 Auto
Bool Property isCasted = False Auto Hidden
 
AUTO STATE SEQ01
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If (aeCombatState == 1)
       If ( isCasted == False )
            isCasted = True
            MySummonSpell01.Cast(Self, Self)
            GoToState("SEQ02")
   EndIf
EndIf
ENDEVENT
ENDSTATE
 
STATE SEQ02
EVENT OnCombatStateChanged(Actor akTarget, int aeCombatState)
    If (aeCombatState == 0)
        isCasted = False
        GoToState("SEQ01')
EndIf
ENDEVENT
ENDSTATE

 

 

I couldn't get this script to compile, and I can't figure out where the issue is. All it says is:

mismatched character '\r' expecting '"

missing RPAREN at '\\n'

 

I have no idea how to decipher that. When it says something like "StopSneaking is not a function" I can easily know where the issue is. There is no '\r' or '\\n' in the script so I have no idea what it's talking about.

 

I switched it back to the original without the states and it works perfectly, so I'll just leave it with 1 failsafe with the iscasted true/false without having states. That seems to be enough to get him not to cast on combat end.

 

My vamplord was also landing and then immediately floating again at end of combat, I assume just like this NPC was re-casting summon. I was able to fix that the same way, without the states, just the iscasted true/false lines.

Edited by saintgrimm92
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...