Jump to content

Need help learning to make a script for my mod


Recommended Posts

I recently posted a mod. Cool Drugs https://www.nexusmods.com/skyrimspecialedition/mods/116356?tab=description I originally planned for it to just be a private mod I made for fun, but it expanded into something much bigger that I still want to try and add more to.

I'm somewhat knowledgeable about Oblivion's scripting, but this is my first try at attempting scripting for Skyrim, and it looks kind of different to me. Basically, I want to try and add a script to the drugs added in the mod so you can have a random chance to gain addictions (like in Fallout) that only apply negative effects when off the drug. I'm guessing from my limited knowledge that this can be done by applying a script that randomly decides to apply the addiction when the effects of the drug wear off and also detects if you already have the addiction and temporarily removes it until the drug effect wears off if you already have the addiction.

I would definitely appreciate some help with how I can make a script like this. Also, I want to make bandits or any other enemies that spawn with any of the drugs have a random chance of using them in combat, which I'm guessing could be way easier. I'd still like to hear any pointers on how to do that, but I have a feeling I could figure that one out on my own more easily.

Link to comment
Share on other sites

From what I understand, scripting in oblivion vs scripting in skyrim is pretty different. I'd recommend reading through this section of the papyrus wiki: 

https://ck.uesp.net/wiki/Differences_from_Previous_Scripting 

For what you want to do, you'd attach a script to the magic effect used in your drug (potion) with an OnEffectStart and OnEffectFinish event to handle the addiction. 

A very simple example would be something like this: 

Scriptname DrugAddictionScript extends ActiveMagicEffect

Spell Property AddictionSpell Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
    If akTarget.HasSpell(AddictionSpell)
        akTarget.RemoveSpell(AddictionSpell)
    Endif
EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
    akTarget.AddSpell(AddictionSpell)
EndEvent

 

Also here's a good video series on scripting for skyrim if interested. 

 

  • Thanks 1
Link to comment
Share on other sites

Ah, thanks. I'll look into those whenever I decide to give the scripting portion of my mod a try again. As of right now, I decided to take a bit of a break from it today, mostly. I couldn't help myself from doing a little thinking.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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