Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 10.47 KB | None | 0 0
  1. #include "inc_random"
  2. #include "inc_language"
  3. #include "hnd_quests"
  4. #include "inc_que_instanc"
  5.  
  6. //////////////////////
  7. // ---------------- //
  8. //   Quest script   //
  9. // ---------------- //
  10. //////////////////////
  11.  
  12. void main()
  13. {
  14.     ScriptHandler();
  15. }
  16.  
  17. ///////////////////
  18. // Script fields //
  19. ///////////////////
  20.  
  21. // Name of this script, should match the filename of the *.nss file (without the extension)
  22. string scriptName = "que_killwolves";
  23.  
  24. // Number of questgiver blueprints that can spawn with this quest
  25. int questgiversNumber = 6;
  26.  
  27. // Number of rumors regarding this quest (can be 0)
  28. int rumorsNumber = 1;
  29.  
  30. //////////////////////
  31. // Script functions //
  32. //////////////////////
  33.  
  34. // 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.
  35. // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
  36. // in order to make the selection respect the realm's random seed.
  37. // 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
  38. // generate different maps for different languages, which should be avoided.
  39. string GetRandomQuestName(object oQuest, string sSeedName, int nLanguage)
  40. {
  41.     object questGiver = GetQuestGiver(oQuest);
  42.     string name = GetName(questGiver);
  43.     switch (nLanguage)
  44.     {
  45.         case LANGUAGE_ENGLISH: return name + "'s wolf troubles";
  46.         case LANGUAGE_POLISH: return name + " i wilki";
  47.     }
  48.     return "";
  49. }
  50.  
  51. // Function that should return available questgiver ResRef for nIndex [0, questgiversNumber-1]
  52. string GetQuestgiverResRef(int nIndex)
  53. {
  54.     switch (nIndex)
  55.     {
  56.         case 0: return "npc_vil_hu_m_01";
  57.         case 1: return "npc_vil_hu_m_02";
  58.         case 2: return "npc_vil_hu_m_03";
  59.         case 3: return "npc_vil_hu_f_01";
  60.         case 4: return "npc_vil_hu_f_02";
  61.         case 5: return "npc_vil_hu_f_03";
  62.     }
  63.     return "";
  64. }
  65.  
  66. // Function that should return a random first name for a questgiver of this town, based on a LANGUAGE_* constant from inc_language.
  67. // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
  68. // in order to make the selection respect the realm's random seed.
  69. // 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
  70. // generate different maps for different languages, which should be avoided.
  71. string GetRandomQuestgiverFirstName(object oQuestGiver, string sSeedName, int nLanguage)
  72. {
  73.     if (GetGender(oQuestGiver) == GENDER_MALE)
  74.     {
  75.         if (nLanguage == LANGUAGE_POLISH)
  76.         {
  77.             switch (RandomNext(1))
  78.             {
  79.                 case 0: return "Wolfgang";
  80.             }
  81.         }
  82.         else
  83.         {
  84.             switch (RandomNext(1))
  85.             {
  86.                 case 0: return "Wolfgang";
  87.             }
  88.         }
  89.     }
  90.     else
  91.     {
  92.         if (nLanguage == LANGUAGE_POLISH)
  93.         {
  94.             switch (RandomNext(1))
  95.             {
  96.                 case 0: return "Genowefa";
  97.             }
  98.         }
  99.         else
  100.         {
  101.             switch (RandomNext(1))
  102.             {
  103.                 case 0: return "Genowolfa";
  104.             }
  105.         }
  106.     }
  107.     return "";
  108. }
  109.  
  110. // Function that should return a random last name for a questgiver of this town, based on a LANGUAGE_* constant from inc_language.
  111. // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
  112. // in order to make the selection respect the realm's random seed.
  113. // 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
  114. // generate different maps for different languages, which should be avoided.
  115. string GetRandomQuestgiverLastName(object oQuestGiver, string sSeedName, int nLanguage)
  116. {
  117.     if (GetGender(oQuestGiver) == GENDER_MALE)
  118.     {
  119.         if (nLanguage == LANGUAGE_POLISH)
  120.         {
  121.             switch (RandomNext(1))
  122.             {
  123.                 case 0: return "Wilczewski";
  124.             }
  125.         }
  126.         else
  127.         {
  128.             switch (RandomNext(1))
  129.             {
  130.                 case 0: return "Wolf";
  131.             }
  132.         }
  133.     }
  134.     else
  135.     {
  136.         if (nLanguage == LANGUAGE_POLISH)
  137.         {
  138.             switch (RandomNext(1))
  139.             {
  140.                 case 0: return "Wilczewska";
  141.             }
  142.         }
  143.         else
  144.         {
  145.             switch (RandomNext(1))
  146.             {
  147.                 case 0: return "Wolf";
  148.             }
  149.         }
  150.     }
  151.     return "";
  152. }
  153.  
  154. // Function that should return a a QuestReward struct for this quest, based on a LANGUAGE_* constant from inc_language.
  155. // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
  156. // in order to make the selection respect the realm's random seed.
  157. // 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
  158. // generate different maps for different languages, which should be avoided.
  159. struct QuestReward GetQuestReward(string sSeedName, int nLanguage)
  160. {
  161.     struct QuestReward result;
  162.     result.gold = 500;
  163.     result.experience = 500;
  164.     result.itemResRef = "";
  165.     result.itemStackSize = 0;
  166.  
  167.     return result;
  168. }
  169.  
  170. // 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.
  171. // Random() should not be used. Use the RandomNext() function from inc_random in conjunction with sSeedName instead
  172. // in order to make the selection respect the realm's random seed.
  173. // 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
  174. // generate different maps for different languages, which should be avoided.
  175. struct QuestDialogLines GetQuestDialogLines(struct QuestReward questReward, object oQuest, string sSeedName, int nLanguage)
  176. {
  177.     object questGiver = GetQuestGiver(oQuest);
  178.     struct QuestDialogLines result;
  179.  
  180.     if (nLanguage == LANGUAGE_POLISH)
  181.     {
  182.         result.journalName = "Zabić wilki";
  183.         result.journalInitial = "Muszę zabić wilki!";
  184.         result.journalSuccess = "Zabiłem wilki. :)";
  185.         result.journalFailure = "Nie zabiłem wilków. :(";
  186.         result.journalSuccessFinished = "Zabiłem wilki i dostałem golda.";
  187.         result.npcIntroLine = "Wilki!";
  188.         result.npcContentLine = "Olaboga, wilki w lesie, zabij.";
  189.         result.npcRewardLine = "Dostaniesz " + IntToString(questReward.gold) + " golda.";
  190.         result.npcBeforeCompletionLine = "Co z wilkami?!";
  191.         result.playerReportingSuccess = "Wilki nie żyją.";
  192.         result.playerReportingFailure = "Wilki żyją...";
  193.         result.npcReceivedSuccess = "Dzięki za zabicie wilków.";
  194.         result.npcReceivedFailure = "O ty, jak mogłeś nie zabić wilków!";
  195.         result.npcAfterSuccess = "Dzięki raz jeszcze za zabicie wilków!";
  196.         if (GetGender(questGiver) == GENDER_MALE)
  197.             result.npcAfterFailure = "Wciąż jestem wściekły, że nie zabiłeś wilków!";
  198.         else
  199.             result.npcAfterFailure = "Wciąż jestem wściekła, że nie zabiłeś wilków!";
  200.     }
  201.     else
  202.     {
  203.         result.journalName = "Kill The Wolves";
  204.         result.journalInitial = "Wilki!";
  205.         result.journalSuccess = "Zabiłem wilki. :)";
  206.         result.journalFailure = "Nie zabiłem wilków. :(";
  207.         result.journalSuccessFinished = "Zabiłem wilki i dostałem golda.";
  208.         result.npcIntroLine = "Wilki!";
  209.         result.npcContentLine = "Olaboga, wilki w lesie, zabij.";
  210.         result.npcRewardLine = "Dostaniesz " + IntToString(questReward.gold) + " golda.";
  211.         result.npcBeforeCompletionLine = "Co z wilkami?!";
  212.         result.playerReportingSuccess = "Wilki nie żyją.";
  213.         result.playerReportingFailure = "Wilki żyją...";
  214.         result.npcReceivedSuccess = "Dzięki za zabicie wilków.";
  215.         result.npcReceivedFailure = "O ty, jak mogłeś nie zabić wilków!";
  216.         result.npcAfterSuccess = "Dzięki raz jeszcze za zabicie wilków!";
  217.         result.npcAfterFailure = "Wciąż jestem wściekły, że nie zabiłeś wilków!";
  218.     }
  219.     return result;
  220. }
  221.  
  222. // Function that should return available NPC rumor for nIndex in range [0, rumorsNumber-1] based on an object representation of a quest instance
  223. string GetQuestRumor(object oQuest, int nIndex, int nLanguage)
  224. {
  225.     if (nLanguage == LANGUAGE_ENGLISH)
  226.     switch (nIndex)
  227.     {
  228.         case 0: "Someone wants some wolves dead.";
  229.     }
  230.     if (nLanguage == LANGUAGE_POLISH)
  231.     switch (nIndex)
  232.     {
  233.         case 0: "Ponoć ktoś potrzebuje kogoś, kto zabije wilki.";
  234.     }
  235.     return "";
  236. }
  237.  
  238. // Function that may perform custom logic when a PC accepts the quest. Note that all server PCs will get their journals updated,
  239. // 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.
  240. // This function body may also be empty if custom logic is not needed.
  241. // Note: giving PCs quest maps is handled by the framework and should not be done here
  242. void CustomQuestTakingLogic(object oQuest, object oConversingPC)
  243. {
  244.     SendMessageToPC(oConversingPC, "CustomQuestTakingLogic :D");
  245. }
  246.  
  247. // 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,
  248. // but you may want to, for example, remove specific items from inventory of a PC or all PCs.
  249. // This function body may also be empty if custom logic is not needed.
  250. // Note: handing out quest rewards and taking PCs' quest maps is handled by the framework and should not be done here
  251. void CustomQuestCompletionLogic(object oQuest, object oConversingPC)
  252. {
  253.     SendMessageToPC(oConversingPC, "CustomQuestCompletionLogic :)");
  254. }
  255.  
  256. // Function that may perform custom logic when a PC fails the quest and talks to the questgiver about it.
  257. // This function body may also be empty if custom logic is not needed.
  258. // Note: taking PCs' quest maps is handled by the framework and should not be done here
  259. void CustomQuestFailureLogic(object oQuest, object oConversingPC)
  260. {
  261.     SendMessageToPC(oConversingPC, "CustomQuestFailureLogic :o");
  262. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement