Jump to content

How to Change Animation Speeds? Attack Faster


Recommended Posts

Greetings,

I am currently trying to make a custom character have more attacks per second while unarmed. However, this seems like a rather advanced thing when it comes to custom characters, and as someone with limited coding experience is proving quite challenging. Currently the only solution I have tried is setting the attack periods (min, max, or standard) to different values, however this doesn't seem to change anything, rather causes conflictions and makes them attack slower.
I know to look at the characters State Graphs, but that's about it. I don't know how to change them and apply it to my character.

Can anyone write up a detailed (possibly) step by step on how to go about this? I'm sure it'll help me and a lot of others out (I've seen others asking for this same thing but getting mixed responses).

Thanks again!

Link to comment
Share on other sites

Have you tried finding a mod that does something similar? That should be your first step, as someone else has most likely already been through the troubled waters you're getting into :D Find a character mod that has a custom attack speed. You learn SO MUCH looking at working code.

Link to comment
Share on other sites

On 8/29/2018 at 4:13 PM, Ultroman said:

Have you tried finding a mod that does something similar? That should be your first step, as someone else has most likely already been through the troubled waters you're getting into :D Find a character mod that has a custom attack speed. You learn SO MUCH looking at working code.

I've look before, but Ill give it another shot!
Thank you for responding. :^D

Link to comment
Share on other sites

It'll probably have something to do with custom animation speeds. The stategraphs have a certain finite number of frames it waits, before the attack is executed. This effectively lets the attack animation finish, before applying the damage. In SGWilson, the default number of frames it waits is 24 IIRC. You can change this state for your character, which should make him attack faster, but the animation will still run at normal speed, meaning it'll be cut short. You can design a custom attack animation to fix this problem.

There are certainly other things you need to look into, but this is a start. Find a custom character mod, which changes the stategraph or has its own custom one (maybe in a separate file). I've only ever edited stategraphs, so I can't help you when it comes to creating your own for your character.

Link to comment
Share on other sites

I think you could play with the inst.sg:SetTimeout(number*FRAMES) "Frames = 30"

for example

inst:ListenForEvent("onattackother", function(inst, data)
    --data is a table containing variables for target, weapon, projectile, and stimuli
    if data.weapon == nil then --for example if data.weapon is nil then we have no weapon equipped.
		inst.sg:SetTimeout(1/30) --number should be a number multiplied by FRAMES which is 1/30
    end
end)

You can increase fidelity using if statements to check certain conditions such as attacking faster unarmed when your hand is free or only with specific weapons. But this is just to give you the basic concept, there does seem to be a timeline that limits the minimum attack interval to 1/3rd a second. It should be possible to circumvent this if somebody can figure out a way to skip the timeline and make the buffered action faster.

Edited by IronHunter
Link to comment
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
 Share

×
  • Create New...