Xanatos32 Posted August 10, 2021 Share Posted August 10, 2021 Hello everyone, first time posting here, I wanted to learn a little bit about Papyrus Scripting and I was trying to do a simple mod that after you shout or you use a lesser spell it spawns a chest, any idea how to make that happen ? I can't seem to figure it outthrough the documentation in creationkit.com thanks ! Link to comment Share on other sites More sharing options...
dylbill Posted August 10, 2021 Share Posted August 10, 2021 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 EndEventHere'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 More sharing options...
Xanatos32 Posted August 10, 2021 Author Share Posted August 10, 2021 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 EndEventHere'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 More sharing options...
dylbill Posted August 11, 2021 Share Posted August 11, 2021 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. EndEventMake 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 More sharing options...
Recommended Posts