Modding Help Linking Quest turn in to NPC

Discussion in 'Starbound Modding' started by projectmayhem, Apr 18, 2017.

  1. projectmayhem

    projectmayhem Void-Bound Voyager

    Trying to learn how to do my own quest, so far I've got the quest starting when you mine a Kyber Crystal. It pops up, you accept it, then you get a new mission warp on your S.A.I.L. menu for Gray Jedi Temple. I have 6 different npc's in there, and I want to make one of them the turn in for the quest. But I cannot figure out how to do it with them tagged as NPC's. Browsing the vanilla files, I've found that all the outpost NPC's that you turn in quest too are really objects. But in order to make one of them an object, I would have to make it into a tileset, and I have no idea how to do that either.

    So does anyone know a file I can look at to learn more about turning an NPC into a quest receiver, or have a good link to learning about making tilesets?
  2. Sparklink

    Sparklink Zero Gravity Genie

    To place an NPC using tiled you have to use the insert rectangle tool; with the tool make a one block sized square. Then you can add custom properties to the square; the first property is "npc" spelled in all lowercase, you write what species you want it to be in here. The second property is "typeName" ,spelled with only the N in upper-case, you specify what type of NPC it is with this (crewmember, bandit, chefmerchant, etc...)

    The outpostcivilian is probably the easiest to work with in quests, the outpost prefix does not bind him to the outpost so you will not have to worry about that, you can use him any where. Set his turnInQuests to your mission name and it should work.

    "type" : "ExampleType",
    "baseType" : "outpostcivilian",

    "scriptConfig" : {
    "offeredQuests" : [ ],
    "turnInQuests" : [ "Examplemission"
    projectmayhem likes this.
  3. projectmayhem

    projectmayhem Void-Bound Voyager

    Ok, so let me ask you this. I have the following NPC in the Jedi Temple


      "type" : "twilekjedi",
      "baseType" : "friendlyguard",
      "levelVariance" : [0, 0],
      "dropPools" : [ "banditTreasure" ],
      "items" : {
        "override" : [
          [0, [ {
            "head" : [ { "name" : "SWMjedi2hood" } ],
                "chest" : [ { "name" : "SWMjedirobe2upper" } ],
                "legs" : [ { "name" : "SWMjedirobe2lower" } ],
                "primary" : [
            "alt" : [
              { "name" : "SWMforceshield" }
          } ] ]
    "turnInQuests" : [ "jeditemple1"]

    I see that I do not have the scriptConfig tag you have in your post, but I got this from looking at the shipyardcaptian.object file and he doesn't have scriptConfig, but he is an object, not an actual NPC. Do I need to add the scriptConfig tag or is it ok like it is? MAybe my issue is in my quest LUA file. I'm really out of my league trying to edit it, but I think I got it right.

    Here is my jeditemple.questtemplate

      "id" : "jeditemple1",
      "mainQuest" : true,
      "title" : "The Gray Jedi Temple",
      "text" : "Take your kyber crystal to a Jedi at the Gray Temple. They will show you how to craft a lightsaber.",
      "completionText" : "You have now started to walking the path of a Jedi.",
      "moneyRange" : [50, 50],
      "rewards" : [
        [ ["SWMpurpleyounglinglightsaber", 1] ]
      "canBeAbandoned" : true,
      "updateDelta" : 10,
      "script" : "/quests/scripts/jedi/jeditemple.lua",
      "scriptConfig" : {
        "portraits" : {
          "questStarted" : {
            "portrait" : [ {"image" : "/quests/npcs/jedi.png"} ],
            "title" : "Gray Jedi"
          "questComplete" : {
            "portrait" : [ {"image" : "/quests/npcs/jedi.png"} ],
            "title" : "Gray Jedi"
        "descriptions" : {
          "turnIn" : "Travel to the Gray Jedi Temple and show a Jedi your Kyber Crystal"
        "compassUpdate" : 0.2,
        "associatedMission" : "missionjeditemple",
        "missionUnlockedCinema" : "/cinematics/coordinates.cinematic",
        "missionRadioMessage" : {
          "messageId" : "humanmissionunlocked",
          "text" : "I have received the coordinates for the ^orange;Gray Jedi Temple^reset;. If you ^green;return to the ship^reset; you can teleport there using my mission interface."
        "jediUid" : "twilekjedi"

    And my jeditemple.lua

    require "/scripts/util.lua"
    require "/scripts/vec2.lua"
    require "/quests/scripts/portraits.lua"
    require "/quests/scripts/questutil.lua"
    function init()
      storage.complete = storage.complete or false
      self.compassUpdate = config.getParameter("compassUpdate", 0.5)
      storage.stage = storage.stage or 1
      self.stages = {
      self.state = FSM:new()
    function questInteract(entityId)
      if self.onInteract then
        return self.onInteract(entityId)
    function questStart()
    function questComplete()
    function turnIn()
      quest.setObjectiveList({{config.getParameter("descriptions.turnIn"), false}})
      local findJedi = util.uniqueEntityTracker(self.jediUid, self.compassUpdate)
      while storage.stage == 1 do

    Really a learn as I go thing, a lot of small change, test, small change, test, oops I broke the game, undo, change, test lol

    I used the humanmission1 as a template.
    Last edited: Apr 18, 2017
  4. projectmayhem

    projectmayhem Void-Bound Voyager

    I did go ahead and manage to make a new object, and link the quest to it, the quest ran fine. I spawned in a Kyber Crystal, the quest pop'd up, I accepted and the object had a blue "?", turned it in fine.

    I'd much prefer having an actual NPC in the temple, but if I cant figure it out, at least I know one way now
  5. bk3k

    bk3k Black Hole Surfer

    Don't assume all things work identically between objects and NPCs. The implementation is far from identical.

    Because the NPCs are apparently set up to look within "scriptConfig" for these things, you need to do what they're doing. Most likely in the case of the NPCs, this means the quest linking is handled by the NPC's scripts rather than by the base engine. By contrast not all objects are scripted but NPCs certainly are. So the devs necessarily went with a hard-coded option to cover the object's quest needs.

    Just food for thought. Now why not try out that code Sparklink provided? Asking for clarification isn't nearly as fun as simply trying and seeing what happens. I find I learn/understand more from my attempts to do things - failure or success - than anything else. Sometimes I do things I really don't expect will work - just to see HOW it breaks. Try it!
  6. projectmayhem

    projectmayhem Void-Bound Voyager

    I didn't have anytime to test it out, was getting ready for work and wanted to ask so when I got home, I could read any responses. Now that I'm home though, I'm about to test it out :)
  7. projectmayhem

    projectmayhem Void-Bound Voyager

    And it worked beautifully :) I'm going to have a busy busy weekend learning more about quest and writing some up :)

    Thank you both!
  8. Sparklink

    Sparklink Zero Gravity Genie

    Always happy to help.

Share This Page