Enter Skyrim

Enter Skyrim
Skyrim Mages College

Wednesday, July 7, 2021

Working Bath script...

 

 A Skyrim Code:

 ScriptName DefaultCastAtLinkOnTriggerSCRIPT extends objectReference
; M7WorkBathTriggerScript


{Configurable Custom Script.  Be default: when triggered, it will cast the spell from a linked ref at the triggering actor}

Message Property Effect Auto ; uncheck MessageBox
bool property playerOnly auto
{if true, only works on the player}
bool property doOnce auto
{fire multiple times?}
float property delayBetween auto
{seconds to wait between shots.  Only relevant if doOnce == false}
spell property mySpell auto
{spell to cast onTriggerEnter}
auto STATE active
    EVENT onTriggerEnter(ObjectReference actronaut)
        if playerOnly == true && actronaut == game.getPlayer() || playerOnly == false
            mySpell.Cast(getLinkedRef(), actronaut)
                        Effect.Show()
            gotoState ("inactive")  ; don't cast subsequent spells until told to do so
            if doOnce == true
                ; and don't come back!
            else
                utility.wait(delayBetween)
                gotoState("active")
            endif
        endif
    endEVENT
endSTATE
STATE inactive
    ; nothing happens here.
endSTATE

; defaultCastAtLinkOnTriggerSCRIPT



This script will cast the specified spell from the trigger's linked ref at the triggering actor. This only works for trigger-boxes! i.e. a trap that casts spells at you from a stone (linked ref, any static item) when you enter the area. 


If doOnce is not checked it will cast multiple times or every time you enter it.


Add  a static item in the pool (item like a block in the perimeter of the pool or stone parts) with a reference on top, on the Trigger Box select Linked Ref with the Cell it appears in and the Reference of the object on the perimeter of the pool to cast the spell from.  


This is used for a Healing Pool effect.  


1.    Make an Activator ID.  Do not add a name or anything.  Select color of Primitive. Save.
2.    In render window, select an object to cast spell from (near or along pool).  Add a reference ID.
3.    Make a Spell: AlchFortifyHealRate 30% - for 1 Day.  
4.    Add Script to Activator.  (M7WorkBathTriggerScript).  Select Properties – Spell, MessageBox, Player Only.  Leave DelayBetween and DoOnce cleared.
5.    On Pool, select object and press Trigger Cube (T in Cube) button.  Select Activator from drop down menu.  Arrange trigger box to size.  Double click Triggerbox , select LinkedRef and select object’s Reference and Location (no keyword).  Save.  Exit Skyrim and reenter.
6.    Make a Message (uncheck Message Box), “You feel cleaner from the healing Pool.” Attach to properties on Activator.
7.    If DoOnce is checked you only receive spell once. If left unchecked you will be healed each time you enter the pool.  Player Only will affect only the Player.  The object selected will cast the spell on the Player; it may be a Static item like a rock, endpost, or statue element of the pool.  Add a description to healing spell.
8.    Save and Test in game.  © M7 2017.  



No comments:

Post a Comment