Hello,
I am looking for a way to make tools interruptable.
The Goal is to make the combat feel smoother by striking the right balance between commiting to animations and being able to cancel out of animations at a certain time/frame.
For example a sword tool. I have a rather long attack animation that consists of three parts: preparation, attack and recovery.
Currently, the animation is played in its entirety and button inputs are only possible again afterwards.
I would now like to be able to interrupt the recovery phase via button input. Either when a dodge roll is performed. Or if the initial attack is to be followed by a chain of combo attacks.
Is it possible to create an if statement that checks whether a certain amount of time has passed and whether a button has been pressed, and then cancels the animation?
Any help would be much appreciated! :^)
Does changing the tool duration or tool pose duration have any effect?
I guess you could also split the animation into multiple animations
No, they do not have any effect that helps with my problem.
How would i manage to call them one after another then?
Where are you calling the animation? Is it in the tool's autonomous move route or the comments?
Does it make any difference if you put in the tool's move route
this.requestAnimation(16);
where 16 is the animation id instead of using a comment?
I am not sure if i understand what you propose.. The animation is stored in a Charset and is being called by this comment:
tool_pose_suffix : _atk1(F36)(S10)
Do you want me to use an Database Animation instead?
Yes i use a 36 Frame Character Sheet at the moment.
Where am i supposed to put this script?
If you want the player input to stop the character pose pattern you put it either in a parallel common event you switch on for the duration of the attack then switch off when done or in the tool's autonomous move route in repeat. You need some repeating script to be constantly checking for button press so those are the two places to do it.
You'd have to do something like
if(Input.isPressed('ok')){
$gamePlayer._characterName=$gamePlayer._originalName.name; $gamePlayer.setCharacterFrames(); $gamePlayer._stepAnime=false;
}
It works for me when I activate the switch via script in the autonomous movement route. From there, it activates the common event with your script.
Tho, all it does is that it displays the first frame of the Animation as long as I hold the button. The Tool remains active for the same duration as tool_pose_duration. So it still plays the Tool actually.
Ideally, it should stop the Tool immediatly by giving another input but only after the middle part of the animation (or at a certain Frame?)
I get 'SyntaxError – Unexpected end of input' in all cases.
if(Input.isPressed('ok') && $gamePlayer._pattern>=5)
Isn't the full script. You were supposed to sub it into the previous script. I added the frame check conditional because you asked for it
if(Input.isPressed('ok') && $gamePlayer._pattern>=5)
$gameMap.events().forEach(event => {
if (event.event().name == "Sword_combo1" && !event._erased){
event._tool.wait = 1; event._tool.duration = 1;}
This wont work for me. I still get 'SyntaxError – Unexpected end of input'. I can't tell what i am doing wrong.
if(Input.isPressed('ok') && $gamePlayer._pattern>=5)
$gamePlayer._characterName=$gamePlayer._originalName.name; $gamePlayer.setCharacterFrames(); $gamePlayer._stepAnime=false;
}
This kind of works? I dont know, i am not sure. It does kind of cancel the animation. But like.. not really.
It stops the animation based on the value above but then displays the first frame of the animation instead for the rest of the duration of the original animation. Pretty much how it was before.
Hey, thanks a lot! Coding is still relatively new to me.
You're right. I'll get into the habit of looking out for these kinds of mistakes myself.