Jump to content

Recommended Posts

Hi there.

I've been working on a custom character mod and one of the features to be implemented is to have the character spawn with a staff similar to the "Infernal Staff" from the Forge.

I have dug through the prefabs in my DST files and located "fireballstaff.lua". At first glance I assumed this to be the file for the Infernal Staff and decided to learn from this file in hopes to implement a similar weapon. The issue I am having is that I am unable to "fire" the weapon. I can use my right-click and have the target reticule appear, but I am unable to use left-click to attack and create the projectile.

I searched for any indication of how the weapon is "fired" while digging through the fireballstaff.lua file, but I couldn't seem to figure out. My best guess is the "castfxfn" function handles firing off the effect, but when I tried to implement a similar function in my code it did not work. I'm not recieving any errors, but nothing seems to happen when I use my left-click after I activate the reticule with right-click.

This is the castfxfn function located in fireballstaff.lua.

local function castfxfn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddNetwork()

    inst.AnimState:SetBank("fireball_fx")
    inst.AnimState:SetBuild("deer_fire_charge")
    inst.AnimState:SetBloomEffectHandle("shaders/anim.ksh")
    inst.AnimState:SetLightOverride(1)
    inst.AnimState:SetFinalOffset(-1)

    inst:Hide()

    inst:AddTag("FX")
    inst:AddTag("NOCLICK")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    event_server_data("lavaarena", "prefabs/fireballstaff").castfx_postinit(inst)

    return inst
end

So how does the Infernal Staff work? Am I looking at this all wrong? Or is it possible? And how can I mimic this effect with my item?

I apologize as I am very new to Lua and have been learning as I go, so the solution may be something very obvious that I've overlooked. If you need to look at the full fireballstaff file or my own file, please let me know and I will gladly edit the post.

 

Thanks!

Most of the coding for the Forge is hidden in Klei's servers. Recreating anything in the event would be very difficult, so you probably won't have any luck. Don't let that keep you from trying, though! I'd like to see some Forge items become normal game items.

Maybe it would be better to ask for Klei permission, because if they wanted to put Forge item in DST they are able to. I feel like maybe they have a word to say about it, instead of us using their contents just because it's here.

It's different, for me, than the classic use of existing assets (because they are in the base game).

This is of course my point of view, i just want to share it, but will not argue more about this, so everyone could do as they want.

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...