Jump to content

Making a Growth Spell Mod - How could I accomplish this?


Recommended Posts

Posted

I'm interested in learning how to make custom spells and one I'd like to make is a growth (Breast, butt, thighs, etc.) spell. I think I'd need cbbe and racemenu as masters, but beyond that I haven't a clue as to how to achieve this idea. I have very little experience coding being that the only languages I know are Javascript and PHP. I have some experience tinkering in CK, but not a lot. If anyone could provide some help on where I could learn how to do this or anyone could tell me how it'd be greatly appreciated : )

Posted (edited)

So, I was in a similar place to you (I'd tinkered in TES5Edit, and knew how to code but not in Papyrus) when I started modding.

Here's your most important link- the UESP CK Wiki. I'd recommend starting by working through the Quest Design Fundamentals tutorial. It might not seem relevant to what you're trying to do, but it introduces several concepts that will be really helpful to understand later.

 

Once you've done that, futz about on there until you can make a projectile Spell that applies a custom Magic Effect. Your endgame is a magic effect with a Script Archetype.

 

In that script, you'll need an Event (which should be something you were slightly introduced to in the quest tutorial)- in particular, the OnEffectStart event. That'll basically be where you define the function that gets run on the actor affected by the spell. I'd suggest starting with a simple

debug.messagebox("The spell just hit: " + akTarget.GetActorBase().GetName())

just to establish that the spell script is working.

 

 

Once you've got a spell that can successfully apply a script to an actor, you need to add in the code to apply morphs. The first thing you need to do is to get the NiOveride scripts to compile against. You'll have to open up Racemenu's .bsa, grab the scripts out of it (both .psc and .pex) and put them in your Data/Scripts and Data/Scripts/Source folders. That's all the compatibility stuff you need, you won't even need to add it as a master.

 

Then you need to add in your code that applies the morphs. This is actually fairly simple to do- I've pulled some scripting from my Bimbos of Skyrim mod as an example:

 

First, getBodyMorph:

float nodeSize= NiOverride.GetBodyMorph(akTarget, <nodeName>, "modID")

This will return the the NPC's existing morph for that node, in case there's already another morph affecting it. <nodeName> should be the name of the node you want to morph. This differs depending on what body mod you're using! I run CBBE so for me it's the node names from CBBE, but it's probably different for you. I found the node names by looking at Bodyslide's menu, but there's probably a more sensible way to get them to be honest.

modID is just a string attached to your morphs so that you can mass-edit them later (for example, if you want to clear all morphs on an NPC from your mod without affecting others.)

 

Next, setBodyMorphL

NiOverride.SetBodyMorph(akTarget, <nodeName>, "modID", (nodeSize + nodeMod) )

This should be pretty clear, since it uses all the same variables as getBodyMorph. The only key difference is the (nodeSize + nodeMod) at the end, This is the size the node will be set to- nodeMod is the value that it'll be increased by, plus whatever it already was from nodeSize. Start by setting nodeMod to 1, and see what effect that has, and you can tune from there.

 

Then, UpdateModelWeight:

NiOverride.UpdateModelWeight(akTarget)

This just triggers an NiO update so that the changed morph immediately appears.

 

So, as an example, to add1.2 to the BreastsSSh node, you'd do:

float nodeSize= NiOverride.GetBodyMorph(akTarget,"BreastsSSh ", "quickMorpher")

NiOverride.SetBodyMorph(akTarget, "BreastsSSh ", "quickMorpher", (nodeSize + 1.2) )

NiOverride.UpdateModelWeight(akTarget)

 

And that's it! Of course, it could get more complicated if you expanded it to allow the use to choose the amounts added or nodes targeted, but that's up to you. You could keep it super simple with 3 spells (boobs, butt, thigh) that add 0.1 on each cast, and the user just spams them to their hearts content. Good luck!

 

 

In case you want to look, here's the full DoMorphs script from my mod. It's got some more bells and whistles on it (SLIF compatibility, it reads all the nodes from a .JSON file and morphs all of them, etc.) and it's stored in a separate function instead of a spell (which is why it isn't in an OnEffectStart event) but you can see that the same basic logic is in there.

Spoiler

Scriptname CC_BimboMorphHandler extends Quest

 

String morphFolder = "../BimbosOfSkyrim/bimboMorphs/"

;divStep is a scalar- divStep of 1 applies the full .json's morphs. divStep of 2 applies half, 0.5 applies double


string function applyBimboMorphs(int stage, actor targetBimbo, float divStep, String targetArea = "")
    bool allNodes = !targetArea
    String[] baseNodes = JsonUtil.JsonInFolder(morphFolder)
    ; get current morph sizes
    ; ConsoleUtil.printMessage(nodes as String)
    int i = 0
    bool SLIF = Game.getModByName("SexLab Inflation Framework.esp") != 255
;    ConsoleUtil.printMessage(baseNodes as String)
    while i < baseNodes.length
        ;ConsoleUtil.printMessage(nodes)
        if allNodes || StringUtil.Substring(baseNodes, 0, StringUtil.Find(baseNodes, ".json")) == targetArea
            int j = 0
            String morphFile = morphFolder + baseNodes
            String path = ".float."
            String[] nodes = JsonUtil.PathMembers(morphFile, path)
            ;ConsoleUtil.printMessage(nodes as String)


            while j < nodes.length
                float nodeMod = JsonUtil.getFloatValue(morphFile, nodes[j])
                float nodeSize
                if SLIF
                    nodeSize= SLIF_Morph.getValue(targetBimbo, "CCBimbo", nodes[j])
                else
                    nodeSize= NiOverride.GetBodyMorph(targetBimbo, nodes[j], "CCBimbo")
                endif

                ; get new size
                float NodeNewSize = nodeSize + nodeMod/divStep

                ; set new size
                if SLIF
                    SLIF_Morph.morph(targetBimbo, "CCBimbo", nodes[j], NodeNewSize)
                else
                    NiOverride.SetBodyMorph(targetBimbo, nodes[j], "CCBimbo", NodeNewSize)
                endif
                j += 1
            endWhile


        endif
        i += 1
    endWhile

;    debug.messagebox("applied morph to " + targetBimbo.getactorbase().    getname() + "with divstep of " + divStep + "\n class: " + targetArea)
    ;do nio update
    NiOverride.UpdateModelWeight(targetBimbo)

endFunction


string function clearBimboMorphs(actor targetBimbo)

    bool SLIF = Game.getModByName("SexLab Inflation Framework.esp") != 255

    if SLIF
         SLIF_Morph.resetActor(targetBimbo, "CCBimbo")
    else
        NiOverride.ClearBodyMorphKeys(targetBimbo, "CCBimbo")
    endif

endFunction

 

EDIT: And just as I link these, the UESP wiki is down. Hopefully it's just for maintenance at this exact moment, but I can confirm that Wayback Machine can still access it if you want it right now.

EDIT2: Yeah it's back, but I'm leaving this in case anyone come across this another time and has the same problem.

Edited by jib_buttkiss

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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