Modding Help can I remove the "return to idle stance" animation after the weapon attacks?

Discussion in 'Starbound Modding' started by Lazy Joe, Apr 26, 2017.

  1. Lazy Joe

    Lazy Joe Scruffy Nerf-Herder

    I am trying to create a weapon with custom image, based off the durasteel revolver, currently, the inventory icon and the weapon itself show up properly.

    But I need my weapon to move while i attack, basically to get it away from my character's hand.

    And thats when i noticed i can't do that.

    Also, I can rotate the arm, the weapon would rotate with my arm, but if i set the weapon rotation to the negative equal value to my arm's rotation to make it return to its original angle, it doesnt.

    The weapon is magically stuck to my hand. Is there any way to make it not do that?

    EDIT:

    Theres a cigar item i created about half week ago thats also based on durasteel revolver, and it rotates just fine. Its drawable had the custom sign format. Starts with:

    "/objects/outpost/customsign/signplaceholder.png?replace;01000101=876D56FF;.....

    and has of course a quite reasonable size.

    The weapon im currently trying to create is something from before 1.0 which got rendered useless thanks to the introduction of activeitem format, and it has the size of about 2 hoverbikes stacked onto eachother, so it's much bigger. Using custom sign format, i will need about 40 to 50 of it.

    the codes im using for this item is generated with the drawable generator, so its divided into different weapon parts.
     
    Last edited: Apr 26, 2017
  2. MetaFace

    MetaFace Guest

    You mean like make it so the weapon always faces forward? Or what? This seems a little unclear, but to prevent a weapon from rotating you need to set "allowRotate" to false in the activeitem file.

    Can you better explain the rest, as I personally can't wrap my head around what you're asking.
     
  3. Lazy Joe

    Lazy Joe Scruffy Nerf-Herder

    No, I was asking a way to make the weapon not to rotate with the arm. And also the possibility to make it leave my hand in some stances. Changing the weaponRotation value doesnt work, and adding weaponOffset doesnt work either.

    In this particular case, it's not working. But i got another item with custom sprite, which is also based on durasteel revolver, to rotate independently from my arm rotation. The differences are, different drawable codes, and very different size.
     
  4. Lazy Joe

    Lazy Joe Scruffy Nerf-Herder

    Ok, i got the problem

    The drawables need the "transformationGroups":[] to contain "weapon" in the []s
     
  5. MetaFace

    MetaFace Guest

    Alright, I get it, so when the arm rotates you want the gun to rotate in some other direction. So I guess I can see what can be done.

    EDIT:

    Nvm then...
     
  6. Lazy Joe

    Lazy Joe Scruffy Nerf-Herder

    I have another question though. How can i disable/remove the rotation animation after the attack?

    For example i have a sword, when swinging it in the fire stance, it points forward, and in the cooldown animation, it points upward. After the attack, theres this rotation transition kinda like thing, where you can see how the sword slowly rotates back to the idle stance. Can i somehow remove that? It ruins what i have planned for this weapon. I need the weapon to return to the idle stance instantly, without actually seeing the transition.
     
  7. MetaFace

    MetaFace Guest

    Oh yeah that can be done, lemme think here... so when you enter cool down the sword starts slowly going back to the idle and you are annoyed by that? What weapon ability is being used? They normal sword combo? (I actually need to know because different abilities do things differently)
     
  8. Lazy Joe

    Lazy Joe Scruffy Nerf-Herder

    Well im using the durasteel revolver as base item. I need the cooldown stance to be present, but not the transition part, cos thats gonna ruin the drawable. It looks weird. So setting duration to 0 is a no.

    The sword was just an example. But even with ranged weapon, when you fire, you arm rotate up by 10 degrees to make it looks like theres a recoil, and rotate back 10 degrees again.

    Actually the more important part is make the weapon to skip that transition, cos im trying to make pseudo animated drawable by using 3 frames positioned far away from each other. So after the cooldown stance, the drawable shift until the first frame is in the hand again, thats totally unacceptable.
     
    Last edited: Apr 26, 2017
  9. MetaFace

    MetaFace Guest

    So you want the recoil, but need it to return immediately. Well it'd need some tinkering, but the code that needs to be modified is right here:
    Code:
    function GunFire:cooldown()
      self.weapon:setStance(self.stances.cooldown)
      self.weapon:updateAim()
    
      local progress = 0
      util.wait(self.stances.cooldown.duration, function()
        local from = self.stances.cooldown.weaponOffset or {0,0}
        local to = self.stances.idle.weaponOffset or {0,0}
        self.weapon.weaponOffset = {interp.linear(progress, from[1], to[1]), interp.linear(progress, from[2], to[2])}
    
        self.weapon.relativeWeaponRotation = util.toRadians(interp.linear(progress, self.stances.cooldown.weaponRotation, self.stances.idle.weaponRotation))
        self.weapon.relativeArmRotation = util.toRadians(interp.linear(progress, self.stances.cooldown.armRotation, self.stances.idle.armRotation))
    
        progress = math.min(1.0, progress + (self.dt / self.stances.cooldown.duration))
      end)
    end
    located in gunfire.lua, this would mean you're going to have to make your own, or... make sure that your cool down duration is low, but present.

    The easier being to make sure that your cool down isn't set to something stupid. Like a rapid fire gun 's cool down duration is 0.01 so that it almost instantly goes back to its place. (this means the animation is super short though)
     
  10. Lazy Joe

    Lazy Joe Scruffy Nerf-Herder

    Thanks for the reply, sadly this is not the solution for me since i dont know a thing about lua, editing item files is as far as i can go.
     
  11. MetaFace

    MetaFace Guest

    Can I see your item file?
     

Share This Page