Modding Help Issues allowing NPC to open a crafting menu

Discussion in 'Starbound Modding' started by Luminaesthesia, Dec 17, 2014.

  1. Luminaesthesia

    Luminaesthesia Scruffy Nerf-Herder

    Hey everyone, I'm currently in the process of updating Your Starbound Crew for the upcoming stable update, but I've ran into a little bit of an issue. Instead of buying a crafting station from the NPC crew members, I want them to act as crafting stations themselves. I started out testing some stuff, and eventually ended up asking severedskullz for assistance, who helped me out immensely. Problem is, I still can not get it to work, and starbound.log isn't offering any help.

    My work is as follows: Spawn item (crewmatespawner.object) with the target NPC type "crewlovejones.npctype", a modified outpost survivor - > "crewlovejones" has a base NPC type of a modified outpost civilian called "crewmember.npctype", which has the script properties of:

    "scripts" : [
    "/npcs/main.lua",
    "/npcs/timers.lua",
    "/scripts/sensors.lua",
    "/scripts/stateMachine.lua",
    "/scripts/util.lua",
    "/scripts/vec2.lua",


    "/npcs/crewstate.lua",
    "/npcs/fleeState.lua",
    "/npcs/sitState.lua",
    "/npcs/sleepState.lua",
    "/npcs/standingIdleState.lua",
    "/npcs/wanderState.lua"
    ],

    Which calls to "crewstate.lua" under scripts that simply contains:

    function onInteraction()
    world.logInfo ("we ran!")
    return { "OpenCraftingInterface", {config = "/interface/windowconfig/crafting.config", filter = { "crafting" } }}
    end

    And when I load up the game (new character to make sure nothing is left over from last session), the character spawns just fine, but nothing happens when I press "e" on him. severedskullz recommended adding world.loginfo to the lua file to see if Starbound.log takes it, but it doesn't show up. I tried moving crewstate.lua to the object file to see if the game even tried to load it, and yes, it does show in starbound.log that it tried to load it, failed, and went to default, so at least the game is loading it when I press "e" on a character.

    Basically, I have no idea why this isn't working. Does any one out there have any experience turning an NPC into a moving crafting table of sorts or understand why this isn't working? Thanks for your time!
     
  2. Now that I am home and am sitting in front of the files, I fear I made a mistake in stating that it works the same way in regards to Objects. I had completely forgotten the interaction hook is simply "interact" and not "onInteraction" as I was stating earlier.

    Code:
    function interact(args)
    return { "OpenCraftingInterface", {config = "/interface/windowconfig/crafting.config", filter = { "crafting" } }}
    end
    
    My sincerest apologies. One of the small problems trying to assist via phone... I sometimes remember things incorrectly when I'm not staring at the files. Between all the different games I mod, I start to confuse them.
     
    Last edited: Dec 17, 2014
    kyleetehkitty likes this.
  3. Luminaesthesia

    Luminaesthesia Scruffy Nerf-Herder

    THANK YOU SO MUCH. Seriously, thanks for spending so much time on the problem, it finally works!
     
  4. No worries man. Glad we finally nailed it ;)
     

Share This Page