Modding Help Adding lighting effects to weapons

Discussion in 'Starbound Modding' started by Heiixx, Dec 12, 2013.

  1. Heiixx

    Heiixx Space Hobo

    I'm currently working a lightsaber mod, and I have the all the images, stats, and sfx working.
    The problem is, I want them to give off light/heat. Does anyone know if or how those effects can be added to weapons?
     
  2. tifel100

    tifel100 Void-Bound Voyager

    I went on the flashlight item to check how it emits light
    Code:
      "lightPosition" : [4, 0],
      "lightColor" : [255, 255, 255],
      "beamWidth" : 0.1,
      "ambientFactor" : 0.5
    
    Try tinkering around with that.

    Can't thing of any weapon that gives you light yet.
    And do you mean constant light? or only when you slash?
     
    Heiixx likes this.
  3. Heiixx

    Heiixx Space Hobo

    Constant light in this case. Because I'm using a single .generatedsword file, I'll only be able to use one color of light, since the file links to several different colored blades. I was looking at the torches for some reason, which would explain why it wasn't working. An object and an item act differently, and probably have different function parameters.

    I'll tinker with putting the flashlight code in a weapon file. Here's hoping for good results...
     
  4. Antec5000

    Antec5000 Intergalactic Tourist

    Let us know how this works out. I would be really interested to see if this works well.
     
  5. Heiixx

    Heiixx Space Hobo

    Well, I tried putting these lines all over the .generated file. Above the stances, inside the stances... no luck.

    Then I tried putting these lines in all the same places. Still no luck.

    I'm thinking that flashlights and torches, tool and object categories respectively, may have some different functionality in the code somewhere. Either that, or I don't understand quite enough about what each of parameters is doing and where they should be located.

    Either way, I'm stuck trying trial and error at this point, and it's going slowly.
     
  6. Antec5000

    Antec5000 Intergalactic Tourist

    Hrm.. seems like it should work the way you tried it. I'll have to take a look at this when I get home from work. I'll let you know if I make any findings on this.
     
  7. tifel100

    tifel100 Void-Bound Voyager

    Try it on an item like a brain extractor not a generated item, that might be the problem. See if it works like that. I'll try to tinker with this too.
     
  8. cardstocks

    cardstocks Tentacle Wrangler

    you have to change the category of the item:


    "category" : "light",
    "lightColor" : [255, 75, 64],
    "flickerDistance" : 0.2,
    "flickerStrength" : 0.05,
    "flickerTiming" : 4,

    that'll do it.
     
    Heiixx likes this.
  9. Heiixx

    Heiixx Space Hobo

    But will the item still reference all the appropriate weapon information?
     
  10. tifel100

    tifel100 Void-Bound Voyager

    I don't think category has to do with anything. it's just where it would be in the crafting and such.
     
  11. cardstocks

    cardstocks Tentacle Wrangler

    yeah i promise that works. I've made a teleporter item and it glows and flickers like no body's business. just put that above the rest of the light info like so:


    {
    "objectName" : "teleportmarker",
    "rarity" : "Common",
    "description" : "A teleport marker--when I could walk but this is just way easier...",
    "shortdescription" : "Teleport Marker",
    "race" : "generic",

    "apexDescription" : "Teleporting feels like riding a rollercoaster at the speed of light.",
    "avianDescription" : "Teleporting feels like flying.",
    "floranDescription" : "Floran feel confusssed during teleport.",
    "glitchDescription" : "Educate. I set myself to sleep during the teleport process.",
    "humanDescription" : "Teleporting is a huge rush.",
    "hylotlDescription" : "Teleporting feels like diving into the ocean from a mountain top.",

    "category" : "light",
    "lightColor" : [255, 75, 64],
    "flickerDistance" : 0.2,
    "flickerStrength" : 0.05,
    "flickerTiming" : 4,

    "inventoryIcon" : "teleportericon.png",
    "orientations" : [
    {
    "dualImage" : "teleporter.png",

    "imagePosition" : [-16, 0],
    "frames" : 1,
    "animationCycle" : 0.5,

    "spaceScan" : 0.1,
    "anchors" : [ "bottom" ],
    "collision" : "solid"

    }
    ],
    "soundEffect" : "/sfx/objects/bunkerdisplay4.wav",
    "soundEffectRadius" : 50
    }
     
  12. tifel100

    tifel100 Void-Bound Voyager

    It only worked because it's an object. You basically made an object work like a torch, which is pretty basic to make a placeable object emit light.
     
  13. cardstocks

    cardstocks Tentacle Wrangler

    oh gosh, i thought he was just making a light.... lightSABER. OP could look at the backpack light mod. I'll find the link to it

    edit: couldn't find one that did what OP wants. You could put an augment on it.
     
    Last edited: Dec 13, 2013
  14. Heiixx

    Heiixx Space Hobo

    Tried those four lines of code in all of the following areas with no success.
    It should be also be noted that placing the four lines of lighting code in any of those locations also does not cause the item to stop working. It just doesn't actually cause any light to occur.
    Here's a link to the actual mod to help give some context.

    http://community.playstarbound.com/index.php?threads/laser-swords.49227/

     
  15. tifel100

    tifel100 Void-Bound Voyager

    I'll try to get more into testing out items emitting lights tomorrow.
     
  16. Heiixx

    Heiixx Space Hobo

    The glowing works now!
    Here's the new code...

    The items have a status effect to emit light now. This code was in the lantern backpack file. It is important to note that the lighting MUST be placed inside the stances. Placing the lighting above the stances had no effect for me.

    The exact lines that need to be added for as follows:

    NOTE: If the item already has a "statusEffects" array, BE SURE to place a comma after the first statusEffect, in this case the "shieldsuppressed" effect.

    Thanks everyone for the help and input!
     
  17. tifel100

    tifel100 Void-Bound Voyager

    Great job.
     
  18. Antec5000

    Antec5000 Intergalactic Tourist

    Sweet!! Great to hear this is now working!!
     

Share This Page