• Welcome to AtomicTorch Studio Forums.
 

Void Expanse Tutorials right in here!

Started by ninekorn, July 07, 2018, 12:18:21 PM

ninekorn

#15
TUTORIAL 1.5 FILES

Here is the link to the files of the tutorial 1.5. Sorry, I didn't have time yesterday when I came back from work, I basically ate and went right to sleep. You can compare what you did wrong by seeing how I wrote the script.

https://drive.google.com/open?id=1ou6MxDkFtvkVN4NZyJwBS_TvZwJVSFJP

Your line of code here doesn't seem to be wrong. My explanation wasn't really precise enough last time.

id = generator.AddNPCShipToSystem("Jonas Temple", "JonasTemple", 1, "special_jonas_temple", sys_id, chosenBase.coord.x, chosenBase.coord.y, { class: "agent", unique_id: "jonastemple", meta: "human", sex: "male" }); // Jonas Temple

Now you need to go Inside the generic_quests folder and open up your quest .js file. Inside of that file, you should have this function here:


function OnCheckRequirements()
{
    var npc_id = topic.GetCurrentNpcShipId();

    if (npc.GetTag(npc_id, "class") == "TUTORIALNPC")
    {
        return true;
    }
    return false;
}


As you can see, if you read between the lines it says: if the NPC Class is TUTORIALNPC, then "activate" this quest script for this NPC. So basically, if we use your code, the OnCheckRequirements that you should use should be:


function OnCheckRequirements()
{
    var npc_id = topic.GetCurrentNpcShipId();

    if (npc.GetTag(npc_id, "class") == "agent")
    {
        return true;
    }
    return false;
}


and that's because your NPC class is "agent". But if you use multiple NPC's with the class "agent", then all of those NPC's are gonna have this quest script available when you talk to them.

Wilmore

Aye, of course, that was it. It worked now. I can then go on to experiment with how I want my quest to be :-)

Also looking forward to the next part of your tutorial, to see how I can make the quest available as a repeatable quest, at several different systems (how about only in the Order capital, and so on?).

I also wonder if it would be possible as a part of a quest chain, to generate a new station or system (like "fixing" a jumpgate or something like that). That would be epic!
It doesn't matter what we think of God, but what He thinks of us.       - Pascal