PanAzej

[TEMPLATE] Custom Player Animation

Recommended Posts

Yakuzashi    136

@Yakuzashi

Silly Yakuzashi from the past. Just paste this into your modmain.lua

local function spearjab(sg) 
 local _onenter = sg.states["attack"].onenter 

	sg.states["attack"].onenter = function(inst) 
		_onenter(inst) 
	
		local equip = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)		
		if equip ~= nil and equip:HasTag("weapon") then		
				inst.AnimState:PlayAnimation("spearjab")
		end	
	end
end

AddStategraphPostInit("wilson", spearjab)

and don't forget about:

Quote

local EQUIPSLOTS = GLOBAL.EQUIPSLOTS

Cheers, you dummy

Share this post


Link to post
Share on other sites
PanAzej    2015

Hi everyone,

I had a bit of free time today and I decided to dedicate it to updating Custom Animation Template.

New changes include:

- Added "hairfront" symbol.

- Added "customanim_mount" - animation of player riding on beefalo.

I will update the .zip in the main post shortly.

 

You can download this template on the Steam Workshop:

https://steamcommunity.com/sharedfiles/filedetails/?id=1607403248

...or you can just click on the attached file.

 

Enjoy.

custom_player_animation_11112020.zip

  • Like 3

Share this post


Link to post
Share on other sites
Arimo    4

Hello! I was just wondering if there was any way to add something to an idle animation with this? I know it sounds dumb, but for example, wendy, her idle animation has a flower. I'd like to know if it is at all possible to add something like that, or even some other kind of special effects? If it's not possible, that is cool too, this is an awesome template!

Share this post


Link to post
Share on other sites
PanAzej    2015
23 minutes ago, Arimo said:

Hello! I was just wondering if there was any way to add something to an idle animation with this? I know it sounds dumb, but for example, wendy, her idle animation has a flower. I'd like to know if it is at all possible to add something like that, or even some other kind of special effects? If it's not possible, that is cool too, this is an awesome template!

You can create a new animation using this template, and for the special idle animation you don't even have to create a new state, just simply load in the *.zip with anim.bin in your character's prefab and add the line below in your character's master_postinit:

inst.customidleanim = "idle_animationname"

Stategraph reads animation name from this variable and tries playing it during "funnyidle" state.

If it doesn't find a variable with this anim or this variable is empty, it plays the default "funnyidle" animation.

 

And if you're asking how to add a new symbol, then yes, that's possible too.

You would need to add an "override build" with inst.AnimState:AddOverrideBuild("build_name") or simply just add new symbol to animation, and compile it. That would mean leaving files other than anim.bin (a ton of unneeded graphics), so I would recommend compiling and loading that symbol as a separate build.

I may create some more extended tutorial about animations and stategraphs in DST at some point, but currently I'm leaving it as is.

Edited by PanAzej
more info
  • Thanks 1

Share this post


Link to post
Share on other sites
Arimo    4
57 minutes ago, PanAzej said:

You can create a new animation using this template, and for the special idle animation you don't even have to create a new state, just simply load in the *.zip with anim.bin in your character's prefab and add the line below in your character's master_postinit:

inst.customidleanim = "idle_animationname"

Stategraph reads animation name from this variable and tries playing it during "funnyidle" state.

If it doesn't find a variable with this anim or this variable is empty, it plays the default "funnyidle" animation.

 

And if you're asking how to add a new symbol, then yes, that's possible too.

You would need to add an "override build" with inst.AnimState:AddOverrideBuild("build_name") or simply just add new symbol to animation, and compile it. That would mean leaving files other than anim.bin (a ton of unneeded graphics), so I would recommend compiling and loading that symbol as a separate build.

I may create some more extended tutorial about animations and stategraphs in DST at some point, but currently I'm leaving it as is.

I am very new to this, so a tutorial would be stellar some time for newbies like me, haha. I will do my best! Thank you so much for the reply and for making this!

Share this post


Link to post
Share on other sites

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