Modding Help linking a Sphere tech to skin color, and the console

Discussion in 'Starbound Modding' started by XelSlime, Oct 1, 2016.

  1. XelSlime

    XelSlime Scruffy Nerf-Herder

    I'm in need of some simplifying.

    I've made a "Slime Race Mod", and I felt like making a visual variant of the Spike Sphere to go with the theme. It looks perfectly fine, but I'd also like to have a color to match whatever palette a person chooses to use. At the moment, the only thing I can think of is to create 64 recolors of the same tech, which is nuts, but I'm wondering if there might be a wizard here somewhere who would know a simpler method.

    Also, I'd like to have these techs appear on the console at the outpost, but it's not happening at the moment. Am I missing something, or is that just not possible to do?

    ...

    I feel like I should learn about this "effectDirectives" bit in the .species file.
     
    Last edited: Oct 1, 2016
  2. Errors4l

    Errors4l Spaceman Spiff

    Not sure if this is a good method, but it should work. I can't think of another method since I can't think of another way to 'fetch' the skin color of your character.

    This method will apply to all spheres (since they all use the distortionsphere.animation file), which may not be what you want. To work around this potential issue, you could copy the animation file and rename it to spikesphere.animation, then use that in your spikesphere.tech instead.

    Techs can set global tags (the "<tag>" stuff in .animation files). These can be used to (for example) add directives to textures. Directives information: http://starbounder.org/Modding:Image_Processing_Directives

    What you could do is add a tag <skinColor> to both the globalTagDefaults (empty string) and to the image parts you'd like to recolor. These are found in the .animation file.
    "image" : "<partImage>:<rotationFrame><skinColor><ballDirectives>"
    In the tech script, on init, you'll want to set this tag to the directives needed to recolor the ball.
    animator.setGlobalTag("skinColor", "?replace")

    Now the directives may be a bit.. tricky to figure out, and this is why I'm not sure if this is the best method.
    If you call world.entityPortrait(entity.id(), "full")[5].image you'll get the full image and directives for your character's body. You can dissect this string to get the individual replace directives. You'll probably want to log the value to see exactly how it's formatted.
    starbound.logInfo("%s", world.entityPortrait(entity.id(), "full")[5].image)
    After this you can format your own directives using these values to recolor the sphere (using the setGlobalTag function from before).

    If anything is unclear (which it probably is), feel free to let me know and I'll see if I can help!
     
    XelSlime likes this.
  3. XelSlime

    XelSlime Scruffy Nerf-Herder

    Anything is better than nothing. I'll give this a try in a bit, but I need to recharge my mental batteries for a few hours.

    Thanks for the bit of hope that what I'm after might be possible.
     

Share This Page