Modding Help An object that is wired with an inactive-activating-active stages.

Discussion in 'Starbound Modding' started by Dekadrachm, Mar 21, 2017.

  1. Dekadrachm

    Dekadrachm Heliosphere

    Hello, I am making a vending machine that transforms, it has three stages just like the checkpoint object used in missions in vanilla Starbound. My issues is that when the object is powered it does not change frames.
    It remains in its inactive stage.
    here is my code.

    Object
    Code:
    {
      "objectName" : "BMvendingmachine",
      "colonyTags" : ["human","humanbunker","commerce"],
      "rarity" : "Legendary",
      "description" : "Shady items for shady diamonds?",
      "shortdescription" : "Black Market Vendor",
      "race" : "human",
      "category" : "^pink;Black Market",
      "price" : 2000,
      "lightColor" : [204, 255, 255],
      "printable" : false,
    
      "apexDescription" : "A Black Market vending machine. It's probably best to be careful when buying from here.",
      "avianDescription" : "This vending machine gives off a shady vibe.",
      "floranDescription" : "Clever machine gives Floran fun goodiessss.",
      "glitchDescription" : "Indecisive. I can't decide what to buy.",
      "humanDescription" : "Oh boy, a vending machine with a camera! Maybe they sell pictures?",
      "hylotlDescription" : "A vending machine for some Black Market business. It may be worth checking out.",
      "novakidDescription" : "A shady vendin' machine, looks to be my type of store.",
    
      "interactAction" : "OpenMerchantInterface",
      "interactData" : {
        "config" : "/interface/windowconfig/vendingmachine.config",
        "paneLayoutOverride" : {
          "windowtitle" : {
            "title" : " ^pink;The Black Market",
            "subtitle" : " 100% legal-ish goods!"
          }
        },
        "buyFactor" : 2.5,
        "sellFactor" : 0.5,
        "items" : [
          { "item" : "diamond" },
          { "item" : { "name" : "steamshotgun" }, "prerequisiteQuest" : "avian_mission2" },
          { "item" : { "name" : "steamrifle" }, "prerequisiteQuest" : "avian_mission2" },
          { "item" : { "name" : "steampistol" }, "prerequisiteQuest" : "avian_mission2" },
          { "item" : { "name" : "railbomb" }, "prerequisiteQuest" : "hylotl_mission2" },
          { "item" : { "name" : "chimera" }, "prerequisiteQuest" : "apex_mission2" }
    
        ]
      },
    
      "inventoryIcon" : "vendingmachineicon.png",
    
      "orientations" : [
     
        {
          "image" : "blackmarketvendingmachineright.png:inactive",
          "imagePosition" : [-8, 0],
          "direction" : "left",
          "flipImages" : true,
          "frames" : 1,
          "animationCycle" : 1,
    
          "spaceScan" : 0.1,
          "anchors" : [ "bottom" ],
          "collision" : "platform"
        },
        {
          "image" : "blackmarketvendingmachineright.png:inactive",
          "imagePosition" : [-8, 0],
          "direction" : "right",
          "frames" : 1,
          "animationCycle" : 1,
    
          "spaceScan" : 0.1,
          "anchors" : [ "bottom" ],
          "collision" : "platform"
        }
      ],
     
        "animation" : "blackmarketvendingmachine.animation",
        "animationParts" : {
        "bg" : "blackmarketvendingmachineright.png"
      },
      "animationCustom" : {
        "sounds" : {
          "on" : [ "/sfx/objects/apexconsole2switch.ogg" ],
          "off" : [ "/sfx/objects/apexconsole2switch.ogg" ]
        }
      },
        "animationPosition" : [-8, 0],
    
      "scripts" : [
        "/scripts/npcToyObject.lua", "/objects/wired/light/light.lua"
      ],
      "scriptDelta" : 60,
     
      "outputNodes" : [ [0, 0] ],
      "inputNodes" : [ [0, 2] ],
    
      "npcToy" : {
        "influence" : [
          "vendingmachineActivate",
          "vendingmachineCollect",
          "vendingmachineComplete"
        ],
        "defaultReactions" : {
          "vendingmachineActivate" : [
            [1.0, "pressbutton"]
          ],
          "vendingmachineCollect" : [
            [1.0, "crouchcollect"]
          ],
          "vendingmachineComplete" : [
            [1.0, "smile"]
          ]
        },
        "preciseStandPositionLeft" : [-0.5, 0.0],
        "preciseStandPositionRight" : [2.0, 0.0],
        "maxNpcs" : 1
      },
          "radioMessagesOnPickup" : [ "pickupBMvendingmachine" ]
    }
    
    
    Animation
    Code:
    {
      "animatedParts" : {
        "stateTypes" : {
          "checkpoint" : {
            "default" : "inactive",
            "states" : {
              "inactive" : {},
              "activate" : {
                "frames" : 18,
                "cycle" : 3,
                "mode" : "transition",
                "transition" : "active",
                "properties" : {
                  "immediateSound" : "/sfx/objects/checkpoint_activate2.ogg"
                }
              },
              "active" : {
                "frames" : 6,
                "cycle" : 1,
                "mode" : "loop",
                "frameProperties" : {
                  "immediateSound" : [ "", "", "", "", "", "", "", "", "", "", "", "/sfx/objects/screen2.ogg" ]
                },
         "parts" : {
          "bg" : {
            "properties" : {
              "centered" : false
            },
    
            "partStates" : {
              "checkpoint" : {
                "inactive" : {
                  "properties" : {
                    "image" : "<partImage>:inactive"
                  }
                },
                "activate" : {
                  "properties" : {
                    "image" : "<partImage>:activate.<frame>",
                    "fullbright" : true
                  }
                },
                "active" : {
                  "properties" : {
                    "image" : "<partImage>:active.<frame>",
                    "fullbright" : true
                  }
                }
              }
            }
          }
          }
              }
            }
          }
        }
    
      }
    }
    
    Frames
    Code:
    {
      "frameGrid" : {
        "size" : [24, 44],
        "dimensions" : [25, 1],
        "names" : [
          [ "inactive", "activate.1", "activate.2", "activate.3", "activate.4", "activate.5", "activate.6", "activate.7", "activate.8", "activate.9", "activate.10", "activate.11", "activate.12", "activate.13", "activate.14", "activate.15", "activate.16", "activate.17", "activate.18", "active.1", "active.2", "active.3", "active.4", "active.5", "active.6" ]
        ]
      }
    }
    
    No errors are thrown in the starbound log file, but I want the object to when powered, transition from the activating stage to the active stage loop, that way when the machine transforms it doesn't loop back to when it is off and rather loops to an on state.

    Any help?
     
  2. bk3k

    bk3k Oxygen Tank

    Your problem at the core is that "/objects/wired/light/light.lua" isn't designed around your object - well your animation file specifically.
    Take line 41
    Code:
    animator.setAnimationState("light", "on")
    You have a partState called "checkpoint" rather than "light" and that partState has "Inactive", "activate", and "active" rather than "on" and "off"

    I hope you at least partially understand. You either need a different script(one designed around your object) or you could probably get away with renaming things in your animation file even if that isn't the greatest solution.
     
    Cyel and IHart like this.
  3. Dekadrachm

    Dekadrachm Heliosphere

    Well actually, the light script was a test, when using the checkpoint script nothing changes either.
    I need it to only work when powered, basically it looks like a normal vending machine, then when powered transforms into a special vending machine. I need the transformation to be it's own set of frames and the loop for after it's transformed to be there aswell
     
  4. bk3k

    bk3k Oxygen Tank

    You want a slightly customized script that is made for your object. I don't know what you mean by special vending machine though.

    Chances are what you want is pretty simple and I could make it tonight after work. If you're trying to keep things under wraps, you could pm me.
     
  5. Dekadrachm

    Dekadrachm Heliosphere

    i'll pm you the design, my lua isn't what it once was lol
    That or ill just wing it lol and figure it out
     
    Last edited: Mar 22, 2017

Share This Page