Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[Script] Spell casts have a chance to trigger other effects.


DICE
 Share

Recommended Posts

I wanted to create a perk which refunds a little mana sometimes once I cast my destruction spells, I got help in Nexus forum by Sjogga (he is author of Psijic teleport spells!) who provided me the initial script to get me started. And I did get it to work and I'm very pleased of how it works! I also figured out how to restore 'flat' magicka and make it scale by level, so I will post both 2 versions here.

 

I want to thank Sjogga again for helping me out in the other forum! I didn't just want that thread to die there, and be forgotten. Instead I decided to post here what I have learned, as it might be useful to new Creation Kit users (just as myself) that are in need of a similar result :)

 

1. Create the perk.

2. Create the spell you want to trigger (or skip this step if you want to use the second script)

3. Create a Formlist of spells, which should trigger the perk.

4. Create a new quest, click on 'Quest Aliases' tab. Add the alias, set the 'Player' as reference, attach one of the scripts. And fill in the properties.

5. Open your perk again, add this quest as Perk Entry

6. Add the perk to your skill tree

 

Note: Don't forget to set Perk Property when adding the script in Quest Aliases, or your new effect will start proccing even if you haven't picked the Perk up at the skill tree in-game. It's the only way I found to stop it from happening, I tried to add a condition to Alias but it did not work.

 

 

 

CastChanceProcSpell

This one will proc a magic effect / spell when you cast your spells in-game has 30% chance.

Scriptname CastChanceProcSpell extends ReferenceAlias
{Gives spell casts a chance to trigger an additional effect}

Spell Property MagickaRegenSpell Auto
FormList Property TriggerSpells Auto
VisualEffect Property FX Auto
Perk Property SelectPerk Auto

Event OnSpellCast(Form akSpell)
If (Game.GetPlayer().HasPerk(SelectPerk))
    
    If(TriggerSpells.hasForm(akSpell))

        Int Chance = Utility.RandomInt(1,100)
        If(Chance <= 30)
            MagickaRegenSpell.cast(game.getPlayer())
            FX.Play(game.getPlayer())
        EndIf
        
    EndIf
EndIf
EndEvent

CastChanceProcFixed

This one will give your spells a chance to restore a flat amount magicka, health or stamina which also scale by level (by 1) and got a 30% chance of happening.

Scriptname CastChanceProcFixed extends ReferenceAlias
{Gives spell casts a chance to trigger an additional effect}

FormList Property TriggerSpells Auto
VisualEffect Property FX Auto
Float Property MagickaAmount Auto
Perk Property SelectPerk Auto

Event OnSpellCast(Form akSpell)
If (Game.GetPlayer().HasPerk(SelectPerk))
    
    If(TriggerSpells.hasForm(akSpell))

        Int Chance = Utility.RandomInt(1,100)
        If(Chance <= 30)
        Float MagickaReplenished = MagickaAmount+(Game.GetPlayer().GetLevel())
        Game.GetPlayer().RestoreActorValue("Magicka",MagickaReplenished)
            FX.Play(game.getPlayer())
        EndIf
        
    EndIf
EndIf
EndEvent
Edited by DICE
  • Upvote 1
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...