Jump to content

Recommended Posts

Hello good people!

Is it possible to reskin a tool (for example the axe and the pickaxe) and have it reskinned for only one character? 
I want to make the tools more primitive for my character Drok the Caveman, but i don't want to create a whole new axe item for him.

All help is appreciated!

-Space Monkey

Sure. Just use 'AddPrefabPostInit' to add an 'if' statement that checks who the player is, and set the animation to a custom one you made.

--In 'modmain.lua'
AddPrefabPostInit("axe",function(inst)
	if GetPlayer().prefab == "drok" then
		inst.AnimState:SetBank("primativeaxe")
		inst.AnimState:SetBuild("primativeaxe")
		inst.AnimState:PlayAnimation("idle")

		--Since it's equippable, you'll also need to override the 'OnEquip' and 'OnDequip' functions
		--Just copy the relevant code from 'axe.lua', but use a swap animation of your own 
	end
end

You should also put the animations in an 'Assets' table in 'modmain.lua'. Make sure it is not a local table though.

37 minutes ago, Arkathorn said:

Sure. Just use 'AddPrefabPostInit' to add an 'if' statement that checks who the player is, and set the animation to a custom one you made.


--In 'modmain.lua'
AddPrefabPostInit("axe",function(inst)
	if GetPlayer().prefab == "drok" then
		inst.AnimState:SetBank("primativeaxe")
		inst.AnimState:SetBuild("primativeaxe")
		inst.AnimState:PlayAnimation("idle")

		--Since it's equippable, you'll also need to override the 'OnEquip' and 'OnDequip' functions
		--Just copy the relevant code from 'axe.lua', but use a swap animation of your own 
	end
end

You should also put the animations in an 'Assets' table in 'modmain.lua'. Make sure it is not a local table though.

Thanks! That sounds simple enough! How do i override the OnEquip and OnDequip function though? It's been a while since i had a go at modding. Would using this method also make it possible to alter the dropped texture without changing the default axe (with a thought of making it DST compatible, so axes crafted by other players still look like the normal one)?
Thank you for your time! :)

26 minutes ago, Mobbstar said:

It's probably worth noting that DST supports item skins (e.g. backpack), so those might clash with your item if you decide to make them DST compatible.

I'm guessing if i name the animation "primitiveaxe" it wouldn't interfere with other skins right? :p

Edited by QuickShot010
1 hour ago, Mobbstar said:

It's probably worth noting that DST supports item skins (e.g. backpack), so those might clash with your item if you decide to make them DST compatible.

They shouldn't, due to how skins work with Dyn Files.

Okay, i need some more help.

This is what i have done right now:
 

(...)
    Asset("ANIM", "anim/primitiveaxe.zip"),
    Asset("ATLAS", "images/inventoryimages/primitiveaxe.xml"),

    Asset("ANIM", "anim/swap_primitiveaxe.zip"),
(...)


AddPrefabPostInit("axe",function(inst)
    if GLOBAL.GetPlayer().prefab == "drok" then
        inst.AnimState:SetBank("primitiveaxe")
        inst.AnimState:SetBuild("primitiveaxe")
        inst.AnimState:PlayAnimation("idle")

        local function onequip(inst, owner) 
            owner.AnimState:OverrideSymbol("swap_object", "swap_primitiveaxe", "swap_primitiveaxe")
            owner.AnimState:Show("ARM_carry") 
            owner.AnimState:Hide("ARM_normal") 
        end

        local function onunequip(inst, owner) 
            owner.AnimState:Hide("ARM_carry") 
            owner.AnimState:Show("ARM_normal") 
        end
    end
end)

For some reason it still won't work, can someone please take a look at this?

The ground animation is invisible for Drok, but when i play as Wilson you can see it. So i guess that's a small step in the right direction.

Thanks for your help in advance!

@Mobbstar I've done the inventory image now, it's still showing the default axe.

I don't think my animation is faulty as i called the build "primitiveaxe" and the animation "idle".

I'm really confused on what to do now. Would you know by chance?

Okay, everything is working except when the character holds his axe he holds an invisible axe, My question now is how do i  get the animation to work?

I renamed the build to swap_primitiveaxe, so the build name is correct.

Any help here?
Thanks a lot!

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