Custom Generic Summon Script

Post » Sat May 28, 2011 3:54 am

I want to create a generic custom summon that can be used by any NPC or spell casting creature (like the Summon Skeleton spell in Vanilla Oblivion). Getting them to cast it won't be a problem (I'll just give them a Begin onstartCombat type script). I have the creatures I want to summon already made and placed in a Leveled List, I just need a script that can be used by multiple NPCs (and/or creatures) at the same time. In the mod I'm working on, it's possible (and quite likely) that you'll end up fighting multiple enemies simultaneously that can cast this spell, so the script needs to be as general as possible to allow multiple casters to cast it at once. I'm guessing I'll need to use PlaceAtMe after calling a visual effect. The only problem is, I don't know what this script should actually look like. Any help would be appreciated.
User avatar
Emerald Dreams
 
Posts: 3376
Joined: Sun Jan 07, 2007 2:52 pm

Post » Sat May 28, 2011 5:37 am

Something like
ref sumnref actorref targetshort oncebegin scripteffectstartset actor to getselfset target to actor.getcombattargetset sumn to actor.placeatme endbegin scripteffectupdateif once == 0sumn.stopcombatsumn.PlayMagicEffectVisuals ZSKE ;; skeleton summon visualssumn.moddisposition actor 100sumn.moddisposition target -100set once to 1elseif once == 1if sumn.getdead == 1sumn.removemeset once to 2endifendifendBegin scripteffectfinishif once != 0sumn.removemeendifend


Should work. You should use a leveled list instead of a direct form to ensure that the actor gets completely cleared from memory as soon as the cell resets, and requires the actor to have a no low processing.
User avatar
Rob Davidson
 
Posts: 3422
Joined: Thu Aug 02, 2007 2:52 am

Post » Fri May 27, 2011 9:39 pm

Something like
*snip*


Should work. You should use a leveled list instead of a direct form to ensure that the actor gets completely cleared from memory as soon as the cell resets, and requires the actor to have a no low processing.

Thanks! I'll try that out and see how it works. However, I'm curious about the sumn.removeme part. According to the CS Wiki,
RemoveMe removes the calling object from the inventory of the container that it is in (if applicable). If TargetContainerID is specified, the object is moved to the target container.
Will that work since Sumn, in this case, is an actor? And will I need it since it will be cleared from memory as soon as the cell resets?
User avatar
Lyd
 
Posts: 3335
Joined: Sat Aug 26, 2006 2:56 pm

Post » Sat May 28, 2011 12:20 am

However, I'm curious about the sumn.removeme part. According to the CS Wiki, Will that work since Sumn, in this case, is an actor? And will I need it since it will be cleared from memory as soon as the cell resets?

removeme works on actors as well as objects as a means of removing the calling reference directly, and is a better choice than disable when that specific instance will no longer be used for anything afterward. Cell resets are not always predictable as people change their reset timers, but works as a catch-all incase some bit of data was left over from the summon.
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am


Return to IV - Oblivion