Specifically for broadswords. I'll be blunt, my goal is to make a Z-Saber (Mega Man X) for Starbound. Plenty of secondary abilities match his various techniques from throughout the franchise, but making separate broadswords just to match each feels off. The Goal: Have each secondary be mapped to a specific input. The Problem: .lua work remains the bane of my existence.
so it is possible? what im needing here are: neutral (0 inputs and on ground) - Projectile Shot up - Rising Slash down - Parry air - Circular Slash air + up - Rising Slash (again, i know) air + down - Downward Thrust i can add those myself if instructed how surprised how many of Zero's techniques can easily be replicated in Starbound. hard part will be Circular Slash, but i'll worry about dealing with that animation later
As far as I know, only Tech and Vehicles can hook onto the directional key inputs used for movement. Though, You can somewhat check for directional movement using the player velocity (mcontroller.velocity()), but direct check for WASD (or your movement settings) is not possible. If you don't have too many actions, you could make it work with primary/alt ability, shift and onGround checks like this: primary -> projectile attack shift + primary (hold) -> Parry Alt -> rising slash Alt + shift + airborne -> Downward Thrust (Crouching would also be something you can check for)
Yeah, like most things in modding starbound, its all about trial and error or looking into other mods to see how they did it. Here is an example script for the action forks. Mind you that this only handles the conditions stated in my last comment and does not actually do the desired actions yet (except some part for the parry). I added comments within the code to explain what is going on and what the intention of the functions are as well as to how to continue building on from them. Hope this helps. (edit: updated file)
current result: https://i.gyazo.com/e7e163380f0e6f288866422881b1cc29.png am i supposed to put anything in the .activeitem file? i should probably also mention im using the Solus Katana as a base, which uses energymeleeweapon.lua
meanwhile, got a functioning Ryuenjin. basically just a Rising Slash with a fire aesthetic. also planned are Hyouretsuzan (Pogo Sword encased in ice) Kuuenzan (airborne Flip Slash without the buildup or travel) Gokumonken (literally just Parry) Zankourin (Traveling Slash in the shape of a sawblade) depending how many options there end up being, i may have more slated EDIT (5/9/2023): Kuuenzan is functioning... almost. i am someone who uses Frackin' Universe, and that breaks the Flip Slash for some reason. the player will flip, but the weapon will remain in its windup position and not spin with the player. if anyone has the solution to this dilemma, do tell so i can make a separate patch
currently have a handful of abilities made and will continue to make more until i'm out of slots. @Rezetrx is walking/running a possible factor for how an ability is decided?
You can check for movement using the velocity, specifically the x value. You can check it like this (math.abs(mcontroller.velocity[1]) > 0.5), as sprinting horizontally would yield a x velocity of about 13 and 7 while walking. These values may vary though. Edit: This check would also trigger when moving using a vehicle or through knockback though. As for direct walking/running checks, I don't recall having found such functions that are available for activeitems.
hmm... noted. anyways, like i said, the base im using for the Z-Saber is the Solus Katana which uses the energymeleeweapon.lua the results with the provided lua were broken, but that is to be expected when i dont divulge every bit of info. my apologies i'll worry about the walking thing later (if at all), and focus on the shift, alt, crouch, airborne, and idle. i have plenty of techniques to plug in