Tutorial Beginners guide to create and interlink your first quest!

Discussion in 'Starbound Modding' started by Kayuko, May 15, 2015.

  1. Kayuko

    Kayuko Oxygen Tank

    Oh god, I'm so tired, please kill me someone.

    *cough*

    Another thread by lil fluffy fox, this time we'll create a custom quest and link it to an (existing) npc. (Creating and spawning npc's permanently is a whole other thing that needs a whole new tutorial)

    Now that I think about it, I guess it'll be shorter then the codex tutorial. But let's start, so, what will we do in this tutorial:

    • Create a new .questtemplate file (A new quest)
    • Link this quest to some randomly selected outpost npc victim
    And that's basically it. There's not much more to create a quest.

    ================================================================

    As always, your friendly example questfile:


    {
    "id" : "outpostMission1.gearup",
    "title" : "^orange;Erchius Mining Facility",
    "text" : "A visit to the Erchius mining facility might be just what I need to ^green;fix my FTL drive^white;. The distress signal and coordinates have been copied to ^green;S.A.I.L's mission tab. I'll need to equip the nano suit I was given through the tech menu to survive the atmosphere at the facility.",
    "completionText" : "I've finally got the crystals I need to fix my ship's FTL drive. I should talk to S.A.I.L.",
    "conditions" : [
    ],
    "moneyRange" : [0, 0],
    "rewards" : [
    [ [ "supermatter", 20 ] ]
    ],
    "canBeAbandoned" : false,
    "planetMode" : "none",
    "questDungeons" : [ ],
    "associatedMission" : "mission1",
    "requireTurnIn" : true
    }


    "id" -- Your quests name used for interlinking, always ends with .gearup (for whatever reason, too late to think about that).
    "title" -- The title of the quest, shown in the questlog. Note: As you can see, theres a specific string: "^orange;", that's a color code. It colors everything after this string - surprise - orange.
    "text" -- The questtext you can rread either when accepting the quest or when you look it up in your questlog
    "completionText" -- The questtext that's shown upon quest completion
    "conditions" -- That's the fun part, read below for a detailed explanation.
    "moneyRange" -- Set's the range of pixel you get. I'm not sure how the amount is determined, probably just an average.
    "rewards" -- That's where you put the thing(s) you get as a questreward, don't forget, it's an array.
    "canBeAbandoned" -- This line decides if you can abort the quest or not (boolean value)
    "planetMode" -- Noidea, seriously, please someone reply what this option does.
    "questDungeons" -- Probably a not-used value yet. Might be important in later development stages.
    "associatedMission" -- For example, in this case the quest is linked to the Erchius Mining Facility, thus the associated mission is "mission1"
    "requireTurnIn" -- Decides if you can complete the quest on-the-fly once you meet the conditions or if you need to turn it in.

    There are even more important values that can be added:

    "enableTech" -- Enables a specific tech in S.A.I.L. (Usage example: ["heatprotectionTech"]
    "completionCinema" -- Shows a cinematic animation upon quest completion (Usage: filepath to a .cinematic file)
    "followUp" -- Used to keep questlines going, links to another .gearup (.questtemplate) file
    "prerequisites" -- Used to prevent the quest from showing up unless the prerequisites are met (Usage: Links to another .gearup) [Note: might also work with other values, for example "shipLevel"]

    "conditions" -- There are several ways to use this. I'll explain the two most common: gatherTrigger and gather.

    "conditions" : [{ "kind" : "gather", "item" : [ "liquidcoffee", 1] }]

    That's a simple oneline on how "gather" works.
    Simply said, it's telling the client: "Hey, if you want to complete that quest, bring me the item "liquidcoffee", I'll take it and, in exchange, complete the quest for you."

    gatherTrigger works a bit different:

    "conditions" : [{ "kind" : "gatherTrigger", "trigger" : "durasteelarmor", "consume" : false }]

    Now it works like this: "Hey, let me see if you got the item "durasteelarmor" (that's actually a little more complicated, just use an itemname there) on you I'm going to complete the quest for you, you can even keep the item!"

    You can also change "consume" to true, but then it's really just a fancier "gather" function.

    However, this shall suffice for now for the .questtemplate file.
    With this knowledge you can easily write your own quest.

    ============================================================================

    Now to link that with an existing npc. I'll be choosing the penguin in the outpost, the one that also gives the Weapon Testing Site quest.


    {
    "type" : "outpostpenguinpromoter",
    "baseType" : "outpostcivilian",

    "scriptConfig" : {
    "offeredQuests" : [ "penguinpromoterE1.gearup", "penguinmission.gearup", "heatskin1.gearup" ],
    "turnInQuests" : [ "penguinpromoterE1.gearup", "penguinmission.gearup", "penguinmission3.gearup", "heatskin1.gearup" ],
    "converse" : {
    "waitTime" : 0.5,
    "dialog" : {

    "default" : [
    "Got a ship? You should check out the Penguin Bay out back! We often have useful stuff for travelers such as yourself."
    ],

    "penguin" : {
    "default" : [
    "Got a ship? You should check out the Penguin Bay out back! We often have useful stuff for travelers such as yourself."
    ],

    "avian" : [
    "Got a ship? You should check out the Penguin Bay out back! We often have useful stuff for travelers such as yourself."
    ],

    "apex" : [
    "Got a ship? You should check out the Penguin Bay out back! We often have useful stuff for travelers such as yourself."
    ],

    "floran" : [
    "Got a ship? You should check out the Penguin Bay out back! We often have useful stuff for travelers such as yourself."
    ],

    "glitch" : [
    "Got a ship? You should check out the Penguin Bay out back! We often have useful stuff for travelers such as yourself."
    ],

    "human" : [
    "Got a ship? You should check out the Penguin Bay out back! We often have useful stuff for travelers such as yourself."
    ],

    "hylotl" : [
    "Got a ship? You should check out the Penguin Bay out back! We often have useful stuff for travelers such as yourself."
    ]
    }
    }
    }
    },

    "statusControllerSettings" : {
    "statusProperties" : {
    "targetMaterialKind" : "organic"
    },

    "appliesEnvironmentStatusEffects" : false,
    "minimumLiquidStatusEffectPercentage" : 0.1,

    "primaryScriptSources" : [
    "/stats/npc_primary.lua"
    ],
    "primaryScriptDelta" : 5,

    "stats" : {
    "maxHealth" : {
    "baseValue" : 100.0
    },
    "maxEnergy" : {
    "baseValue" : 100.0
    },
    "powerMultiplier" : {
    "baseValue" : 1.0
    },
    "protection" : {
    "baseValue" : 1.0
    },
    "healthRegen" : {
    "baseValue" : 0.0
    },
    "energyRegen" : {
    "baseValue" : 100.0
    },
    "shieldSuppressed" : {
    "baseValue" : 0.0
    },
    "invulnerable" : {
    "baseValue" : 0.0
    }
    },

    "resources" : {
    "health" : {
    "maxStat" : "maxHealth",
    "deltaStat" : "healthRegen",
    "defaultPercentage" : 100
    },
    "energy" : {
    "maxStat" : "maxEnergy",
    "deltaStat" : "energyRegen",
    "defaultPercentage" : 100
    }
    }
    }
    }


    That looks much, right?
    Don't worry, I won't explain everything of it, since that's not a npc tutorial.
    You'll need the following two functions:

    "offeredQuests" and "turnInQuests", both functions under the parental - let's call it class this time - "scriptConfig".
    Usage is pretty simple, both are arrays with a number of quests.
    Basically, those quests are available at the npc, once you fulfill the quest-requirements specified in the .questtemplate.
    You might've noticed both functions only ever link to .gearup values, not the .questtemplate files itself. Don't mix that up.

    However, as you already guessed, offeredQuests are the quests that are offered while turnInQuests are the quests that are viable to be turned in at this npc. There's no problem if you have the same quest in "offeredQuests" AND "turnInQuests", in fact, thats quite common.

    So, now to link your quest to that npc you will not rewrite the whole file, since that'll override the original. More on that (maybe some day) on a modding FAQ & DoNots.

    We're going the .patch way again.

    Create a file called outpostpenguinpromoter.npctype.patch and put the following lines into it:

    [
    {"op" : "add", "path" : "/scriptConfig/offeredQuests/-", "value" : "yourquestname.gearup"},
    {"op" : "add", "path" : "/scriptConfig/turnInQuests/-", "value" : "yourquestname.gearup"}
    ]
    (Note: Unverified patch, not tested yet. Will test that tomorrow.)

    Now create a .modinfo for your mod. As always, here's the example file:


    {
    "name" : "yourquestmod",
    "version" : "Spirited Giraffe 5",
    "path" : ".",
    "dependencies" : [],
    "metadata" : {
    "displayName" : "Your Custom Quest",
    "author" : "",
    "description" : "Just a custom quest",
    "version" : "Somerandomversionnumber",
    "support_url" : "Somerandomurl"
    }
    }


    If you follow my other tutorials you notice different .modinfo setups. All of them work, you can also combine them. It's basically just used to tell the parser where to look for mods.

    Folderstructures! Hooray!

    yourcustomquest.questtemplate belongs to: "/yourModFolder/quests/"
    outpostpenguinpromoter.npctype.patch belongs to: "/yourModFolder/npcs/outpost/"
    yourcustomquest.modinfo belongs to "/yourModFolder/"

    If you've done everything right you'll notice a new quest at the Penguin in the Outpost. Congratz!
    Should any problem come up, as always, first try reading your starbound.log and resolve it yourself.
    If you're really stuck don't hesitate to reply here and ask for help.


    [​IMG]

    Red Panda approved.
     
  2. haynesy566

    haynesy566 Heliosphere

    Thanks Kayuko, your so awesome!
     
  3. The MechE

    The MechE Existential Complex

    Nice tutorial! So how do you make a quest with no rewards? It seems when I try to leave the rewards section blank, it yells at me.
     
  4. Kayuko

    Kayuko Oxygen Tank

    Code:
    {
      "id" : "ftlrepairmain.gearup",
      "title" : "^orange;Free as a Bird",
      "text" : "Now that I can visit the planets within this solar system ^green;I need to start looking at how to repair my FTL drive, ^orange;S.A.I.L will probably know more.",
      "completionText" : "It's working! I can finally visit other star systems!",
      "conditions" : [
        { "kind" : "trigger", "trigger" : "ai.repairftl" }
      ],
      "moneyRange" : [500, 500],
      "planetMode" : "none",
      "questDungeons" : [ ],
      "followUp" : "fuel.gearup",
      "canBeAbandoned" : false
    }
    
    
    This is an example of a quest without rewards.
    Just delete the whole reward function.
     
  5. The MechE

    The MechE Existential Complex

    Thank you, with this, I've almost finished my simple test mission.
     
    Kayuko likes this.
  6. JackingUp13

    JackingUp13 Void-Bound Voyager

    is there any way to use the progress bar of the clue quests in other quests, such as collecting items?

    if possible? how?
     

Share This Page