1. These forums are archived and available in read-only format. No new accounts may be created and content may not be added or edited. This archive is dedicated to hoshiwara.t who tragically passed away in April of 2015. She will be forever missed.

StarCheat Project: Flashlights

Discussion in 'General Discussion' started by Cole Ombre, Jul 7, 2014.

  1. Cole Ombre

    Cole Ombre Lurking Admin

    Joined:
    Feb 11, 2014
    Messages:
    370
    Likes Received:
    7
    So ive long been working on trying to add a working flashlight onto a gun in starcheat, ya know, like an undermounted flashlight. Problem is, I havent figured it out yet. Seeing as there are a few starcheat literate people on here that could help, Im putting this out there in case anyone else wants a crack at it. Have a working gun, with a flashlight like underneath it or something. That would remove the need for "helmet lights" that light up a sphere around you, and I think would be better fro RP immersion.
    Anyway, if anyone gets this to work I'd love to know, and would reward you with many much internet brownie points.
     
  2. Goldsum

    Goldsum New Member

    Joined:
    Apr 27, 2014
    Messages:
    139
    Likes Received:
    0
    Well, here is the code for the flashlight item
    Code:
    {
      "itemName" : "flashlight",
      "inventoryIcon" : "flashlighticon.png",
      "dropCollision" : [-4.0, -3.0, 4.0, 3.0],
      "rarity" : "Uncommon",
      "maxStack" : 1,
      "description" : "A handy flashlight! Seems to be powered by my energy pool.",
      "shortdescription" : "Flashlight",
      "largeImage" : "flashlightlarge.png",
      "inspectionKind" : "tool",
      "image" : "flashlight.png",
      "handPosition" : [-2, 0],
      "lightPosition" : [4, 0],
      "lightColor" : [255, 255, 255],
      "beamWidth" : 0.1,
      "ambientFactor" : 0.5
    }
    
    So here are the parts that make the light part on the flashlight:
    Code:
    "lightPosition" : [4, 0],
      "lightColor" : [255, 255, 255],
      "beamWidth" : 0.1,
      "ambientFactor" : 0.5
    You can plug these things into yoru starbound item to add a light, but you will probably need to change the light position, and you might want to change the light color too. This is providing you can figure out how to use starcheat enough to plug this stuff in. I would provide a more I depth tutorial but I'm not at my computer right now :/.
     
  3. M-Bot

    M-Bot #swellest

    Joined:
    Apr 4, 2014
    Messages:
    492
    Likes Received:
    0
    Already tried plugging those variables in as extras, doesn't work. Didn't have enough time to try anything in-depth, though, so it might tie into the existing projectile code in some way. I'll do some tests tonight when I have more time.
     
  4. Aromyl

    Aromyl Mad Coder

    Joined:
    Apr 9, 2014
    Messages:
    753
    Likes Received:
    0
    From what I understand, plugging in variables to a weapon wouldn't work. The variable "itemName" dictates what type of item the item will be. Since this is a flashlight, it will look for the variables related to the flashlight class(es), in this case, lightPosition, lightColor, beamWidth, and ambientFactor are included. Now, if you have a generatedgun, it won't be looking for variables related to producing a light beam.

    I've been wondering the same thing, with the ability to add on a directional light to a weapon, and haven't found any leads about it yet. I'll be messing around with some files later, and if I stumble upon anything, I'll be sure to post it here.
     
  5. Sen

    Sen Guest

    You can't do it with StarCheat alone.
     
  6. LaserLlamas

    LaserLlamas Mother of the Pack

    Joined:
    Mar 28, 2014
    Messages:
    560
    Likes Received:
    0
    My suggestion would be build whatever the part would be on the gun into its own item (IE the Undermounted Flashlight, whatever model you're going to make that). Make the weapon you wish to use it on one handed, and then hold both the weapon and your flashlight in each hand to make it look as though it's undermounted.

    That's the best I've got without mods.
     
  7. Cole Ombre

    Cole Ombre Lurking Admin

    Joined:
    Feb 11, 2014
    Messages:
    370
    Likes Received:
    7
    Tried this, like he said, doesnt work. This was actually the first thing i tried. Also, might just be a syntax error, but whenever I try adding the flashlight png to a weapon sprite, it erases the rest of the randomgenerated png's and just has the flashlight. Maybe if there was someway to get two item names doen, randomwweapon or whatever and flashlight, might work. Or maybe make a mod? Cus im pretty sure you can mess with the assets files and change around the base coding to allow generated gun to use the beamWidth etc variables if you need to.

    On a sidenote, Im also looking of rthe variable to change the width of the glow effect on helmets, similar to the beamWidth varibale for the flashlight that limits it to the conical shape it is.
     
    #7 Cole Ombre, Jul 7, 2014
    Last edited by a moderator: Jul 7, 2014