How to Script a Mission
In this page you will learn how to script a mission from scratch.
Getting Started
This guide assumes you already have a basic understanding of writing quests, if not then I highly recommend reading BlueKirby0's guide: "How to Make a Quest". If you're too lazy to read over that then don't worry, i'll be going over most things in his guide (but in a lot less detail).
To keep things simple, let's start off with Windurst Mission 7-2 (The Sixth Ministry) as it covers most of what we need to go through.
After accepting the Mission, we must go to Tosuka-Porika in Windurst Waters for a cutscene, so go ahead open up his script (scripts/zones/Windurst_Waters/Tosuka-Porika.lua).
NOTE: I recommend using Notepad++ to open scripts as it has syntax highlighting and helps keep track of 'if' statements and their 'end's.
Scroll down to the onTrigger section and we see this:
function onTrigger(player,npc) -- NOTE: I've cut out the lines not relevant to what we're doing or this alone would've taken up half the guide... if (player:getCurrentMission(COP) == THE_ROAD_FORKS and player:getVar("MEMORIES_OF_A_MAIDEN_Status")==10)then player:startEvent(0x036B);--COP event -- NOTE: I've cut out the lines not relevant to what we're doing or this alone would've taken up half the guide... elseif(chasingStatus == QUEST_ACCEPTED and player:getVar("CHASING_TALES_TRACK_BOOK") > 0) then player:startEvent(0x019c); elseif(player:hasKeyItem(149) ==true) then player:startEvent(0x019c); elseif(chasingStatus == QUEST_ACCEPTED) then player:startEvent(0x0196); -- Add follow up cutscene else player:startEvent(0x0172); -- Standard Conversation end end;
Now that we've got his script open, we need to add a check for Windurst Mission 7-1 before starting the cutscene to progress in the mission so let's add that check:
elseif(chasingStatus == QUEST_ACCEPTED) then player:startEvent(0x0196); -- Add follow up cutscene ----> Windurst Mission 7-1 <---- elseif(player:getCurrentMission(WINDURST) == THE_SIXTH_MINISTRY and player:getVar("MissionStatus") == 0) then -- player:startEvent() else player:startEvent(0x0172); -- Standard Conversation
Notice how we not only check the player's current mission, we also check the variable "MissionStatus". This is done so we know that the player has just received the mission and has not made any progress in it which is why the variable "MissionStatus" has a value of 0.
Now we must find the correct cutscene for this mission. To do this you can find the mission on ffxiclopedia and scroll down to the spoiler and click [show].
SPOILER WARNING: Details about a quest, mission or other Final Fantasy XI in-game storyline follow. [show]
You then find the Event IDs for that NPC in that particular zone (in our case it's Windurst Waters Event IDs and find the cutscene matching that dialog using the "@cs" command on a GM char e.g.
@cs 830
Once you find the correct cutscene you must convert it from decimal to hexadecimal before using it for "player:startEvent( )".