Modding Help Creating an animated chair with a single-frame sitCoverImage..

Discussion in 'Starbound Modding' started by Derejin, Mar 25, 2017.

  1. Derejin

    Derejin Void-Bound Voyager

    Hello!

    I'm working on creating a mod based on Breath of the Wild.

    I've spent a good deal of time creating some sprites for the big 'ol seat that the Monks sit on at the end of shrines, in order to make it usable as a piece of furniture. While it's unoccupied, the shield isn't there, but while it's occupied, I want to show the shield.

    However, I'm unsure how to get "sitCoverImage" to work properly.
    My current attempt results in the game crashing when attempting to sit in the chair.
    If I remove the "sitCoverImage" line, repack, and try again, I can sit without issue (but without the cover image popping up, as you might guess).

    What I've done:

    #1. The sitCoverImage has the same dimensions as a single frame of the regular object. (each frame is 188/224)
    #2. I've already placed the object in game (without sitCoverImage) to test that it works before adding the cover image.
    #3. Double-checked that the names of the files being referenced in code are correct.
    #4. The code to attempt adding the cover image is thus:

    ==
    Code:
    [
    //snip
    "novakidDescription" : "I can't stand just standin' still, much less sittin' still!",
    
      "sitCoverImage" : "zgear_sheikahshieldedmeditationtablecover.png",
      "inventoryIcon" : "zgear_sheikahshieldedmeditationtableicon.png",
      "orientations" : [
    //snip
    ]
    ==

    Questions:
    #1. Do I need to make the sitCoverImage have the same number of frames as the regular chair?
    #2. Am I declaring sitCoverImage incorrectly?
    #3. If both of those are not related to the problem, what do you think the issue is?


    For completion's sake, as well:
    -The object's image file is large: 2444x244.
    -Here's how the animation and frames is defined:

    Within the .object file:
    Code:
    [
    //snip
    
      "sitCoverImage" : "zgear_sheikahshieldedmeditationtablecover.png",
      "inventoryIcon" : "zgear_sheikahshieldedmeditationtableicon.png",
      "orientations" : [
        {
          "image" : "zgear_sheikahshieldedmeditationtable.png:<color>.<frame>",
          "imagePosition" : [-90, 0],
         "direction" : "left",
         "flipImages" : true,
        
         "sitPosition" : [0, 74],
        
          "frames" : 13,
          "animationCycle" : 3,
    
          "spaceScan" : 0.1,
          "anchors" : [ "bottom" ]
    
        },
        {
          "image" : "zgear_sheikahshieldedmeditationtable.png:<color>.<frame>",
          "imagePosition" : [-90, 0],
         "direction" : "right",
        
         "sitPosition" : [-4, 74],
        
          "frames" : 13,
          "animationCycle" : 3,
    
          "spaceScan" : 0.1,
          "anchors" : [ "bottom" ]
        }
      ],
      "objectType" : "loungeable",
      "sitFlipDirection" : true
    ]
    ==
    And this is the full .frames file:
    Code:
    [
    {
    
      "frameGrid" : {
        "size" : [188, 224],
        "dimensions" : [13, 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", "default.12"]
        ]
      },
    
      "aliases" : {
        "default.default" : "default.0"
      }
    }
    
    ]
     
  2. bk3k

    bk3k Oxygen Tank

    I can't see why that would crash it. Do you have a file in that folder EXACTLY named
    zgear_sheikahshieldedmeditationtablecover.png
    with no misspelling, the exact same capitalization?

    Also, please post your log.

    The sit cover image I doesn't need any .frames file for itself, and I don't think you'd get an animated image out of it. You could accomplish this with adding another part instead, and having that part draw ahead of the player. The sit cover image is a simple implementation, but without features.

    One other thing - I don't "think" it should be the issue but try a literal path for the cover image.
     
  3. Derejin

    Derejin Void-Bound Voyager

    Yup. To confirm, I even copy+pasted the filename of that file into the .object code, to ensure there was nothing wrong. :\

    Thank you for stating this: I attempted to look through the log before, but found nothing.

    This time, though, after replicating the crash, I spotted this line:

    [02:49:38.184] [Error] Application: exception thrown, shutting down: (AssetException) Path 'zgear_sheikahshieldedmeditationtablecover.png' must be absolute
    [0]

    In response, I researched that error and found one solution: add the full path rather than the local path for that image.

    So, I changed it up to this:
    "sitCoverImage" : "\objects\zeldagear\sheikahshieldedmeditationtable\zgear_sheikahshieldedmeditationtablecover.png",

    Result: item no longer appears.
    Checked log again. Found error explaining:

    [02:55:53.235] [Error] Exception caught loading asset: /objects/zeldagear/sheikahshieldedmeditationtable/zgear_sheikahshieldedmeditationtable.object, (AssetException) Could not read JSON asset /objects/zeldagear/sheikahshieldedmeditationtable/zgear_sheikahshieldedmeditationtable.object

    So, apparently I made a mistake in labeling the path.
    I looked at other objects, and found out that for Starbound objects, the path must be with forward slashes "/", not backslashes "\".
    Changed up the string to use forward slashes instead, and it worked! Problem solved!


    Thank you for your help. I shoulda checked the log more closely.

    Attached screenshot! (gonna trim the shield a bit)

    ==
    Summary of issue, for anyone reading in the future:

    For the sitCoverImage value, one must use the absolute path, starting from the root folder of the mod - local paths do not work.
    .i.e. "iminthesamefolderastheobjectfile.png" == no.
    What you should do is: "/objects/examplemodfolder/exampleitemfolder/iminthesamefolderastheobjectfile.png"!
     

    Attached Files:

    IHart likes this.

Share This Page