Jump to content

Baby steps in scripting from scratch


zensunniwanderer

Recommended Posts

Posted

So I decided that this might make a good learning experience and started to put together a script however I've run into a problem that I just can't find any help on. The script won't activate in-game. I've successfully compiled it and dropped it into my MO override/Scripts folder assuming that "extends Quest" was appropriate.

 

When that didn't work I tried to create a new quest in CreationKit called aroused_drip, I went to the scripts tab and tried to add the compiled script - the result was an error:

 

"Script "aroused_drip" had errors while loading, it will not be added to the object."

 

I've probably made a really fundamental error, can anyone point out where I've gone wrong?

 

Many thanks. :3

 

Here's my script:

 

ScriptName aroused_drip extends Quest


Actor Property PlayerREF Auto
Armor Property ZaZAPEF201ALeakyPussyDrops Auto
SPELL Property dripping Auto
Bool Property SLA_available = false auto

Event OnInit()
    Debug.Trace("Starting aroused leak.")
    Debug.Notification("Starting aroused leak.")
    SLA_available = SLAroused_check()
    RegisterForUpdate(20.0)
EndEvent

Event OnUpdate()
    if SLA_available
        if GetActorArousal() > 20
            Debug.Notification("Arousal > 20 leak applied")
            Debug.Trace("Arousal > 20 leak applied")
            PlayerREF.addItem(ZaZAPEF201ALeakyPussyDrops, 1, true)
            PlayerREF.equipItem(ZaZAPEF201ALeakyPussyDrops, abSilent=true)
        elseif PlayerREF.IsEquipped(ZaZAPEF201ALeakyPussyDrops)
            Debug.Notification("Stopping leaking.")
            Debug.Trace("Stopping leaking.")
            PlayerREF.unequipItem(ZaZAPEF201ALeakyPussyDrops, abSilent=true)
            PlayerREF.removeItem(ZaZAPEF201ALeakyPussyDrops, 99, true)
        else
            Debug.Notification("herpaderp.")
            Debug.Trace("herpaderp.")
        endif
    else
        Debug.Notification("No SLA.")
        Debug.Trace("No SLA.")
    endif
EndEvent

bool Function SLAroused_check()
    Debug.Trace("aroused_drip SLAroused check")
    If Game.GetModbyName("SexLabAroused.esm") != 255
        Debug.Trace("SexLabAroused.esm found")
        return true
    else
        Debug.Trace("SexLabAroused.esm not found")
    endif
    return false
EndFunction

int Function GetActorArousal()
    if SLA_available
        slaFrameWorkScr sla = Quest.GetQuest("sla_Framework") as slaFrameWorkScr
        if sla
            return sla.GetActorArousal(PlayerREF)
        else
            return 0
        endif
    else
        return 0
    endif
EndFunction

 

 

Posted

You can't just drop a script in the script folder and expect it to run, it has to be attached to something or something has to run it in game.

 

This is something I was confused by. I initially thought this was the case but was thrown by mods that I have in MO that are nothing more than a single script in the Scripts folder which suggested simply having a valid script that extends an already running process should work.

 

Regardless, I did attempt to attach the script and got the error I previously described. I can't see why a script that compiles successfully can have errors in it from CreationKit's point of view.

 

 

@MajinCry  Thanks, I've since read a few posts elsewhere that match your advice, I'll look in to this more (assuming I can get the script to work).

Posted

On the error, do you have the source script in the script/source folder? The CK uses the source files to do things not the compiled ones.

 

Ah! I did not, I keep my scripts in another directory and use advanced papyrus to use that directory when I'm compiling.

 

I'll try that later, thank you. :)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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