Magic caster trap creation

Post » Wed Jun 20, 2012 2:02 am

Can someone please tell me how to make a magic caster (fire) trap soul gem? One that fires at a time interval and one that fires when the player is in a trigger box?

Thank you
Joe
User avatar
Tom
 
Posts: 3463
Joined: Sun Aug 05, 2007 7:39 pm

Post » Wed Jun 20, 2012 10:12 am

You could adapt this script:

Scriptname LightningSpoke extends ObjectReference  import UtilityFloat Property xOffset  Auto  {Relative X position for the target}Float Property yOffset  Auto  {Y Offset for Target}Float Property zOffset  Auto  {Z offset for Target}Float Property RandomOffsetX = 0.0 Auto{Randomness applied to X Offset}Float Property RandomOffsetY = 0.0 Auto{Randomness applied to X Offset}Float Property RandomOffsetZ = 0.0 Auto{Randomness applied to X Offset}Float Property PulseRate = 1.0 Auto  {How often do we shoot the other node?}Float Property RandomRate = 0.0 Auto{Add random delay to pulse rate, capped at this value}Activator Property TargetType  Auto  {What type of object are we zapping if we're spawning a node?}ObjectReference Property CurrentTarget  Auto  {The actual target we're shooting at}Bool Property SpawnNode  Auto  {Do we spawn a target? If not, zap the nearest Actor.}Spell Property Zap Auto{What spell shall we use for the effect?}FormList Property TargetTypeList Auto{List of potential targets}Event OnInit()    if SpawnNode && !CurrentTarget        CurrentTarget = PlaceAtme(TargetType,1)        CurrentTarget.MoveTo(Self,XOffSet,YOffSet,ZOffSet)    endif    RegisterForSingleUpdate(PulseRate)EndEventEvent OnUpdate()    if !SpawnNode        CurrentTarget = Game.FindClosestReferenceOfAnyTypeInListfromRef(TargetTypeList,Self,1000.0) ; find an actor to shoot at    else        CurrentTarget.MoveTo(Self, XOffSet+(RandomFloat(0.0,RandomOffsetX)-RandomOffsetX/2 ), \            YOffSet+(RandomFloat(0.0,RandomOffsetY)-RandomOffsetY/2), \            ZOffSet+(RandomFloat(0.0,RandomOffsetZ)-RandomOffsetZ/2))    endif    Zap.Cast(Self,CurrentTarget)    RegisterForSingleUpdate(PulseRate+RandomFloat(0.0,RandomRate))EndEvent

Set the Spell property Zap to what spell you want to use, set the spawn boolean to "True", and pick X, Y, and Z offsets to set what direction and distance you want to zap, and a frequency to determine how often it shoots. As a bonus, if you move the activator in game, the target will move to the same relative position...this would allow you to make "Curtains" of whatever spell that you can move to the side to allow the player through, then close behind him.

To Trigger it, you would just give it an activateparent of the trigger box, and turn RegisterForUpdate on and off from that, and take the update register out of the OnInit event..
User avatar
Avril Louise
 
Posts: 3408
Joined: Thu Jun 15, 2006 10:37 pm

Post » Wed Jun 20, 2012 11:45 am

Thanks! Now I have fireball shooting pillars in my dungeon!
User avatar
Jesus Lopez
 
Posts: 3508
Joined: Thu Aug 16, 2007 10:16 pm


Return to V - Skyrim