Modding Help [SOLVED] Possible to Change Randomly Generated Alt Ability Offset?

Discussion in 'Starbound Modding' started by ImHereForTheMods, Jun 1, 2022.

  1. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    Recently I found a way to use random weapon gen on unqiue weapons to have a randomly generated elemental type, and it works perfectly.

    I was hoping to do the same with Alt Abilites, and they generate fine, but the issue is they don't have the custom offset needed for them to be positioned properly for their relevant animation states.

    The Code for random generated alt abilities is like so:


    "altAbilities" : [
    "giantsword",
    "travelingslash",
    "blinkexplosion",
    "blinkslash",
    "traildash"
    ]

    This is great for adding the ability, but there is no real flexibility in the positioning of the item when that ability is used.
    How would I go about adding a custom position to each of these?

    A possible solution that has crossed my mind is to create a duplicate of the alt ability weaponability file, and change the parameters with a custom offset, however this would be a messy fix, requiring a custom one for 180 weapons. In addition to that I have no idea how I would actually reference the altered weaponability file.

    My preferred solution would be to add a line "weaponOffset": [0.7, 0.25] somewhere within that altAbilites code block, but I am not sure if this would do anything, or if it would how I would structure it.

    I will attempt including additional information, such as stances somehow, and see if I can get it to work, but any help would be appreciated. Thank you.
     
  2. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    On the rare chance someone needs an answer to this, here is what I did to make it work.
    You can use a custom offset under animationCustom like so to set the base offset of your weapon, and it will carry across to abilities.

    Code:
      "animationCustom" : {
        "animatedParts" : {
            "parts" : {
                  "blade" : {
              "properties" : {
              "offset" : [0.6, 2.25],
              "transformationGroups" : ["weapon"],
              "rotationCenter" : [0.6, 0.25]
            }
          }
      }
    }
    },
    }
    }
    },

    You can then use a builder similar to this:
    Code:
      "builder" : "/items/buildscripts/buildweapon.lua",
      "builderConfig" : [{
        "elementalType" : [
          "fire",
          "ice",
          "electric",
          "poison"
        ],
        "elementalConfig" : {
          "fire" : {
            "primaryAbility" : { "damageConfig" : { "statusEffects" : [ "burning" ] } },
            "animationCustom" : { "sounds" : {
              "fire" : [ "/sfx/melee/swing_broadsword_fire1.ogg", "/sfx/melee/swing_broadsword_fire2.ogg", "/sfx/melee/swing_broadsword_fire3.ogg" ],
              "fire2" : [ "/sfx/melee/swing_shortsword_fire1.ogg", "/sfx/melee/swing_shortsword_fire2.ogg", "/sfx/melee/swing_shortsword_fire3.ogg" ],
              "fire3" : [ "/sfx/melee/swing_spear_fire1.ogg", "/sfx/melee/swing_spear_fire2.ogg", "/sfx/melee/swing_spear_fire3.ogg" ]
            } }
          },
          "ice" : {
            "primaryAbility" : { "damageConfig" : { "statusEffects" : [ "frostslow" ] } },
            "animationCustom" : { "sounds" : {
              "fire" : [ "/sfx/melee/swing_broadsword_ice1.ogg", "/sfx/melee/swing_broadsword_ice2.ogg", "/sfx/melee/swing_broadsword_ice3.ogg" ],
              "fire2" : [ "/sfx/melee/swing_shortsword_ice1.ogg", "/sfx/melee/swing_shortsword_ice2.ogg", "/sfx/melee/swing_shortsword_ice3.ogg" ],
              "fire3" : [ "/sfx/melee/swing_spear_ice1.ogg", "/sfx/melee/swing_spear_ice2.ogg", "/sfx/melee/swing_spear_ice3.ogg" ]
            } }
          },
          "poison" : {
            "primaryAbility" : { "damageConfig" : { "statusEffects" : [ "weakpoison" ] } },
            "animationCustom" : { "sounds" : {
              "fire" : [ "/sfx/melee/swing_broadsword_poison1.ogg", "/sfx/melee/swing_broadsword_poison2.ogg", "/sfx/melee/swing_broadsword_poison3.ogg" ],
              "fire2" : [ "/sfx/melee/swing_shortsword_poison1.ogg", "/sfx/melee/swing_shortsword_poison2.ogg", "/sfx/melee/swing_shortsword_poison3.ogg" ],
              "fire3" : [ "/sfx/melee/swing_spear_poison1.ogg", "/sfx/melee/swing_spear_poison2.ogg", "/sfx/melee/swing_spear_poison3.ogg" ]
            } }
          },
          "electric" : {
            "primaryAbility" : { "damageConfig" : { "statusEffects" : [ "electrified" ] } },
            "animationCustom" : { "sounds" : {
              "fire" : [ "/sfx/melee/swing_broadsword_electric1.ogg", "/sfx/melee/swing_broadsword_electric2.ogg", "/sfx/melee/swing_broadsword_electric3.ogg" ],
              "fire2" : [ "/sfx/melee/swing_shortsword_electric1.ogg", "/sfx/melee/swing_shortsword_electric2.ogg", "/sfx/melee/swing_shortsword_electric3.ogg" ],
              "fire3" : [ "/sfx/melee/swing_spear_electric1.ogg", "/sfx/melee/swing_spear_electric2.ogg", "/sfx/melee/swing_spear_electric3.ogg" ]
            } }
          }
        },
            "altAbilities" : [
          "giantsword",
          "travelingslash",
          "blinkexplosion",
          "blinkslash",
          "traildash"
        ]
      }]
    To call the abilities.

    Now, had I only known that 3 days ago... :rofl:
     

Share This Page