Modding Help Scorpion Spear

Discussion in 'Starbound Modding' started by kirbydunker85, Dec 16, 2013.

  1. kirbydunker85

    kirbydunker85 Poptop Tamer

    Got an idea to learn how to make either a weapon that shoots projectiles, or a thrown weapon. I decided I wanted to recreate the infamous 'get over here' spear from Mortal Kombat used by Scorpion. I'm at this point so far, but it comes up as a Perfectly Generic Item.

    scorpionspear.thrownitem

    Code:
    {
      "itemName" : "scorpionspear",
      "rarity" : "Common",
      "inventoryIcon" : "scorpionspearicon.png",
      "image" : "scorpionspear.png",
      "shortdescription" : "The "Get Over Here" Spear",
      "description" : "Get Over Here!",
    
      "ammoUsage" : 1,
    
      "edgeTrigger" : true,
      "windupTime" : 0.0,
      "cooldown" : 0.4,
    
      "projectileType" : "scorpionspearprojectile",
      "projectileConfig" : {
        "speed" : 70,
        "power" : 100
      }
    }
    
    scorpionspearprojectile.projectile

    Code:
    {
      "projectileName" : "scorpionspearprojectile",
      "frames" : scorpionspear.png",
      "animationCycle" : 0.5,
      "level" : 3,
      "frameNumber" : 4,
      "power" : 50,
    
      "lightColor" : [255, 180, 0],
      "damageKind" : "slash"
    }
    
    scorpionspearprojectile.frames

    Code:
    {
      "frameGrid" : {
        "size" : [190, 24],
        "dimensions" : [4, 1],
    
        "names" : [
          [ "0", "1", "2", "3" ]
        ]
      }
    }
    
    
    Also, here are the .png files I've created for it

    scorpionspearprojectile.png

    [​IMG][​IMG]

    scorpionspearicon.png

    [​IMG]

    scorpionspear.png

    [​IMG]

    I'm pretty sure it has to do with the frames, as I have no clue on how to set parameters to tell the game what pixels to grab or whatever, I'm clueless!

    Edit 1: Updated scorpionspearprojectile.frames code to "frames" : scorpionspear.png,"

    Edit 2: Updated scorpionspearprojectile.png so they are in a row.

    Edit 3: Edited scorpionspearprojectile.frames
     
    Last edited: Dec 16, 2013
  2. Letalis

    Letalis Subatomic Cosmonaut

    Lol this is a cool idea. though i dont know if i want some of those monsters to be that close they are after all a huge pain in the butt to begin with usually.
     
    kirbydunker85 likes this.
  3. Dubzero1337

    Dubzero1337 Intergalactic Tourist

    Download link?
     
  4. Dubzero1337

    Dubzero1337 Intergalactic Tourist

    Question:Mods working in multiplayer?
     
  5. kirbydunker85

    kirbydunker85 Poptop Tamer

    It's not working yet, it's coming up as a perfectly generic item. I am like the dog sitting at the computer right now. I have no idea what I'm doing.


    Edit: If someone more proficient than me can figure it out, you can take all of the assets I've posted. I just want to learn how to mod =P.
     
  6. Nightmares

    Nightmares Scruffy Nerf-Herder

    " "frames" : "scorpionspearprojectile.frames","

    looks like that should be scorpionspearprojectile.png

    Or whatever the png is called
     
    Last edited: Dec 16, 2013
  7. Nightmares

    Nightmares Scruffy Nerf-Herder

    Also, the .png might be set up wrong. I'd suggest putting each image all in a row so ---> -~~> ~~~> or whatever.

    Then you need to fix your .frames file.

    "size" : [16, 16], - This means that each frame in the sprite sheet is 16px by 16px (x by y).
    "dimensions" : [8, 1], - This means that there are 8 frames on the x axis and only 1 row of frames in the sprite sheet.
    These numbers are just examples, you'll have to figure out yours.

    Edit: a frame is a single image from the animation. You have 4 frames.
     
  8. kirbydunker85

    kirbydunker85 Poptop Tamer

    Updated the .frames file to this...

    Code:
    {
      "frameGrid" : {
        "size" : [190, 24],
        "dimensions" : [4, 1],
    
        "names" : [
          [ "0", "1", "2", "3" ]
        ]
      }
    }
    
     
  9. Nightmares

    Nightmares Scruffy Nerf-Herder

    That looks good to me. Did you change where you had .frames to .png?
     
  10. kirbydunker85

    kirbydunker85 Poptop Tamer

    Getting this error from the starbound.log

    Code:
    Warn: Slow asset 0.121 : /projectiles/scorpionspearprojectile/scorpionspearprojectile.projectile
    Debug: Correcting path from /projectiles/npcs/staticfireball/staticfireball.projectile to /projectiles/npcs/staticFireball/staticFireball.projectile
    Error: Exception caught in Thread Async root loader: StarException: Failed to load projectile '/projectiles/scorpionspearprojectile/scorpionspearprojectile.projectile
      ... (2)
      004DCF5F (C:/starbound/source/game/StarRoot.cpp:154)
      004016D8 (C:/starbound/source/client/StarClientApplication.cpp:302)
      0095162C (C:/starbound/source/core/StarThread_windows.cpp:74)
      76C533AA
      77259EF2
      77259EC5
    
    Warn: Perf: StarApplicationBase::run.innerLoop millis: 151
     
  11. kirbydunker85

    kirbydunker85 Poptop Tamer

    I got the game to run again, I commented out the damageKind and LightColor variables in the scorpionspearprojectile.projectile file. I put those back in. Game boots, but found this error

    Code:
    Error: Could not load /items/throwables/scorpionspear/scorpionspear.thrownitem asset, attempting to use default.
    AssetException: Could not read variant asset /items/throwables/scorpionspear/scorpionspear.thrownitem
    caused by: JsonParsingException: Cannot parse json file: /items/throwables/scorpionspear/scorpionspear.thrownitem
    caused by: JsonParsingException: Error parsing json: bad object, should be '}' or ',' at 6:30
      0097EC08 (C:/starbound/source/core/StarVariant.hpp:15)
      007CE6A2 (C:/starbound/source/core/StarVariant.cpp:159)
      004EAB1C (C:/starbound/source/core/StarVariant.hpp:27)
      004E2B3F (C:/starbound/source/game/StarAssets.cpp:974)
      ... (4)
      004EE011 (C:/starbound/source/game/StarAssets.cpp:695)
      0095162C (C:/starbound/source/core/StarThread_windows.cpp:74)
      76C533AA
      77259EF2
      77259EC5
    
    Warn: Slow asset 0.078 : /items/throwables/scorpionspear/scorpionspear.thrownitem

    EDIT: Update, Got the item in my game finally, realized the description had a quotation mark in it, that was keeping the asset from loading. The item loads, now the problem is I try throwing it and the game crashes >.<.
     
    Last edited: Dec 16, 2013
  12. kirbydunker85

    kirbydunker85 Poptop Tamer

    Update: Got it to work in game, and damage. Turns out I didnt need to add .png to "projectileType" : "scorpionspearprojectile", after all. Now I'm tweaking it to make it look half way decent. Also, I'd like to add sound effects. Just don't know how.

    Also, the animation cycle is all bonkers, it goes from the first frame to the last, over and over, and also switches the positions of each frame over and over.
     
    Last edited: Dec 16, 2013
  13. Nightmares

    Nightmares Scruffy Nerf-Herder

    Playing a sound should be pretty simple, look at some other things that play a sound when they're activated, they would normally call a lua or config file from actionOnReap. As for your animation not working, I'm not quite sure what to say. The images are really quite similar, are you sure it's actually skipping the middle two?
     
  14. kirbydunker85

    kirbydunker85 Poptop Tamer

    I'm not sure I follow, here is what I have so far. Loads item, etc. doesn't work.

    Code:
    "firesound" :  { "mk_harpoon" : [ { "file" : "/sfx/projectiles/mk_harpoon.wav" } ] }
    Not sure about how to find the config files for sfx or make one.

    Also, could it be because I'm using a throwing item config file?
     
    Last edited: Dec 17, 2013
  15. Nightmares

    Nightmares Scruffy Nerf-Herder

    a good example on how to play a sound from a projectile is the explosivebullet.projectile:
    Code:
    {
      "projectileName" : "explosivebullet",
      "frames" : "explosivebullet.png",
      "animationCycle" : 0.25,
      "armorPenetration" : 3,
      "frameNumber" : 1,
      "energyCostPerDamagePoint" : 25,
      "damageKindImage" : "icon.png",
      "pointLight" : false,
      "actionOnReap" : [
        {
          "action" : "config",
          "file" : "/projectiles/explosions/vsmallregularexplosion/vsmallregularexplosion.config"
        }
      ],
      "power" : 5.0,
      "damageType" : "hitTest",
      "damageKind" : "default"
    }
    if you look at the actionOnReap, it calls an action called config and puts the absolute path to vsmallregularexplosion.config
    If we go to that config file we see this:

    Code:
    {
      "action" : "actions",
      "list" : [
        {
          "action" : "projectile",
          "inheritDamageFactor" : 1,
          "type" : "vsmallregularexplosion"
        },
        {
          "action" : "loop",
          "count" : 10,
          "body" : [
            {
              "action" : "spark"
            }
          ]
        },
        {
          "action" : "sound",
          "options" : [ "/sfx/gun/grenadeblast1.wav", "/sfx/gun/grenadeblast2.wav", "/sfx/gun/grenadeblast3.wav" ]
        },
        {
          "action" : "light",
          "color" : "orange"
        },
        {
          "action" : "explosion",
          "foregroundRadius" : 1,
          "backgroundRadius" : 0,
          "explosiveDamageAmount" : 0.5,
          "delaySteps" : 2
        }
    
      ]
    }
    There's lots of things you can do we the config. You can set more actions for the projectile (animations could go here too), if you wanted it to choose 1 sound out of three you could do that here too.
    The part you're looking at is similar to the action: config part of the previous page. It says "action" : "sound" when this action is triggered (which will be when the projectile is activated) it will play one of those sounds (.wav).

    There are lots of free open source sounds on the internet that you can use, if they're not in .wav, find a program to convert them. I use Audacity (because free is always better). With audacity you can also record your own sounds.
     
  16. Nightmares

    Nightmares Scruffy Nerf-Herder

    Actually, you could probably put the action from the config into the .projectile action area and skip the whole second part
     
  17. kirbydunker85

    kirbydunker85 Poptop Tamer

    scoprionspearprojectile.config

    Code:
    {
          "action" : "sound",
          "options" : [ "sfx/projectiles/mk_harpoon.wav" ]
        }
    
        
    scorpionspearprojectile.thrownitem

    Code:
    {
      "itemName" : "scorpionspear",
      "rarity" : "Common",
      "inventoryIcon" : "scorpionspearicon.png",
      "image" : "scorpionspear.png",
      "shortdescription" : "The Get Over Here Spear",
      "description" : "Get Over Here!",
    
      "ammoUsage" : 0,
    
      "edgeTrigger" : false,
      "windupTime" : 0.1,
      "cooldown" : 1.0,
    
      "projectileType" : "scorpionspearprojectile",
      "projectileConfig" : {
        "speed" : 75,
        "power" : 9001,
    
    "actionOnReap" : [
        {
          "action" : "config",
          "file" : "/projectiles/scorpionspearprojectile.config"
        }
      ]
       
    }
    
    }
    New problem, when it tries to play the .wav file, the game crashes, and it didn't crash when it played the explosive bullet effect and sound.
     
  18. Nightmares

    Nightmares Scruffy Nerf-Herder

    is your .wav saved in the proper folder?

    Edit: sfx should be in the assets (or mods) directory. Put a / in front of it just to be safe
     
  19. tifel100

    tifel100 Void-Bound Voyager

    Code:
    {
    "action" : "sound",
    "options" : [ "sfx/projectiles/mk_harpoon.wav" ]
    }
    
    This is your problem,
    This: "options" : [ "sfx/projectiles/mk_harpoon.wav" ]
    Should be this: "options" : [ "/sfx/projectiles/mk_harpoon.wav" ]
     
  20. kirbydunker85

    kirbydunker85 Poptop Tamer

    Oh, lmao thanks a lot I'm laughing right now how dumb I am.

    And it still crashes the game. Yes, the .wav file is in the proper folder.

    Oh, and I'd also like to know if there is a command to 'activate a sound on use', the sound seems to only be activating when it hits an object.
     
    Last edited: Dec 17, 2013

Share This Page