Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "inc_random"
- #include "inc_language"
- #include "hnd_quests"
- #include "inc_que_instanc"
- //////////////////////
- // ---------------- //
- // Quest script //
- // ---------------- //
- //////////////////////
- void main()
- {
- ScriptHandler();
- }
- ///////////////////
- // Script fields //
- ///////////////////
- // Name of this script, should match the filename of the *.nss file (without the extension)
- string scriptName = "que_killwolves";
- // Number of questgiver blueprints that can spawn with this quest
- int questgiversNumber = 6;
- // Number of rumors regarding this quest (can be 0)
- int rumorsNumber = 1;
- //////////////////////
- // Script functions //
- //////////////////////
- // Function that should return available quest name (as displayed in the journal), based on an object representation of a quest instance, a random seed name and a LANGUAGE_* constant from inc_language.
- // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
- // in order to make the selection respect the realm's random seed.
- // Note: Ensure that RandomNext() is called the same number of times no matter the language. If it's not, you risk making the same seeds
- // generate different maps for different languages, which should be avoided.
- string GetRandomQuestName(object oQuest, string sSeedName, int nLanguage)
- {
- object questGiver = GetQuestGiver(oQuest);
- string name = GetName(questGiver);
- switch (nLanguage)
- {
- case LANGUAGE_ENGLISH: return name + "'s wolf troubles";
- case LANGUAGE_POLISH: return name + " i wilki";
- }
- return "";
- }
- // Function that should return available questgiver ResRef for nIndex [0, questgiversNumber-1]
- string GetQuestgiverResRef(int nIndex)
- {
- switch (nIndex)
- {
- case 0: return "npc_vil_hu_m_01";
- case 1: return "npc_vil_hu_m_02";
- case 2: return "npc_vil_hu_m_03";
- case 3: return "npc_vil_hu_f_01";
- case 4: return "npc_vil_hu_f_02";
- case 5: return "npc_vil_hu_f_03";
- }
- return "";
- }
- // Function that should return a random first name for a questgiver of this town, based on a LANGUAGE_* constant from inc_language.
- // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
- // in order to make the selection respect the realm's random seed.
- // Note: Ensure that RandomNext() is called the same number of times no matter the language. If it's not, you risk making the same seeds
- // generate different maps for different languages, which should be avoided.
- string GetRandomQuestgiverFirstName(object oQuestGiver, string sSeedName, int nLanguage)
- {
- if (GetGender(oQuestGiver) == GENDER_MALE)
- {
- if (nLanguage == LANGUAGE_POLISH)
- {
- switch (RandomNext(1))
- {
- case 0: return "Wolfgang";
- }
- }
- else
- {
- switch (RandomNext(1))
- {
- case 0: return "Wolfgang";
- }
- }
- }
- else
- {
- if (nLanguage == LANGUAGE_POLISH)
- {
- switch (RandomNext(1))
- {
- case 0: return "Genowefa";
- }
- }
- else
- {
- switch (RandomNext(1))
- {
- case 0: return "Genowolfa";
- }
- }
- }
- return "";
- }
- // Function that should return a random last name for a questgiver of this town, based on a LANGUAGE_* constant from inc_language.
- // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
- // in order to make the selection respect the realm's random seed.
- // Note: Ensure that RandomNext() is called the same number of times no matter the language. If it's not, you risk making the same seeds
- // generate different maps for different languages, which should be avoided.
- string GetRandomQuestgiverLastName(object oQuestGiver, string sSeedName, int nLanguage)
- {
- if (GetGender(oQuestGiver) == GENDER_MALE)
- {
- if (nLanguage == LANGUAGE_POLISH)
- {
- switch (RandomNext(1))
- {
- case 0: return "Wilczewski";
- }
- }
- else
- {
- switch (RandomNext(1))
- {
- case 0: return "Wolf";
- }
- }
- }
- else
- {
- if (nLanguage == LANGUAGE_POLISH)
- {
- switch (RandomNext(1))
- {
- case 0: return "Wilczewska";
- }
- }
- else
- {
- switch (RandomNext(1))
- {
- case 0: return "Wolf";
- }
- }
- }
- return "";
- }
- // Function that should return a a QuestReward struct for this quest, based on a LANGUAGE_* constant from inc_language.
- // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
- // in order to make the selection respect the realm's random seed.
- // Note: Ensure that RandomNext() is called the same number of times no matter the language. If it's not, you risk making the same seeds
- // generate different maps for different languages, which should be avoided.
- struct QuestReward GetQuestReward(string sSeedName, int nLanguage)
- {
- struct QuestReward result;
- result.gold = 500;
- result.experience = 500;
- result.itemResRef = "";
- result.itemStackSize = 0;
- return result;
- }
- // Function that should return a a QuestDialogLines struct for this quest, based on a LANGUAGE_* constant from inc_language, a quest object and a QuestReward struct.
- // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
- // in order to make the selection respect the realm's random seed.
- // Note: Ensure that RandomNext() is called the same number of times no matter the language. If it's not, you risk making the same seeds
- // generate different maps for different languages, which should be avoided.
- struct QuestDialogLines GetQuestDialogLines(struct QuestReward questReward, object oQuest, string sSeedName, int nLanguage)
- {
- object questGiver = GetQuestGiver(oQuest);
- struct QuestDialogLines result;
- if (nLanguage == LANGUAGE_POLISH)
- {
- result.journalName = "Zabić wilki";
- result.journalInitial = "Muszę zabić wilki!";
- result.journalSuccess = "Zabiłem wilki. :)";
- result.journalFailure = "Nie zabiłem wilków. :(";
- result.journalSuccessFinished = "Zabiłem wilki i dostałem golda.";
- result.npcIntroLine = "Wilki!";
- result.npcContentLine = "Olaboga, wilki w lesie, zabij.";
- result.npcRewardLine = "Dostaniesz " + IntToString(questReward.gold) + " golda.";
- result.npcBeforeCompletionLine = "Co z wilkami?!";
- result.playerReportingSuccess = "Wilki nie żyją.";
- result.playerReportingFailure = "Wilki żyją...";
- result.npcReceivedSuccess = "Dzięki za zabicie wilków.";
- result.npcReceivedFailure = "O ty, jak mogłeś nie zabić wilków!";
- result.npcAfterSuccess = "Dzięki raz jeszcze za zabicie wilków!";
- if (GetGender(questGiver) == GENDER_MALE)
- result.npcAfterFailure = "Wciąż jestem wściekły, że nie zabiłeś wilków!";
- else
- result.npcAfterFailure = "Wciąż jestem wściekła, że nie zabiłeś wilków!";
- }
- else
- {
- result.journalName = "Kill The Wolves";
- result.journalInitial = "Wilki!";
- result.journalSuccess = "Zabiłem wilki. :)";
- result.journalFailure = "Nie zabiłem wilków. :(";
- result.journalSuccessFinished = "Zabiłem wilki i dostałem golda.";
- result.npcIntroLine = "Wilki!";
- result.npcContentLine = "Olaboga, wilki w lesie, zabij.";
- result.npcRewardLine = "Dostaniesz " + IntToString(questReward.gold) + " golda.";
- result.npcBeforeCompletionLine = "Co z wilkami?!";
- result.playerReportingSuccess = "Wilki nie żyją.";
- result.playerReportingFailure = "Wilki żyją...";
- result.npcReceivedSuccess = "Dzięki za zabicie wilków.";
- result.npcReceivedFailure = "O ty, jak mogłeś nie zabić wilków!";
- result.npcAfterSuccess = "Dzięki raz jeszcze za zabicie wilków!";
- result.npcAfterFailure = "Wciąż jestem wściekły, że nie zabiłeś wilków!";
- }
- return result;
- }
- // Function that should return available NPC rumor for nIndex in range [0, rumorsNumber-1] based on an object representation of a quest instance
- string GetQuestRumor(object oQuest, int nIndex, int nLanguage)
- {
- if (nLanguage == LANGUAGE_ENGLISH)
- switch (nIndex)
- {
- case 0: "Someone wants some wolves dead.";
- }
- if (nLanguage == LANGUAGE_POLISH)
- switch (nIndex)
- {
- case 0: "Ponoć ktoś potrzebuje kogoś, kto zabije wilki.";
- }
- return "";
- }
- // Function that may perform custom logic when a PC accepts the quest. Note that all server PCs will get their journals updated,
- // but you may want to, for example, add an item to be delivered to a single PC (oConversingPC) or spawn an NPC to be escorted.
- // This function body may also be empty if custom logic is not needed.
- // Note: giving PCs quest maps is handled by the framework and should not be done here
- void CustomQuestTakingLogic(object oQuest, object oConversingPC)
- {
- SendMessageToPC(oConversingPC, "CustomQuestTakingLogic :D");
- }
- // Function that may perform custom logic when a PC completes the quest and returns it to the questgiver. Note that all server PCs will get their journals updated,
- // but you may want to, for example, remove specific items from inventory of a PC or all PCs.
- // This function body may also be empty if custom logic is not needed.
- // Note: handing out quest rewards and taking PCs' quest maps is handled by the framework and should not be done here
- void CustomQuestCompletionLogic(object oQuest, object oConversingPC)
- {
- SendMessageToPC(oConversingPC, "CustomQuestCompletionLogic :)");
- }
- // Function that may perform custom logic when a PC fails the quest and talks to the questgiver about it.
- // This function body may also be empty if custom logic is not needed.
- // Note: taking PCs' quest maps is handled by the framework and should not be done here
- void CustomQuestFailureLogic(object oQuest, object oConversingPC)
- {
- SendMessageToPC(oConversingPC, "CustomQuestFailureLogic :o");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement