Modding Help [SOLVED] LUA: making a character's arms point straight up?

Discussion in 'Starbound Modding' started by SpaceDonkeyKong, Sep 7, 2016.

  1. SpaceDonkeyKong

    SpaceDonkeyKong Subatomic Cosmonaut

    Hi,

    For a custom ability, I need to have a character's arms point their gun straight up, but as far as I've seen in weapon ability scripts, all angles seem to be relative. As such, I can make a character's arms rotate 90°, but not point in a certain direction, no matter where they were pointing before.

    Wands only point upwards when charged because they can't be "aimed" while idle, and arms are locked in one angle. For a gun, it obviously won't work, because you need to be able to aim it!

    Is there any way to do make arms point at an absolute angle?
    Perhaps by somehow obtaining the angle at which arms are currently pointing (I don't know what that variable could be)?

    Thanks in advance. I've been snooping through a great many scripts and I'm at my wits' end!



    EDIT:

    I finally found the solution. Moments after finally posting a thread. Figures! Posting it here so that others can find it faster and move on.

    self.weapon:setStance(self.stances.fire)
    self.weapon.relativeArmRotation = self.weapon.relativeArmRotation - self.weapon.aimAngle
    self.weapon:updateAim()

    (In this case, the stance "fire" has the parameter "armRotation" : 90, so the character will point their arm upwards.)
     
    Last edited: Sep 7, 2016
    lornlynx, foxtails and loopnotdefined like this.

Share This Page