Jump to content

I need help making a script for a multiple summons spell


LordChenzi

Recommended Posts

i have tried to contact xilver to teach me via personal conversation but it said he/she was not accepting any messages

 

i need help making a script that lets me summon multiple npcs for one spell not all spells just one kind of like the same properties of midas spider horde but instead of spiders im using gnomes i have been doing research for 2 days on how i could try to recreate this particular script and i finally decided to come here where the pros are after asking everyone on steam

 

can some one please help me out

 

EDIT: yes this is for skyrim

Edited by LordChenzi
Link to comment
Share on other sites

This is ultra basic, absolutely no frills, but should summon 5 NPC's at once. I haven't tested compiling or running it mind you. It should serve as a starting point for a more advanced script.

 

The script could be upgraded to use an array to summon a variable number of NPC's, and some summoning effects could be added as well for more impact.

 

 

Scriptname SummonNPCLegionScript extends ActiveMagicEffect  
{A VERY BASIC NO FRILLS script to summons 5 NPC's of ActorBase "NPCType"}

ActorBase Property NPCType AUTO

ObjectReference NPC1
ObjectReference NPC2
ObjectReference NPC3
ObjectReference NPC4
ObjectReference NPC5

Event OnEffectStart(Actor akTarget, Actor akCaster)
NPC1 = Game.GetPlayer().PlaceAtMe(NPCType)
NPC2 = Game.GetPlayer().PlaceAtMe(NPCType)
NPC3 = Game.GetPlayer().PlaceAtMe(NPCType)
NPC4 = Game.GetPlayer().PlaceAtMe(NPCType)
NPC5 = Game.GetPlayer().PlaceAtMe(NPCType)
EndEvent


Event OnEffectFinish(Actor akTarget, Actor akCaster)
NPC1.DisableNoWait()
NPC2.DisableNoWait()
NPC3.DisableNoWait()
NPC4.DisableNoWait()
NPC5.DisableNoWait()
EndEvent

 

 

EDIT: The script compiles OK.

Edited by steve40
Link to comment
Share on other sites

Here's a more sophisticated script that can summon up to 10 NPCs and has optional shader Fx and summoning explosion effect.

Again, this script is untested and may need tweaking, I'll test it tonight if I get a chance (I have some other modding stuff to do first).

 

 

Scriptname SummonNPCLegionScript extends ActiveMagicEffect
{Summons up to 10 NPC's of ActorBase "NPCType"}

;*********************************************************
;	PROPERTIES TO BE ASSIGNED IN THE CK
;********************************************************* 

ActorBase Property NPCType AUTO		; the type of NPC to summon
Int Property SizeOfLegion = 10 auto	; the number of NPCs to summon (DEFAULT=10)
Explosion Property AppearExplosion AUTO	; the summon explosion FX to use (OPTIONAL)
EffectShader Property Shader AUTO	; the shader to apply to the NPC when summoned (OPTIONAL)

;********************************************************* 

ObjectReference[] NPC	; an array to reference the summoned NPC's

;********************************************************* 

Event onEffectStart(Actor akTarget, Actor akCaster)

NPC = new ObjectReference[10] 		; arrays must be created within a function or event block

If SizeOfLegion > NPC.Length
	SizeOfLegion = NPC.Length	; just for safety
EndIf

int count = 0

While count < SizeOfLegion

	NPC[count] = Game.GetPlayer().PlaceAtMe(NPCType)

	If AppearExplosion
		NPC[count].PlaceAtMe(AppearExplosion)
	EndIf

;		NPC[count].Enable()		; use this if your NPC is initially disabled

	If Shader
		Shader.Play(NPC[count], 2)
	EndIf

	count += 1

EndWhile

EndEvent

;********************************************************* 

Event OnEffectFinish(Actor akTarget, Actor akCaster)

int count = 0

While count < SizeOfLegion

	If Shader
		Shader.Play(NPC[count], 2)
	EndIf

	If AppearExplosion
		NPC[count].PlaceAtMe(AppearExplosion)
	EndIf

	NPC[count].DisableNoWait()
	count += 1

EndWhile

EndEvent

;********************************************************* 

 

 

EDIT: I fixed a couple of small typos in the script. It compiles OK.

Edited by steve40
Link to comment
Share on other sites

last question before i go can i apply the script to a spell?

 

Yes, of course. That was the whole point.

Create a MagicEffect of Archetype "Script" and delivery method "Self". Attach your script to it and configure the properties.

Create a new spell (also delivery method "Self") and add your scripted MagicEffect to it.

 

I have a working demo (using skeevers) that I could post on the weekend. I'm still tweaking the summoning effects etc. The way the spell works at the moment is that summoned npc corpses only disappear when the spell duration expires. If you want the corpses to disappear immediately when the npc dies, you'd have to put an extra script on your gnomes. Actually it's kinda cool having the corpses lie around for a bit then all of them suddenly disappear simultaneously with an "explosion" effect :biggrin:

 

A cooler version of the spell might be to have the number of summoned creatures depend on how long you hold the mouse button before casting, so the longer you hold it, the more creatures are summoned and the more magicka it costs. Not sure if this is possible in CK or not. I think it should be possible because shouts work sort of like that.

Link to comment
Share on other sites

How does Skyrim handle PlaceAtMe and potential savegame bloat? In Oblivion, multiple summon spells used MoveTo Player instead of PlaceAtMe because of this issue. But it may be that the architecture of Skyrim is better in this respect and does not have this problem.
Link to comment
Share on other sites

How does Skyrim handle PlaceAtMe and potential savegame bloat? In Oblivion, multiple summon spells used MoveTo Player instead of PlaceAtMe because of this issue. But it may be that the architecture of Skyrim is better in this respect and does not have this problem.

 

PlaceAtMe places a (new) non-persistent reference by default. MoveTo does not create a new reference.

Edited by steve40
Link to comment
Share on other sites

There's potential to make this spell more sophisticated. For example, randomizing the type of creature that is summoned, giving each creature random stats etc. You could make the array larger (up to 256) if you want more creatures. The array is not strictly necessary, because PlaceAtMe let's you specify how many references to create. However, the array is usefull for allowing me to position individual explosion effects at each creature summoned.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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