Modding Help Halp!!! How do Shield go shiny?!?

Discussion in 'Starbound Modding' started by Cen Silver, Apr 9, 2017.

  1. Cen Silver

    Cen Silver Phantasmal Quasar

    I'm trying to add a purdy glowy shield fur mah mod, but there are no glowy shields in Starbound so I'm taking a huge beating trying to understand how do work glowing stuff!!!
    could someone please gimme hand and tell me if I'm doing dis right?!? Any tips are appreciated... ->A<-

    Pls be gentle, I literally never in my entire life tried anything even remotely close to programming until now... all this confusing text cobbled up is hard to get used to, and everything I've understood so far from what I didn't know was by sheer trial and error (Which I am STILL doing even right now)... xAx"""


    {
    "globalTagDefaults" : {
    "hand" : "near",
    "directives" : ""
    },

    "animatedParts" : {
    "stateTypes" : {
    "shield" : {
    "default" : "idle",
    "states" : {
    "idle" : {},
    "raised" : {},
    "block" : {
    "frames" : 1,
    "cycle" : 0.12,
    "mode" : "transition",
    "transition" : "raised"
    }
    }
    }
    },
    "parts" : {
    "shield" : {
    "properties" : {
    "zLevel" : 1,
    "centered" : true,
    "transformationGroups" : ["shield"],
    "rotationCenter" : [0, 0],
    "shieldPoly" : [ [-0.5, -1.75], [-0.5, 1.75], [0.75, 1.0], [0.75, -1.0] ]
    },
    "partStates" : {
    "shield" : {
    "idle" : {
    "properties" : {
    "image" : "<partImage>:<hand>idle<directives>"
    }
    },
    "raised" : {
    "properties" : {
    "image" : "<partImage>:<hand>raised<directives>"
    }
    },
    "block" : {
    "properties" : {
    "image" : "<partImage>:<hand>raised<directives>",
    "offset" : [-0.25, 0]
    }
    }
    }
    }
    }
    }
    "shieldfullbright" : {
    "properties" : {
    "zLevel" : 2,
    "centered" : true,
    "fullbright" : true,
    "image" : "<partImage><paletteSwaps>?<directives>",
    "transformationGroups" : ["shield"],
    "rotationCenter" : [0, 0],
    "shieldPoly" : [ [-0.5, -1.75], [-0.5, 1.75], [0.75, 1.0], [0.75, -1.0] ]
    }
    },
    "partStates" : {
    "shield" : {
    "idle" : {
    "properties" : {
    "image" : "<partImage>:<hand>idle<directives>"
    }
    },
    "raised" : {
    "properties" : {
    "image" : "<partImage>:<hand>raised<directives>"
    }
    },
    "block" : {
    "properties" : {
    "image" : "<partImage>:<hand>raised<directives>",
    "offset" : [-0.25, 0]
    }
    }
    }
    }
    },

    "transformationGroups" : {
    "shield" : {},
    "shieldfullbright" : {}
    },

    "lights" : {
    "glow" : {
    "position" : [0, 2.0],
    "color" : [0, 90, 140],
    "transformationGroups" : ["shield"]
    }
    },

    "sounds" : {
    "raiseShield" : [ ],
    "lowerShield" : [ ],
    "perfectBlock" : [ ],
    "block" : [ ],
    "break" : [ ]
    },

    "particleEmitters" : {
    "perfectBlock" : {
    "active" : false,
    "transformationGroups" : ["shield"],
    "emissionRate" : 14,
    "offsetRegion" : [-0.5, -1.0, 0.5, 1.0],
    "particles" : [
    { "particle" : "protectorblade"},
    { "particle" : "protectorblade2"}
    ]
    "shieldfullbright" : {
    "active" : false,
    "transformationGroups" : ["shield"],
    "emissionRate" : 10,
    "offsetRegion" : [-0.5, -1.0, 0.5, 1.0],
    "particles" : [
    { "particle" : "protectorblade},
    { "particle" : "protectorblade2"}
    ]
    }
    }
    }
    }


    I'm trying to make it act like a "powered" Shield and glow only when raised, and like the like the Violium Broadsword does when swung, (Also make only the "fullbright" image file for it actually be fullbright) but I can't seem to be able to make the fullbright part of it render ingame... what am I doing wrong?!? ;A;


    Also, those " "image" : "<partImage>:<hand>idle<directives>""

    I can't tell what do I do with them!!! what do they even do?!? Do I keep them like that?!? Do I change all to "<partImage><paletteSwaps>?<directives>"?!? Do I put something else entirely in there?!? HALP!!! ;A;

    EDIT: Aaaaand now it's only giving me a genericitem... sigh... ;-;

    EDIT 2: Yay back to rendering! (Now to find out how the heck do I make it render the fullbright image with fullbright on top...)

    EDIT 3: I CANT ADD THE FULLBRIGHT PART WITHOUT BREAKING IT AND MAKING IT SPAWN A GENERIC ITEM AGAIN WHY AAAAAAAAAAAAAAAAAAAA!!!!!
     
    Last edited: Apr 9, 2017
  2. bk3k

    bk3k Oxygen Tank

    Your log probably tells why you get a PGI. Probably screwing up your commas
     
  3. IHart

    IHart Scruffy Nerf-Herder

    i was curious so i fixed the animation file.

    edit: if you still experience errors share your activeitem file.
     

    Attached Files:

    Cen Silver likes this.
  4. Cen Silver

    Cen Silver Phantasmal Quasar

    Updated a lot since then... I screwed up SO MANY commas... ;w;

    #killmepls

    Speaking of which, why did noone and no tutorial ever mentioned linting and linting tools?!? THEY ARE THE BEST THING EVER OMFG!!!!! \o/

    SERIOUSLY WHY ISN'T EVERYONE AND THEIR MOTHER IN THIS COMMUNITY MENTIONING LINTING?!? ITS JUST SO FKN USEFUL!!!!!

    Oh, and I also screwed up filenames, tags, names...

    It's like I'm just randomly typing stuff without a clue... ;w;

    ANYWAY!

    I've progressed a lot since muh last edit. ^^

    The shield now works with the glowy part of the coding (yay!), but I still can't get the game to render the image of the glowy (fullbright) part of the shield... maybe you guys can teach me teh way...? ;w;

    Oh, and for the sake of consistency and easing the whole process, I'll just upload the whole shield's folder, so you guys can have a better idea what I'm trying to do! ^^
     

    Attached Files:

  5. IHart

    IHart Scruffy Nerf-Herder

    Opening and closing brackets are pretty important. what should have been
    Code:
    "parts":{
      "shield":{...},
      "shieldfullbright":{...}
    }
    was instead
    Code:
    "parts":{
      "shield":{...}
    },
    "shieldfullbright":{...}
     

    Attached Files:

    Cen Silver likes this.
  6. Cen Silver

    Cen Silver Phantasmal Quasar

    Thank you so much!!! \o/

    I know how important all that punctuation stuff is in coding, it's just hard to keep track to what goes where with so much text between each stuff... ;-;
    (As said before, I've literally never coded before in my life, I just started this week...)

    BTW now the little blue glow aura emanating from the shield I had before is vanished now... what happened? Why is it no longer working?!? D :

    EDIT: Also, how can I make the glow only appear when the shield is on?

    EDIT 2: The .animation file seems fine to me... maybe I need to change something in the .activeitem too...? D :

    EDIT 3: ...I am soooo stuck... TTwTT
     
    Last edited: Apr 9, 2017
  7. IHart

    IHart Scruffy Nerf-Herder

    If i understand correctly, you want the BORDER and the FULL RIGHT both active the entire time the shield is held extended?

    edit: i realized it's actually the light emitters and particles, tinkering with them now.
     
    Last edited: Apr 9, 2017
    Cen Silver likes this.
  8. IHart

    IHart Scruffy Nerf-Herder

    got the glow and the particles.
     

    Attached Files:

    Cen Silver likes this.
  9. Cen Silver

    Cen Silver Phantasmal Quasar

    Woooo!!! It works now!!! Thank you so much!!! ^^ /

    What was I doing wrong? I'm gonna check the difference between the files later, but if you wanna give me some pointers, I'd love to learn. ^^

    Also, I couldn't help but notice the shield's light is a lil flicker-y on the borders, was that intended? X D
     
  10. Cen Silver

    Cen Silver Phantasmal Quasar

  11. IHart

    IHart Scruffy Nerf-Herder

    I'm actually uncertain why the light and particles didn't work the way they were set up before, and no the flickering isn't intended.
     
  12. Cen Silver

    Cen Silver Phantasmal Quasar

    Oh...? o.o

    Well, Okay... I'll just check it out later then... Thanks for the help! ^^

    (I like the flickering tho'. looks nice. I ain't fixing that. X D)
     
    Last edited: Apr 12, 2017
  13. Cen Silver

    Cen Silver Phantasmal Quasar

    @IHart Heya!

    So I saw you placed this " "handGrip" : "outside"," in the shield's .activeitem...

    I'm assuming it's probably telling the game to render the shield Behind the Character's hand when it's on his rear-end hand, yes? Or is it for something else entirely and I misinterpreted?

    EDIT: Okay, so, I think I saw where the problem was, also I saw these "particleEmittersOff" and "particleEmittersOn" cvars... and I noticed they were what seemed to be what made the fullbright render...?
    (Because it seemed to be the only command to call up the "ProtectorateShield" properties part...?)

    Which I found curious, because I thought a var called "particleemitters" would be used for spawning particles only... does that mean I'm supposed to use it whenever I want the game to call upon a fullbright piece too?

    Oh, and you seemed interested in the problem (Feel free to correct me if I'm wrong!) so I tought I'd share what was probably the problem with ya!

    Putting it in spoilers cuz programming iz long and hurty people finger to roll through the whole thing

    It seems in my attempt, I placed the fullbright parts' properties where they had no value, which was after the brackets in the "states" var, like this:



    "states": {

    "idle": {},
    "raised": {},
    "block": {
    "frames": 1,
    "cycle": 0.12,
    "mode": "transition",
    "transition": "raised"
    }

    }

    },

    "protectorateshieldfullbright" : {
    "default" : "inactive",
    "states" : {
    "inactive" : {
    "properties" : {
    "lightsOff" : ["glow"],
    "particleEmittersOff" : ["blade"]
    }
    },

    "active" : {
    "frames" : 8,
    "cycle" : 0.5,
    "mode" : "loop",
    "properties" : {
    "lightsOn" : ["glow"],
    "particleEmittersOn" : ["blade"],
    "persistentSound" : "/sfx/tools/energypickaxe_idle.ogg"
    }
    },

    "retract" : {
    "frames" : 5,
    "cycle" : 0.15,
    "mode" : "transition",
    "transition" : "inactive",
    "properties" : {
    "lightsOn" : ["glow"],
    "particleEmittersOn" : ["blade"],
    "immediateSound" : "/sfx/tools/energypickaxe_stop2.ogg"
    }
    }
    },


    When actually, I should've placed them IN the "state" paramater brackets, like your fixed version shows:


    "states": {

    "idle": {
    "properties": {
    "lightsOff": ["glow"],
    "particleEmittersOff": ["protectorateshieldfullbright"]
    }
    },

    "raised": {
    "properties": {
    "lightsOn": ["glow"],
    "particleEmittersOn": ["protectorateshieldfullbright"],
    "persistentSound": "/sfx/tools/energypickaxe_idle.ogg"
    }
    },

    "block": {
    "frames": 1,
    "cycle": 0.12,
    "mode": "transition",
    "transition": "raised",
    "properties": {
    "lightsOn": ["glow"],
    "particleEmittersOn": ["protectorateshieldfullbright"],
    "immediateSound": "/sfx/tools/energypickaxe_stop2.ogg"
    }
    }
    }



    I'll make sure to be more careful and not make the same mistake again. Thanks for helping me! ^^ /

    Edit 2: Oh, I also noticed you changed the "frames" and "cycle" variables in the "block" state. May I ask what do those do? I assume the "frames" is what tells the game for how long does the "blocking" state ingame lasts, in frames, but no idea about the "cycle"... is it maybe the cooldown time to be able to block again? ^^

    Edit 3: Aaaaaaaaand my Particles variable was set to "blade" when it shouda been to the fullbright... >_>"""

    Edit 4 - Final: Also, a lot of brackets were outta place, that was probably also why some stuff kept breaking. And you changed the Directives. No idea what those do so I can't even tell if they were part of the problem or not. X D
     
    Last edited: Apr 12, 2017
  14. IHart

    IHart Scruffy Nerf-Herder

    It does that for weapons, added it to your shield as experiment but it failed and I forgot to remove it. oops on me.
    Frames is how many image variations it's looking for, cycle is how quickly it rotates through the given image variations. This only affects the animation, not the blocking mechanics.
     
    Cen Silver likes this.
  15. Cen Silver

    Cen Silver Phantasmal Quasar

    Ooooh o.o

    Cool! I'm learning so much new stuff!!! \ ^3^ /

    Thanks so much @IHart !!! I finished (FINALLY) correcting my code just minutes ago, and it's now all finally working!!! now I'm just gonna fine-tune based on the new things you said and make sure the stats look good, and then I'll finally be able to give people more other protectorate weapon choices!!! Thank you so much for all the help you gave me!!! You're awesome!!! \ ^^ /
     
  16. IHart

    IHart Scruffy Nerf-Herder

    Glad to help, but you did most of the work.
     

Share This Page