Modding Help A Few Questions About MP Compatible Weapons

Discussion in 'Starbound Modding' started by Cerlis, Jun 7, 2019.

  1. Cerlis

    Cerlis Void-Bound Voyager

    I've been messing around with RexmecK's item editors, making little toys for use in multiplayer, but there's a few things I can't figure out how to do. I've already tried Googling all this, but I couldn't find anything for it.

    In order of shortest to longest:

    Is there any way to make a gun push back the player while firing? Similar to how the rocket spear can propel the player backwards through space.

    I've modified a gun to shoot ridiculously fast, but it just doesn't feel right without this. Plus, who doesn't want to travel through space using a minigun?


    When I set allowRotate to false for a gun's idle stance, change both armRotation and weaponRotation to 90, the bullet still fires straight ahead. Not upwards where the arm is pointing, backwards where the weapon is aiming, or even towards the crosshair.

    Example.png

    How would I change the direction which the gun fires, while keeping the arm from rotating? Specifically, I'm attempting to make a weapon that rains projectiles from the sky, so I'd want it to fire downwards at all times.


    I'm having trouble with the lightColor parameter for projectiles. I've tried adding it with several different projectile types, weapons, even changing the RGB integers on someone else's far more complex creation which utilized lightColor, but nothing happened.

    Everything I've found through Google claims the parameter works, I dug through SB's projectile files and found the parameter in use, but the only way I can think of to change it would be to modify the original files, which then wouldn't be MP compatible.

    As far as I could tell, lightColor is supposed go inside projectileParameters. Here's that chunk of code, in case I've made a glaring mistake:
    Code:
    {
    "projectileParameters" : {
      "pointLight" : true,
      "lightColor" : [1, 1, 255],
      "actionOnReap" : [{
        "list" : [{
          "type" : "paintexplosionred",
          "action" : "projectile"
         }, {
          "action" : "spark"
         }, {
          "options" : ["/sfx/gun/impact_robotic1.ogg"],
          "action" : "sound"
         }],
        "action" : "actions"
       }],
      "timeToLive" : 0.6,
      "knockback" : 6
    },


    Any advice is appreciated. Even directing me towards a weapon that already achieves any of this would allow me to look through it's code, and help out a ton.
     
    Last edited: Jun 10, 2019
  2. projectmayhem

    projectmayhem Spaceman Spiff

    1) Take a look at the rocket spear lua, you should be able to find what you need in there. you will have to make a custom lua for your gun
    2) take a look at the bow special ability, it forces your arms up, and shoots up, then rains projectiles down
    3) the only thing I can tell you to try, instead of using the projectileParameters in your gun file, make a custom projectile and see if it works that way.

    edit for 3 you may need "supportsProcessing" : true, so give that a try first
     
  3. Cerlis

    Cerlis Void-Bound Voyager

    Just wanting to double check before I start messing around in the files, is this still multiplayer friendly?
    From my very limited understanding, if your items rely on files that the server or other players don't have, it'll cause issues.

    Of course, I'm clearly not an expert on the subject. For all I know Starbound is capable of using custom code, such as .lua and .projectile files, in multiplayer.
     
  4. projectmayhem

    projectmayhem Spaceman Spiff

    ive never played Mp so i have no idea what makes a mod mp friendly and what breaks mp. Im pretty sure if your pushback, you will have to have a custom lua, same for the raining projectile ( i think)
     
  5. Cerlis

    Cerlis Void-Bound Voyager

    First off, thank you for pointing me towards the bow. It had some interesting parameters that I'll be using in the future.

    I asked around, and it appears that .lua files are multiplayer compatible, but if another player picks up the item they'll crash. Unfortunately, .projectile files are not multiplayer friendly.
    Since I'm unfamiliar with Lua, I used some workarounds to accomplish 2. and 3. through JSON instead. I'm still not sure how to make a weapon push the player around, but I've finished the aforementioned 'rain' weapon.



    For anyone wanting to do something similar using JSON, here's some explanations and code snippets:
    My current understanding is that you cannot change the initial projectile's angle, but you can control the angle of a spawned projectile.
    By making the first projectile invisible, setting "timeToLive" to 0, and utilizing "actionOnReap", I was able to spawn a projectile and change it's direction using the "angle", "angleAdjust", and "fuzzAngle" parameters.
    Code:
     "projectileParameters" : {
      "actionOnReap" : [{
        "angle" : 45,
        "type" : "ironarrow",
        "fuzzAngle" : 10,
        "config" : {
         "timeToLive" : 1
        },
        "action" : "projectile"
       }],
      "timeToLive" : 0
    },

    I still haven't figured out how to use "lightColor" with a projectile, or anything else for that matter. Instead, I used particles with the "light" parameter to make my projectiles glow.
    This workaround is best used on a projectile that doesn't already emit light, since it just adds another light source instead of replacing the existing one.
    Code:
        "config"  :  {
         "periodicActions" :  [{
           "time" : 0.01,
           "specification" :  {
            "light" : [255, 0, 0]
           },
           "repeat" : true,
           "action" : "particle"
          }],
         "timeToLive" : 1
        },

    If anyone has advice regarding my first question, I'd appreciate it. Ideally using only JSON, but if it requires Lua after all, that would be be good to know as well.
     
    The | Suit likes this.

Share This Page