Modding Help Quest Instant-Completion and Finishing Quests by Entering an Instance

Discussion in 'Starbound Modding' started by EclipticWulf, Jul 15, 2017.

  1. EclipticWulf

    EclipticWulf Scruffy Nerf-Herder

    Currently I have a quest that is unlocked after picking up a codex. The quest then unlocks a custom mission. But upon picking up the codex, it also auto-completes itself. What I want to happen is the quest being completed upon entering the instance it just unlocked.

    Also due to the quest auto-completing itself, a custom radio message doesn't play upon unlocking the quest.

    Here are my files (Mostly):

    .aimission

    Code:
    {
      "missionName" : "MODNAMEmission",
      "icon" : "MODNAMEmissionicon.png",
      "missionWorld" : "MODNAME",
    
      "speciesText" : {
        "default" : {
          "buttonText" : "Location Name",
          "repeatButtonText" : "Revisit Location Name",
          "selectSpeech" : {
            "animation" : "talk",
            "text" : "Description.",
            "speedModifier" : 1.0
          }
        }
      }
    }
    


    .questtemplate

    Code:
    {
      "id" : "modname_end",
      "mainQuest" : true,
      "title" : "Mission Name",
      "prerequisites" : [  ],
      "text" : "Text",
      "completionText" : "Completion Text",
    
      "moneyRange" : [1000, 1000],
      "rewards" : [ ],
      "canBeAbandoned" : false,
      "updateDelta" : 10,
      "script" : "/quests/scripts/main.lua",
      "scriptConfig" : {
        "portraits" : {
          "questStarted" : "player",
          "questComplete" : "sail"
        },
    
        "missionRadioMessage" : {
          "messageId" : "MODNAMEunlocked",
          "unique" : false,
          "text" : "Condescending but helpful AI message"
        },
    
        "descriptions" : {
          "turnIn" : "Return to SAIL and go to MOD LOCATION to find CHARACTER."
        },
    
        "associatedMission" : "MODNAMEmission"
      }
    }
    


    Sorry for the vague, changed copy+pastes - but I'm trying to not release any spoilers (even if it barely matters).
    BUT, any help or even directing me to other mods to look at will be appreciated!
     
    Last edited: Jul 15, 2017
  2. Cyel

    Cyel Scruffy Nerf-Herder

    I fail to see how it'd complete upon picking up a codex with those parameters; is it not the quest you were talking about?
    If they're both separated, then to link the two you could use the "followUp" parameter inside of your scriptConfig object (you can look at eg. the first quests, or the farming ones for example)

    Regardless, you'd probably need to use a custom quest script instead the "main.lua" one; otherwise, the closest vanilla script would be "instance.lua" (tech, mech and arenae quests), but it'd require a "proximity" trigger and to go turn the quest back to some entity.

    Here's a quick untested attempt:
    Code:
    require "/quests/scripts/questutil.lua"
    require "/quests/scripts/portraits.lua"
    
    function init()
      quest.setObjectiveList({
      {config.getParameter("description"), false}
      })
      setPortraits()
      self.instanceTarget = config.getParameter("instanceTarget")
    end
    
    function questStart()
      local associatedMission = config.getParameter("associatedMission")
      if associatedMission then
      player.enableMission(associatedMission)
      end
    end
    
    function update(dt)
      if world.type() == self.instanceTarget then quest.complete() end
    end
    
    function questComplete()
      setPortraits()
      questutil.questCompleteActions()
    end
    

    And your questtemplate would look like:
    Code:
    {
      "id" : "modname_end",
      "mainQuest" : true,
      "title" : "Mission Name",
      "prerequisites" : [  ],
      "text" : "Text",
      "completionText" : "Completion Text",
    
      "moneyRange" : [1000, 1000],
      "rewards" : [ ],
      "canBeAbandoned" : false,
      "updateDelta" : 10,
      "script" : "/quests/scripts/THECUSTOMSCRIPT.lua",
      "scriptConfig" : {
        "instanceTarget": "YOURINSTANCENAME", //eg. "outpost"
        "portraits" : {
          "questStarted" : "player",
          "questComplete" : "sail"
        },
    
        "missionRadioMessage" : {
          "messageId" : "MODNAMEunlocked",
          "unique" : false,
          "text" : "Condescending but helpful AI message"
        },
    
        "description" : "Return to SAIL and go to MOD LOCATION to find CHARACTER.",
    
        "associatedMission" : "MODNAMEmission"
      }
    }
     
  3. EclipticWulf

    EclipticWulf Scruffy Nerf-Herder

    Perhaps I wasn't clear enough, then. I don't want it to complete when the codex is picked up. When the codex is picked up, I want it to initiate the quest. But thank you for the code on where to start, I'll see if I can get it to work.

    This is how I get it to activate (I looked at how Sayter did it)
    Code:
    "pickupQuestTemplates" : [ "MODNAME_end" ]
    
    The full idea is the player finds a codex, and upon picking it up, it makes an instance available to access. And some radio messages for flavor, too.

    Edit: Well, I got the auto-turn-in off now by just adding "requireTurnIn" : true, so now I'll look into the LUA more.
     
    Last edited: Jul 21, 2017

Share This Page