Jump to content

Recommended Posts

There's no real "Add X to make character do Y" chart, if you're unfamiliar with Lua and coding in general, then your best bet is to look into other mods that do something similar to what you want, and base your code off of them.

 

It'd also help if you'd tell us what you're trying to do.

Edited by Blazingice26

i've skimmed through the .lua but i did not know that is how yo go about making abilities but what i am trying to do is use wigfrids ability where she gets a set amount of hp back in battle but i could not find her files in my game i have her unlocked but i dont see her files and i am also trying to do a resistance to cold

i've skimmed through the .lua but i did not know that is how yo go about making abilities but what i am trying to do is use wigfrids ability where she gets a set amount of hp back in battle but i could not find her files in my game i have her unlocked but i dont see her files and i am also trying to do a resistance to cold

 

Her files are in the dlc folder.

 

Cold resistance is easy.

inst.components.freezable:SetResistance(resist)

thanks again but this is all i could find i assume this is what i am looking for but i do not know what to do with it inst.components.health:SetAbsorptionAmount(TUNING.WATHGRITHR_ABSORPTION)

 

Well, this is what you're interested in:

local function onkill(inst, data)    if data.cause == inst.prefab        and not data.inst:HasTag("prey")        and not data.inst:HasTag("veggie")        and not data.inst:HasTag("structure") then        local delta = (data.inst.components.combat.defaultdamage) * 0.25        inst.components.health:DoDelta(delta, false, "battleborn")        inst.components.sanity:DoDelta(delta)        if math.random() < .1 and not data.inst.components.health.nofadeout then            local time = data.inst.components.health.destroytime or 2            inst:DoTaskInTime(time, function()                local s = medScale                if data.inst:HasTag("smallcreature") then                    s = smallScale                elseif data.inst:HasTag("largecreature") then                    s = largeScale                end                local fx = SpawnPrefab("wathgrithr_spirit")                fx.Transform:SetPosition(data.inst:GetPosition():Get())                fx.Transform:SetScale(s,s,s)            end)        end    endend

and this:

inst:ListenForEvent("entity_death", function(wrld, data) onkill(inst, data) end, GetWorld())

so do i copy and paste and than change her name to my characters of no

 

Well, a copy/paste isn't ideal for that. I highly suggest reading through her prefab and to try and understand as much as you can. For instance, the spirit prefab is spawned, and if you don't have it declared in your prefabs table in your character prefab, it won't spawn it.

no im sorry i was not specific i was talking about the prefab so i go into my prefab and type in wathgrithr_spirit then go to my local fn = function(inst) than type in local function onkill(inst, data)

if data.cause == inst.prefab 
and not data.inst:HasTag("prey") 
and not data.inst:HasTag("veggie") 
and not data.inst:HasTag("structure") then
local delta = (data.inst.components.combat.defaultdamage) * 0.25
        inst.components.health:DoDelta(delta, false, "battleborn")
        inst.components.sanity:DoDelta(delta)
 
        if math.random() < .1 and not data.inst.components.health.nofadeout then
        local time = data.inst.components.health.destroytime or 2
        inst:DoTaskInTime(time, function()
        local s = medScale
        if data.inst:HasTag("smallcreature") then
        s = smallScale
    elseif data.inst:HasTag("largecreature") then
    s = largeScale
    end
        local fx = SpawnPrefab("wathgrithr_spirit")
        fx.Transform:SetPosition(data.inst:GetPosition():Get())
        fx.Transform:SetScale(s,s,s)
    end)
        end
and also type in inst.components.health:SetAbsorptionAmount(x= the amount i want?) this? do i have to change wathgrithr to my characters name?

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
×
  • Create New...