Jump to content

[LE] Papyrus Script Help


Xanatos32

Recommended Posts

Hey, for a beginner script tutorial check out this one: http://www.cipscis.com/skyrim/tutorials/beginners.aspx

 

For detecting shouts, you can use an animation event like so:

Container Property MyChest Auto 

Event OnInit() ;event runs when this script is first loaded into the game
    RegisterForAnimationEvent(Game.GetPlayer(), "BeginCastVoice") ;register for when the player uses the BeginCastVoice animation.
    
EndEvent 

Event OnAnimationEvent(ObjectReference akSource, String asEventName) 
    If akSource == Game.GetPlayer() && asEventName == "BeginCastVoice" ;this condition is only necessarry if registering multiple animation events. 
        Game.GetPlayer().PlaceAtMe(MyChest) ;place a new chest at the player
    Endif
EndEvent

Here's all the animation events you can use: https://www.creationkit.com/index.php?title=Animation_Events

 

Lessor powers would be more difficult because I don't think they use the shout animation. You could use the OnSpellCast event, and then detect the type of spell with the skse function GetEquipType()

Link to comment
Share on other sites

Hey, for a beginner script tutorial check out this one: http://www.cipscis.com/skyrim/tutorials/beginners.aspx

 

For detecting shouts, you can use an animation event like so:

Container Property MyChest Auto 

Event OnInit() ;event runs when this script is first loaded into the game
    RegisterForAnimationEvent(Game.GetPlayer(), "BeginCastVoice") ;register for when the player uses the BeginCastVoice animation.
    
EndEvent 

Event OnAnimationEvent(ObjectReference akSource, String asEventName) 
    If akSource == Game.GetPlayer() && asEventName == "BeginCastVoice" ;this condition is only necessarry if registering multiple animation events. 
        Game.GetPlayer().PlaceAtMe(MyChest) ;place a new chest at the player
    Endif
EndEvent

Here's all the animation events you can use: https://www.creationkit.com/index.php?title=Animation_Events

 

Lessor powers would be more difficult because I don't think they use the shout animation. You could use the OnSpellCast event, and then detect the type of spell with the skse function GetEquipType()

What about if I do it as ActiveMagicEffect, I use a spell like frost rune to stay on the ground like a mark and I want the chest to appear in that rune ? also is there anyway to make it randomized ? be different chests ? say I have several chests as a reward for doing this and I want them to be randomly selected, how that would work exactly ?

Link to comment
Share on other sites

Ah, if you want to make a spell that spawns a random chest, I would put a script like this on its magic effect:

 

Formlist Property MyChests Auto ;filled with chests you want to spawn

Event OnEffectStart(Actor akTarget, Actor akCaster) 
    Int MaxEntry = MyChests.GetSize() - 1 
    Int RandomIndex = Utility.RandomInt(0, MaxEntry) 
    ObjectReference Chest = akCaster.PlaceAtMe(MyChests.GetAt(RandomIndex), 1, false, true) ;place a random chest at the actor, initially disabled. 
    
    float A = akCaster.GetAngleZ()
    Float XDist = math.Sin(A)
    Float YDist = Math.Cos(A)
    XDist *= 150
    YDist *= 150
    
    Chest.MoveTo(akCaster, XDist, YDist, 20, true) ;move the chest 150 units in front of the caster 
    Chest.SetAngle(0,0,0) ;level out the chest
    Chest.Enable() ;enable the chest, making it visable.
EndEvent

Make sure the spell is fire and forget, casted on self so the magic effect actually starts when you cast the spell.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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