A simple question about traps!

Post » Wed Jun 20, 2012 10:40 pm

I want to make a small trap. I'll make a cabinet that will only open with a key and when the player opened it, had taken a shock that left him nearly dead (For example, any type of race and skills, the player had lost 70% of your life).

It has to do this? Make some kind of animation too, like: leading shock?
I want a trap that will directly affect the life of the character, without the slightest chance to escape!

Thank you!
User avatar
Suzie Dalziel
 
Posts: 3443
Joined: Thu Jun 15, 2006 8:19 pm

Post » Wed Jun 20, 2012 6:10 pm

You could adapt this script...use Sparks for the visible effect.http://www.creationkit.com/GetBaseActorValue_-_Actor andhttp://www.creationkit.com/DamageActorValue_-_Actor by a specific amount can be done with the Action Value functions (For which, check the Wiki links.)

Scriptname SpellZapScript 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
User avatar
Darren Chandler
 
Posts: 3361
Joined: Mon Jun 25, 2007 9:03 am

Post » Wed Jun 20, 2012 10:07 pm

Hey men, where i put this code? In the book, of corse, but how? Thx
User avatar
BRAD MONTGOMERY
 
Posts: 3354
Joined: Mon Nov 19, 2007 10:43 pm

Post » Wed Jun 20, 2012 11:37 am

Book? I thought you said it was a cabinet? Well it's easiest to put a script on something that normally can't have a direct script on it if you make it a quest alias, you can then hang the script right on the alias. Otherwise, you can make it an activator. Books (like activators) can have scripts directly on them. Just make a copy of any book item, edit it however you want to have whatever text you want, then just attach that script in the script attach area.
User avatar
Wayne Cole
 
Posts: 3369
Joined: Sat May 26, 2007 5:22 am

Post » Wed Jun 20, 2012 7:50 pm

sorry dude, is in the cabinet indeed, my mistake. I gonna check here if works!
User avatar
BethanyRhain
 
Posts: 3434
Joined: Wed Oct 11, 2006 9:50 am


Return to V - Skyrim