0 of 0

File information

Last updated

Original upload

Created by

BeefStranger

Uploaded by

BeefStranger

Virus scan

Safe to use

Tags for this mod

About this mod

A bunch of functions and shortcuts I made for my mods

Requirements
Permissions and credits
Changelogs
A library of functions that I found myself using often. I made it for myself, but feel free to use/cannibalize it for yourself.

My main uses in it are:


local bs = require("BeefStranger.functions")

bs.timer{dur = 1, iter = 3, cb = function() end}


local function onEffectTick(e)
    local function doThis()
       this thing
    end
   bs.onTick(e, doThis) ---For onTick Magic effects
end


local targetRef = bs.rayCast(900) ---Returns the reference of a rayTest, 900 is the distance

bs.typeCheck(targetRef, "npc") ---Used to check if an objectType matches what youre looking for
 if bs.typeCheck(target, "npc") then
     bs.msg("Target is NPC")
 end


bs.inspect(tableToInspect) --Logs a table to the console


local log = bs.getLog("logName") ---Gets or creates a log, returns a table of other functions too.
local dbg = log.debug
local trace = log.trace
log.setLogLevel("DEBUG")

--Also has if need what would normally be the log you create. ie local log = logger.new{...}
log.log

=====Helper functions======
bs.sf()  ---Short for string.format

bs.addSpell(tes3.player, "light") ---Shorthand for addSpell

bs.sellSpell("fargoth", "light") ---Gives the spell to the target, and makes them sell spells

bs.keyUp("b", function()
bs.msg("B pressed")
end)

bs.msg("Message #%s", number) --Shorthand for tes3.messageBox


=====Sounds=========
bs.playSound("bell6", volume, pitch, ref) -- BeefLibrary contains a table of all vanilla sounds so you can also do
bs.playSound(bs.sound.bell6) --- I find this very useful because it suggests valid sounds

bs.sound.register() ---Registers a few custom sounds I got from freesound.org

the custom sounds are under bs.bsSound / bs.bsSound.magicImpact for instance

==============EffectMaker================
This is very similar to MagickaExpanded just with a bunch of tweaks I wanted,

Has a lot of auto values for quick setup, Heres a valid effect creation.

event.register("magicEffectsResolved", function()
    bs.effect.create({
        id = "TestID",
        name = "Test Name",
        school = tes3.magicSchool.alteration,

        onTick = testTick
    })
end)

this will auto assign an icon/sound/vfx based on what ever school the effect is.


========spellMaker=============

    bs.spell.create({
        id = "testSpell",
        name = Test Test",
        effect = tes3.effect.TestID,
        min = 10,
        max = 10,
        duration = 3,
        range = tes3.effectRange["target"],
        alwaysSucceeds = true,
    })
end


Theres also the beginnings of a set of MCM config helper functions, but i just started it and it looks like theres updates to MCM going on right now

Im not claiming these are necessary or even well written, Ive been learning lua for the sole purpose of modding morrowind, and have 0 programming experience before hand, I started lua about a month ago and just so happens I found making helper functions one of the funnest parts.

So definitely use with caution