Modding Help Creating Weapon Abilities in Nightly

Discussion in 'Starbound Modding' started by Type-Luna, Jul 8, 2016.

  1. Type-Luna

    Type-Luna Void-Bound Voyager

    So while trying to go from Stable to the current Nightly version, I noticed that the format for the weapons changed again. I am currently trying to play around with some custom weapon abilities in Nightly and while I was able to do it in stable, I can't figure it out in the Nightly version.

    Taking parry as an example:

    Code:
        "altAbilities" : [
          "/items/active/weapons/melee/altabilities/broadsword/parry/parry.altability"
        ],
    Is how abilities are referenced in the current stable version. If I wanted to make a new version of parry for a custom weapon, I would put make a copy and name it say "parry2.altability" and change the reference to:

    Code:
        "altAbilities" : [
          "/items/active/weapons/melee/altabilities/broadsword/parry/parry2.altability"
        ],
    However, the current format in the active items set it up as:

    Code:
        "altAbilities" : [
          "parry"
        ],
    And I can't figure out how to set it up so that it uses the altered version of parry. So far every attempt I've made, gives the weapon no abilities.

    Code:
      "ability" : {
        "name" : "Parry",
        "type" : "parry",
        "scripts" : ["/items/active/weapons/melee/abilities/broadsword/parry/parry.lua"],
        "class" : "Parry",
    
    I've looked at the JSON file for parry itself and at first I thought it was referencing the type, but I tried editing that and it failed. Any ideas?
     
  2. The | Suit

    The | Suit Agent S. Forum Moderator

    All alt abilities are purely lua based abilities.
    To make a new one you would need to know Lua.
     
  3. Type-Luna

    Type-Luna Void-Bound Voyager

    Well I am trying to use an existing lua and editing the values in the .weaponability file at the moment.

    Code:
    "ability" : {
        "name" : "Parry",
        "type" : "parry",
        "scripts" : ["/items/active/weapons/melee/abilities/broadsword/parry/parry.lua"],
        "class" : "Parry",
    
        "energyUsage" : 0.0,
        "parryTime" : 1.2,
        "cooldownTime" : 1.2,
        "shieldHealth" : 50,
        "stances" : {
          "parry" : {
            "armRotation" : 45,
            "weaponRotation" : -205,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : false
          }
        }
      }
    
    Is in the parry.weaponability file. The parry.lua is the script used for the weapon ability but there are some values in the JSON file that determines certain factors, namely duration, shield health, energy usage, and cooldown. Editing those should let you create different versions of the skills without necessary having to make a new .lua. For example:

    Code:
    "parryTime" : 0.6,
    "cooldownTime" : 0.0,
    "shieldHealth" : 25,
    
    Would make a parry with no cooldown, but with half the duration and half the shield health (it can only block up to half the amount of damage a regular parry before the guard breaks).

    However, that is sort of besides the point of what I am asking, I am more wondering how the .activeitem files reference the weapon abilities. In stable I could just make a new JSON file and directly point it to the new JSON file and it would work, but they seemed to have changed it in the Nightly Version and I can't figure out how to make it look at a new JSON file.

    Edit/Update: And I after deciding to take a look in the buildweapon.lua and noticing the weaponabilities.config file in the buildscripts folder (./items/buildscripts/), I found the file that I need to patch.

    I really should have noticed this sooner, feeling kind of embarrassed now.

    Edit/Update 2: Ok, so I made a patch like so:

    Code:
    [
        { "op" : "add", "path" : "/-", "value" : "quickparry" },
        { "op" : "add", "path" : "/quickparry", "value" : "/items/active/weapons/melee/abilities/broadsword/parry/quickparry.weaponability" }
    ]
    
    And I made the adjustments to a copy of parry that I renamed quickparry.weaponability as so:

    Code:
    "ability" : {
        "name" : "Quick Parry",
        "type" : "parry",
        "scripts" : ["/items/active/weapons/melee/abilities/broadsword/parry/parry.lua"],
        "class" : "Parry",
    
        "energyUsage" : 10.0,
        "parryTime" : 0.6,
        "cooldownTime" : 0.4,
        "shieldHealth" : 25,
        "stances" : {
          "parry" : {
            "armRotation" : 45,
            "weaponRotation" : -205,
            "twoHanded" : true,
    
            "allowRotate" : false,
            "allowFlip" : false
          }
        }
      }
    
    I also removed the references to the parry shield images:

    Code:
    "active" : {
      "properties" : {
        "image" : ""
      }
    },
    "block" : {
      "properties" : {
        "image" : ""
      }
    }
    
    Yet, after I spawn in the sword, it seemed to still use the regular parry. The name didn't change. I turned off /admin, and tried using the parry, my energy didn't drain and the during nor the cooldown seemed to have changed. Furthermore, the parryshield sprite still appeared despite me taking it out of JSON file.

    I don't get any errors in my log file. I then try to spawn the weapon, however it still seems to use the default parry. I turned off admin mode and when I try to parry, my energy didn't decrease, the duration and cooldown stayed the same, and the parryshield sprite still appeared. Did things change somehow so that the JSON file no longer supplies these values to the lua file? Like where does the lua files get their values from now if it is not from the JSON file? It looks like it still grabs some values from the JSON files as the variable names match up, but at the same time it doesn't seem to be the case.

    Really could use some help with this.
     
    Last edited: Jul 9, 2016
    Inf_Wolf14 likes this.
  4. Segenam

    Segenam Phantasmal Quasar

    I'm not sure the exact problem... I've made a couple weapons and the main issue i had was missing the ability in the "items/buildscripts/weaponabilities.config" and I see that you have it listed, how ever I noticed you add the "quickparry" ability twice and only add the info to the second one.

    the patch should just look like this:
    Code:
    [
      {"op": "add","path": "/quickparry","value": "/items/active/weapons/melee/abilities/broadsword/parry/quickparry.weaponability"}
    ]
    I'm not sure if that is your actual problem or not but it's the only thing I can think of at 4:20 AM in the morning.
     
  5. Type-Luna

    Type-Luna Void-Bound Voyager

    The first time was to just add the category, the second time was to add the value since I wasn't sure on how to more efficiently write a patch at the time (only been Starbound Modding for a few days so far). I tried changing it to what you wrote, but I still end up with the same strange issue of it ignoring the values in the json file and using the default parry's values. I actually tried changing the default parry's values and strangely enough, it worked. So, for some reason, the lua file takes the values from the original parry's json file no matter what. I am likely going to take a look and compare Glad Giraffe's lua file for parry and compare it to the nightly's to see if I can figure out what changed. I have a hunch on a possible solution, but I haven't had the time to really delve into it.
     
  6. Segenam

    Segenam Phantasmal Quasar

    In the quickparry.weaponability try changing "type" : "parry" to "type" : "quickparry" and also make sure the weapon can only have the quickparry altAbilities

    I'm mostly just throwing stuff at the wall (from my own code) and seeing what sticks as no one else seems to be trying to help. I've made weapon abilities before but it was mostly a keep changing things until it worked. :nurutease:
     

Share This Page