Modding Help Trying to make a throwable item that spawns multiple projectiles

Discussion in 'Starbound Modding' started by PistolRcks, Jul 19, 2017.

  1. PistolRcks

    PistolRcks Void-Bound Voyager

    My idea is to have a throwable item (in this case, a kunai) to spawn multiple projectiles similar to a shotgun. My question is if this can be done with JSON coding and the *.thrownitem type. I have been attempting this for a while now and have been going back and forth with making it an actual shotgun, making it a dagger with a shotgun-like secondary and fiddling with the *.thrownitem JSON file. Currently, the *.thrownitem is the only one that works. All of the other items have failed to instantiate with "buildunrandweapon.lua."

    Can anyone help my with this? Can you make a throwable item spawn multiple projectiles, or can you have a shotgun-like Alt Ability without creating extra Lua code?
     
  2. IHart

    IHart Scruffy Nerf-Herder

    You could make a custom projectile like /projectiles/throwable/firework2/firework2.projectile set the "timetolive" to zero that way it immediately splits off, giving the illusion of multiple projectile being fired. You would put in kunai as the "firework3" and have your thrownitem point to your custom projectile.
     
  3. PistolRcks

    PistolRcks Void-Bound Voyager

    Thanks! But is there a way to inherit the parent velocity of the original kunai for the child kunai?
     
  4. IHart

    IHart Scruffy Nerf-Herder

    I'm pretty sure that happens automatically, but it may require "inheritSpeedFactor", I found a better example in /projectiles/guns/unsorted/pollenpumpgas/pollenpumpgasspray.projectile
     
  5. PistolRcks

    PistolRcks Void-Bound Voyager

    Will do! Thanks!
     
  6. lazarus78

    lazarus78 The Waste of Time

    Cant you just... make a new projectile that spawns all the projectiles you want? Just as... all the other projectiles that do just that... already do? IE: trishot
     
  7. PistolRcks

    PistolRcks Void-Bound Voyager

    I will try that as well, thanks!
     
  8. PistolRcks

    PistolRcks Void-Bound Voyager

    a tad broken.png
    I think I did it.
     
    IHart likes this.
  9. PistolRcks

    PistolRcks Void-Bound Voyager

    Turns out you can spawn multiple projectiles with the variable periodicActions in projectileConfig. This is what I did for testingkunai.thrownitem:
    Code:
    {
      "itemName" : "testingkunai",
      "rarity" : "Legendary",
      "category" : "throwableItem",
      "inventoryIcon" : "testingkunai.png",
      "image" : "testingkunai.png",
      "shortdescription" : "Testing Kunai",
      "description" : "A kunai with probably way too much power.",
    
      "ammoUsage" : 0,
      "edgeTrigger" : false,
      "windupTime" : 0.0,
      "cooldown" : 0.1,
    
      "projectileType" : "testingkunai",
      "projectileConfig" : {
        "periodicActions" : [
          {
            "time" : 0,
            "repeat" : false,
            "action" : "sound",
            "options" : [ "/sfx/projectiles/throw_item.ogg" ]
          },
          {
            "time" : 0,
            "repeat" : false,
            "action" : "projectile",
            "type" : "testingkunai",
            "angleAdjust" : 5
          },
          {
            "time" : 0,
            "repeat" : false,
            "action" : "projectile",
            "type" : "testingkunai",
            "angleAdjust" : -5
          },
          {
            "time" : 0,
            "repeat" : false,
            "action" : "projectile",
            "type" : "testingkunai",
            "angleAdjust" : 10
          },
          {
            "time" : 0,
            "repeat" : false,
            "action" : "projectile",
            "type" : "testingkunai",
            "angleAdjust" : -10
          }
        ]
      }
    }
    Also, I added two bounces and piercing to the projectile. It's... a bit broken.
    Last question: can I adjust the positions of the secondary projectiles instead of the angles?
    Actually, better yet, is there a place that contains all the JSON variables in Starbound?
     
  10. IHart

    IHart Scruffy Nerf-Herder

  11. Spacedino

    Spacedino Ketchup Robot

    Last edited: Jul 21, 2017
  12. PistolRcks

    PistolRcks Void-Bound Voyager

    Funny that you mention that, because I noticed not only that yesterday, but also a suite of plugins for Starbound coding in the text editor Atom. It's pretty nice.
     

Share This Page