Tutorial Primary / Alt Ability Advice

Discussion in 'Starbound Modding' started by ImHereForTheMods, Feb 26, 2017.

  1. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    So, I was gonna make another rambling thread about how I was having trouble adding an ability to a staff, but then I figured it out myself. So, I thought to myself, why not make a thread with some suggestions for begginers / others, to help them if they are struggling with what I was?

    So, in this somewhat short tutorial / advice sort of thread, I'm just going to give you some general advice of what to do if you can't get your primary or alt ability to work.

    I myself have struggled with getting abilites to work, multiple times, and I'm going to give you some advice based on what helped me to get the abilities working.

    -------------------------------------------------------------------------------------------------------------

    1. Unpack your game assets.
    This can't be said enough, and is a REALLY important part of the modding process. The game assets are essential for referencing to help create mods. You can find many files, in the assets which will give you ideas on what to try, to get your abilities working. Such as weaponability files, but we'll get more into that later.

    The best way to unpack the game is with this tool :
    http://community.playstarbound.com/threads/all-versions-win-linux-modpackhelper.92473/
    I believe it also shows you how to use it there, so I won't go into that too much.

    Once you have unpacked the assets, you can try the following methods.

    -------------------------------------------------------------------------------------------------------------

    2. Verify that the ability you are trying to add is actually useable on the type of weapon you are making.
    A great way to do this, is by going to :
    assets\_unpacked\items\active\weapons
    and then navigate to the type of weapon you are trying to add an ability for.
    Usually, when you go to the type of weapon you are trying to add an ability to, you will see a folder called "abilities" or, something similar, in there. Open that.

    For instance, if I am trying to find out what kind of abilities I can add to a spear, I would go to :
    \assets\_unpacked\items\active\weapons\melee\abilities\spear
    and there I can see, listed, the kinds of abilities I can add to my spear mod.

    -------------------------------------------------------------------------------------------------------------

    3. Adding the ability you found (sort of)

    Usually the name for the ability you would put in for :
    "primaryAbilityType": "ABILITY_TYPE",
    or
    "altAbility": {
    "type" : "ABILITY_TYPE",
    (where ABILITY_TYPE is)
    would be the name of the folders you would see in :
    assets\_unpacked\items\active\weapons\melee\abilities\spear

    for example : barrier / charge / elementalspin / flurry / rocketspear / spin
    are the names of the abilities, which can be substituted in like so :
    "altAbility": {
    "type" : "barrier",

    -------------------------------------------------------------------------------------------------------------

    4. A general note on abilities
    Some abilities have to have an elemental type (other than physical)
    for example : fire, poison, ice, or electric...
    in order to work / work properly .

    Some example of these abilities that would require an elemental type (other than physical) would be elemental spin / rocketspear / barrier (for spears).

    You can generally tell if the ability requires such an elemental type, if you open it's .weaponability file . . .
    (let's use rocketspear as an example) and you see "elementalConfig" in there, followed by element related stuff.Or, if the name of the folder has elemental in it, such as like with elementalspin.

    -------------------------------------------------------------------------------------------------------------

    5. Check .weaponability files, related to the ability you are trying to add. For instance, if you are trying to add the elementportal ability to a staff mod, look for the elementportal.weaponability file.
    In this case, we can find it at : \assets\_unpacked\items\active\weapons\staff\abilities\controlprojectile

    Then we see elementportal.weaponability.

    If we open that, we will see some of the code related to adding that ability to our mod.

    Let's say we have a ability section like this:

    Code:
      "primaryAbilityType" : "elementportal",
      "primaryAbility" : {},
    
      "altAbilityType" : "elementbouncer",
      "altAbility" : {},
    (which wont make the ability work properly by the way, since the code is too generic at this stage)

    We can use the code from the weaponability file of the elementportal.weaponability file, and the elementbouncer.weaponability file, to expand upon this code (often useful for making it work by giving the game more info to work with).

    For example, we can expand the code like this :
    Code:
    "primaryAbilityType": "elementportal",
        "primaryAbility": {
            "type": "elementportal",
            "name": "Fire Portal",
            "scripts": ["/items/active/weapons/staff/abilities/controlprojectile/controlprojectile.lua"],
            "class": "ControlProjectile",
    
            "energyCost": 100,
    
            "maxCastRange": 25,
    
            "projectileType": "fireportal",
            "projectileParameters": {
                "baseDamage": 6
            }
        },
    
    
        "altAbility": {
        "type" : "elementbouncer",
        "name" : "Fire Bouncer",
        "scripts" : ["/items/active/weapons/staff/abilities/controlprojectile/controlprojectile.lua"],
        "class" : "ControlProjectile",
    
        "energyCost" : 75,
    
        "maxCastRange" : 25,
    
        "projectileType" : "firebouncer",
        "projectileParameters" : {
          "baseDamage" : 6
        }
      },
    It may look complicated, but all we really did was copy the "ability" section from the elementalportal.weaponability file (seen here) :

    {
    "ability" : {
    "type" : "elementportal",
    "name" : "<elementalName> Portal",
    "scripts" : ["/items/active/weapons/staff/abilities/controlprojectile/controlprojectile.lua"],
    "class" : "ControlProjectile",

    "energyCost" : 100,

    "maxCastRange" : 25,

    "projectileType" : "<elementalType>portal",
    "projectileParameters" : {
    "baseDamage" : 6
    }
    }
    }


    and the elementbouncer.weaponability file, seen here :

    {
    "ability" : {
    "type" : "elementbouncer",
    "name" : "<elementalName> Bouncer",
    "scripts" : ["/items/active/weapons/staff/abilities/controlprojectile/controlprojectile.lua"],
    "class" : "ControlProjectile",

    "energyCost" : 75,

    "maxCastRange" : 25,

    "projectileType" : "<elementalType>bouncer",
    "projectileParameters" : {
    "baseDamage" : 6
    }
    }
    }



    and changed some info, to make the ability suit our mod. For example, changing the <elementalName> and <elementalType> spots to make them say fire instead, as this is the elemental type we want.

    -------------------------------------------------------------------------------------------------------------

    6. VALIDATE YOUR ACTIVEITEM FILE WITH JSONLINT : http://jsonlint.com/
    If the mod is crashing the game, then likely, there is a json error.
    Not to worry though. Just run it through jsonlint, and it will tell you where you went wrong.

    Likely what you need to do is add a bracket { or } .... or add a comma, after a bracket },
    or maybe you need to delete an extra comma, either way, it is pretty intuitive, and you should be able to figure it out.


    Anyways, this is just some info I found out workng with abilities myself through trial and error.
    Hopefully this info can be of some use to someone, so they can have an easier than I did with it. =P

    Thanks for reading, and I do hope this post has helped you in some way!
    Happy modding !
     
  2. The | Suit

    The | Suit Agent S. Forum Moderator

    The Tool tag - is only for people who develop 3rd party tools.
    Changed to tutorial.
     
  3. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    Ah, thanks.
     
  4. Kiyo Haribusa

    Kiyo Haribusa Void-Bound Voyager

    so is it possible to put the aegisalt beam of a staff?
    vary curious.
     

Share This Page