Jump to content

Custom actions and FORCE ATTACK button

Recommended Posts


So I've been trying to create some custom action for a item I created. Basically, I just wanted the character to play a different animation than the default one when using it.


Everything works well until the "force attack" button is pressed. I dug up (a lot) in player_controller.lua and found some kind of a solution by using some leftclickoverride etc... but this solution is highly unsatisfying as it is messing up some other basic actions while my item is held by the player.


So my question is, how does this "force" button work? Is it something special that has to be added in the component action?


On an other note, is there a way to prevent the client from spaming a command? Because for the moment, the force attack has an override which is working but if the key is held, then it repeats the request too fast for the server to handle it properly which leeads to quite some crap.



Link to comment
Share on other sites

@ZupaleX, the force attack button is a button that when pressed, makes the playeractionpicker component bring up an attack action. It also changes the scope of the entities to target while issuing the attack command via F, in playercontroller.


I assume you want to make a second type of normal attack with your bow and that is messing you up?

Link to comment
Share on other sites

How did you set up your custom attack animations? So far my whole character is going blank when I attack. I added animations to each facing direction of character.scml (in the exported\character folder) and saved it as player_attacks.scml. I know it's compiling because player_attacks.zip is showing up in the \anim folder.


This tutorial and mod do very little in the way of implementation, but I couldn't figure out how to repurpose the code for an attack animation. For example,

AddStategraphState("wilson", GLOBAL.State(new_idle_state)) 

is in the mod file. Do I need to write my own attack code? An example of your function would be fantastic :D

Edited by StarmanUltra
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

  • Create New...