Modding Help Need help with an animated object

Discussion in 'Starbound Modding' started by knightdude, Nov 21, 2016.

  1. knightdude

    knightdude Scruffy Nerf-Herder

    So this is my first attempt at making a object with animation and so far so good but now when I launch the game and press "C" which was where I would craft said item the game just crashes. The object in it self is 142 x 230 and the inventory icon is 16 x 16 the recipe was working fine until I started to mess with the frames file. is there a limit to how big the object is or a limit to the frames since it currently has 11 frames of animation.
     
  2. Inf_Wolf14

    Inf_Wolf14 Parsec Taste Tester

    You shouldn't worry about the frames. I've made objects with several hundred frames and they work.

    However, I do believe there is a limit on the size of an object you can create...
    Tell me, is 142x230 the size in blocks or pixels? (I'm pretty sure you mean blocks, but I need to make sure.)
     
  3. bk3k

    bk3k Oxygen Tank

    Please attach the log file that captured one of these crashes.

    In fact also attach the files you're working on.
     
    lazarus78 likes this.
  4. knightdude

    knightdude Scruffy Nerf-Herder

    Its pixels actually heres the file ti kinda give you an idea samuraispec.png
     
  5. greenRAM

    greenRAM Giant Laser Beams

    No idea.

    If you're comfortable with sharing it, you might want to upload what you have for your mod so far. Someone who has worked with animated objects before can then try to trouble shoot it for you and maybe figure out what went wrong. Figuring out what went wrong sometimes takes running it through the system a number of times as you check the error log and change small things each time. It usually takes awhile to figure out what broke. But, experience definitely speeds up the process.
     
  6. knightdude

    knightdude Scruffy Nerf-Herder

    Well heres everything I got hopefully someone can take a look at it
     

    Attached Files:

  7. bk3k

    bk3k Oxygen Tank

    Caught a mistake in about 30 second lol.

    Code:
    {
    
      "frameGrid" : {
        "size" : [160, 240],
        "dimensions" : [11, 1],
        "names" : [
            [
            "default.0", "default.1", "default.2", "default.3", "default.4",
            "default.5", "default.6", "default.7", "default.8", "default.9",
            "default.10", "default.11"
            ]
        ]
      },
    
      "aliases" : {
        "default.default" : "default.0"
      }
    }
    
    You where missing a comma after "default.4"


    --edit--
    Second error right after posting,

    Code:
    {
      "objectName" : "samuraispec",
      "colonyTags" : ["glitch","glitchsewer","mechanical"],
      "rarity" : "Common",
      "category" : "decorative",
      "price" : 45,
      "description" : "A Vengeful Spirit",
      "shortdescription" : "Samurai Specter",
      "race" : "glitch",
    
      "apexDescription" : "A machine gear. It appears to be working correctly.",
      "avianDescription" : "A gear. It looks dirty.",
      "floranDescription" : "Wheel sspins, but for what use?",
      "glitchDescription" : "Thoughtful. Many of these gears make up a Glitch.",
      "humanDescription" : "An oiled gear, seems like it's a bit rusty though.",
      "hylotlDescription" : "A slightly rusty gear, it has been near too much water.",
      "novakidDescription" : "I bet these were useful once, looks to me like they're rustin' up.",
    
      "inventoryIcon" : "samuraispecicon.png",
      "orientations" : [
        {
          "leftImage" : "samurai.png:<color>.<frame>",
          "rightImage" : "samurai.png:<color>.<frame>",
          "frames" : 11,
          "animationCycle" : 0.6,
          "imagePosition" : [-4, -4],
    
          "spaces" : [ [0, 0] ],
          "anchors" : [ "bottom" ]
        }
      ]
    
    }
    
    You had an extra comma at the end of line 31


    Those commas will get you in JSON. I'll recommend Kawa's site. It has testers(I just eyeballed your errors but I'm pretty used to looking at JSON), patch makers, info, links, etc. Great for people who are new to this.
    helmet.kafuka.org/sbmods/json/
     
    Last edited: Nov 26, 2016
  8. knightdude

    knightdude Scruffy Nerf-Herder

    Thanks first time editing JSON so I guess I will get use to spotting these issues.
     
  9. knightdude

    knightdude Scruffy Nerf-Herder

    Alright so I fixed those 2 mistakes and I no longer crash when opening the crafting menu PROGRESS! now when I actually place down the object in question nothing shows up. Its invisible I double checked the frames and everything seems fine with me but then again I'm not sure what I should be looking for.
     
  10. bk3k

    bk3k Oxygen Tank

    I didn't bother to check this thoroughly because I figured the errors where the issue. But here are your problems.
    Code:
    "leftImage" : "samurai.png:<color>.<frame>",
    "rightImage" : "samurai.png:<color>.<frame>",
    
    1. You don't have a samurai.png file. You have samuraispec.png.
    2. You don't have color choices available anyhow
    3. You aren't referencing what you actually name your frames. In this case default.<frame>
    so...
    Code:
    "leftImage" : "samuraispec.png:default.<frame>",
    "rightImage" : "samuraispec.png:default.<frame>",
    
    Now your frames file has an issue too. You have default.0 through default.11 but your image has only 11 frames. 0-11 is twelve frames, although I think the animator might skip default.0 anyhow(LUA tables start with 1, not 0). So I deleted default.0 and changed the alias section to match. I checked it in game and it works now.

    Code:
    {
    
      "frameGrid" : {
        "size" : [160, 240],
        "dimensions" : [11, 1],
        "names" : [
          [
            "default.1", "default.2", "default.3", "default.4", "default.5", "default.6",
            "default.7", "default.8", "default.9", "default.10", "default.11"
          ]
        ]
      },
    
      "aliases" : {
        "default.default" : "default.1"
      }
    }
    
    Now I'm not sure what you're doing with this, so it may or may not be doing what you want. Looking at these lines.

    Code:
          "imagePosition" : [-4, -4],
          "spaces" : [ [0, 0] ],
    
    imagePosition is the offset from where you placed it(aka [0,0]) to where your image will be drawn... including the blank areas of the image. So you may need to adjust that to line it up where you want it.

    "spaces" is defining for Starbound what area the actual object takes up. Other objects won't be able to occupy these spaces(or should I say "space" as you only have one currently), and you'd need to use the MM on these spaces to remove the object because that's where the object "exists" despite the actual image location. Currently that space is not located where your image lines up. You can calculate that(8x8 pixels per tile), or you could use another detection scheme which auto-detects based off examining your image(anywhere it isn't blank). I believe the other scheme is more common on vanilla objects, but that's your choice.
     

Share This Page