Jump to content

[LE] How to script addiction without SKSE?


Recommended Posts

Hey guys :smile:
I'm working on a mod where I need to script an addiction in SSE, without using SKSE (because I am making it for both PC and XBox, and SKSE is not available on XBox). It's for a mod I'm working on called Stormbringer, based on Elric stories by Michael Moorcock.
The Stormbringer sword should cause something like an addiction, so when you're not using it for a day then you have debuffs or similar to health and stamina, and when you are using it these stats could increase somewhat too. I've seen many addiction mods, but they all seem to require SKSE. The closest I've found without needing SKSE were survival based mods where you start to get sick when you've been in cold weather too long, or haven't eaten for awhile, that sort of thing.
I am new to scripting though, so I was wondering if anyone could give me some tips on this?

Thanks guys, have a good one :smile:
Link to comment
Share on other sites

Hey, this shouldn't require skse and isn't too difficult. The way I would do it, is when the sword is equipped, it adds a spell ability to the actor that equipped the sword that buffs the stats you want. When the sword is unequipped, it removes the buff and adds an addiction start spell ability that updates in 24 game hours. In the onUpdate, it casts the actual addiction spell on the target. Here's some scripts to get you started:

 

Scriptname StormBringerScript extends ObjectReference 

;Attach this script to your sword 

Spell Property AddictionAbility Auto
Spell Property BuffAbility Auto

Event OnEquipped(Actor akActor)
    akActor.RemoveSpell(AddictionAbility) 
    akActor.AddSpell(BuffAbility)
EndEvent

Event OnUnequipped(Actor akActor)
    akActor.AddSpell(AddictionAbility)
    akActor.RemoveSpell(BuffAbility) 
EndEvent 

And then:

Scriptname StormBringerAbilityScript extends ActiveMagicEffect 

;this script is on the AddictionAbility's magic effect 

Spell Property AddictionAbility Auto ;Ability Spell

Spell Property AddictionSpell Auto 
;the actual de - buff spell with a duration. 
;Put the condition IsEquipped Stormbringer == 0 on the spell

Actor Target

Event OnEffectStart(Actor akTarget, Actor akCaster) 
    Target = akTarget ;save akTarget for use in update event
    RegisterForSingleUpdateGameTime(24) ;updates in 24 game hours 
EndEvent 

Event OnUpdateGameTime()
    AddictionSpell.Cast(Target, Target) ;Target casts the addiction spell on himself 
    Utility.Wait(1)
    Target.RemoveSpell(AddictionAbility) ;Remove ability from target
EndEvent 

Event OnEffectFinish(Actor akTarget, Actor akCaster)
    Target.RemoveSpell(AddictionAbility) ;Remove ability from target
EndEvent

Don't forget to fill the properties after compiling and attaching your scripts.

Edited by dylbill
Link to comment
Share on other sites

Awesome, thanks so much Dylbill :smile:

I will definitely get to work with these. Now I'm a complete noob with scripting :smile: so are these the properties you mentioned or do you know of a better reference for them?
https://www.creationkit.com/index.php?title=Property_Reference

 

Or here, there is a part about halfway down about setting Properties
https://www.creationkit.com/index.php?title=Papyrus_Introduction

 

Thanks again :smile:

Edited by anathemastudio
Link to comment
Share on other sites

No problem, the second link is a better reference. What I mean is for instance, in the scripts I posted above there is Spell Property AddictionAbility Auto. The script doesn't know what that is by itself. So after compiling the script and attaching it to a form in the creation kit, you then highlight the script, click on the Properties tab, click on the property and then Edit Value. You'll get a drop down list where you choose the form in the CK. An easier way too is if you name the property the exact same in your script as it is in the CK, you can click on Auto Fill All in the properties tab and your properties will be automatically set.

 

Another thought. If you don't want your addiction to have a duration, you can make it an ability and use Target.Addspell(AddictionSpell) instead of using Cast. Then when you equip the sword use Target.RemoveSpell(AddictionSpell). That way the de-buff will last until you equip the sword again. You could also add another way to cure the addiction and again use Target.RemoveSpell(AddictionSpell). Hope that helps :smile:

 

Edit: Oh and for compiling scripts I use Skyrim Script Compiler Pro: https://www.nexusmods.com/skyrimspecialedition/mods/31700/

It pretty much works out of the box. Happy Modding!

Edited by dylbill
Link to comment
Share on other sites

  • Recently Browsing   0 members

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