Jump to content

Does anyone know how to create abilities for a custom character?


Recommended Posts

ok so i have figured out how to create a working character and how to do all the rest of the stuff just by browsing forums but i cannot find the topic on making abilities either that or i have just overlooked it

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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)
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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())
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?
Link to comment
Share on other sites

Archived

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

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...