Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. /*=========================================================
  2. Hercules Invasion Prized
  3. by Mumbles
  4. ===========================================================
  5. Description:
  6. A completely revamped and optimised variation of the widely
  7. popular "Poring Invasion" event.
  8.  
  9. Configuration settings are dynamic and easily modifiable.
  10. Customizable parameters include normal monsters, "prized"
  11. monsters, each respective monster amounts, monster tiers,
  12. invasion map,NPC name, and server name.
  13.  
  14. NPC can be triggered by staff using the command @invasion.
  15. ===========================================================
  16. Compatibility:
  17. Optimised for Hercules emulators.
  18. ===========================================================
  19. Changelog:
  20. v1.0 - First version.
  21. v1.0.1 - Removed support for backwards compatibility.
  22. v1.0.2 - Optimised announcements.
  23. =========================================================*/
  24.  
  25. - script invasion -1,{
  26.  
  27. OnInit:
  28. // Configuration
  29. .npc_name$ = "[^0000FFHercules Invasion^000000]";
  30. .server_name$ = "Hercules"; // Server name
  31. .map_name$ = "Mapa sofisticado"; // Invasion map name
  32. .map$ = "guild_vs2"; // Invasion map
  33. .reward = 7711; // Event Ticket
  34. .tiers = 3; // Amount of tiers //Níveis de monstros, como se fosse andares..
  35. .limit = 22; // Kill limit
  36. .delay = 5; // Announcement delay in seconds
  37. .auth = 60; // GM level to access staff panel
  38.  
  39. // Normal mob IDs
  40. setarray .normal[0], 1916, 1918, 1919, 1920, 1921;
  41.  
  42. // Normal mob amounts
  43. setarray .n_mobs[0], 1, 3, 3, 3, 3;
  44.  
  45. // Prized mob IDs
  46. setarray .prized[0], 1916, 1918, 1919, 1920, 1921;
  47.  
  48. // Prized mob amounts
  49. setarray .p_mobs[0], 0, 1, 1, 1, 1;
  50.  
  51. // Define announcements
  52. setarray .announce$[0],
  53. "Porings of the world seem to have started an uprising because they continue to be hunted...",
  54. "It appears that they plan to raid the city of "+ .map_name$ +" today!",
  55. "They've feared "+ .map_name$ +" for ages, and are sick of it!",
  56. "Prepare yourself, Warriors of "+ .server_name$ +"!",
  57. "They're approaching...",
  58. "The "+ .map_name$ +" Soldiers are unable to fight!",
  59. "They need assistance!";
  60.  
  61. // Create @invasion command
  62. bindatcmd "invasion", strnpcinfo(3) +"::OnInvasion", .auth, .auth;
  63. end;
  64.  
  65. OnInvasion:
  66. mes .npc_name$;
  67. mes "Hey there, "+ strcharinfo(0) +"!";
  68. mes "What would you like to do?";
  69. mes " ";
  70.  
  71. while (true) {
  72. switch(select("Start invasion:Stop invasion")) {
  73. case 1:
  74. // Check invasion status
  75. if(.state) {
  76. mes "^FF0000The invasion is already in progress!^000000";
  77. break;
  78. }
  79. close2;
  80. goto OnEnable;
  81.  
  82. case 2:
  83. // Check invasion status
  84. if(.state < 2) {
  85. mes "^FF0000There is no invasion in progress!^000000";
  86. break;
  87. }
  88.  
  89. // End invasion
  90. donpcevent strnpcinfo(3) +"::OnTimer3600000";
  91. close;
  92. }
  93. }
  94.  
  95. OnEnable:
  96. // Set invasion status
  97. .state++;
  98. .wave++;
  99.  
  100. // Announcements
  101. for (.@i = 0; .@i < getarraysize(.announce$); .@i++) {
  102. announce .announce$[.@i], bc_all;
  103. sleep .delay * 1000;
  104. }
  105.  
  106. announce "Wave "+ .wave +" of the Poring forces presses onward!", bc_all;
  107.  
  108. // Normal mobs
  109. for (.@i = 0; .@i < getarraysize(.normal); .@i++) {
  110. monster .map$, 0, 0, getmonsterinfo(.normal[.@i], 0), .normal[.@i], .n_mobs[.@i], "";
  111. }
  112.  
  113. // Prized mobs
  114. for (.@i = 0; .@i < getarraysize(.prized); .@i++) {
  115. monster .map$, 0, 0, getmonsterinfo(.prized[.@i], 0), .prized[.@i], .p_mobs[.@i], strnpcinfo(3) +"::OnMobKilled";
  116. }
  117.  
  118. setmapflag .map$, mf_nomobloot;
  119. initnpctimer;
  120. .state++;
  121. end;
  122.  
  123. OnClock0100:
  124. OnClock2100:
  125. // Start invasion
  126. donpcevent strnpcinfo(3) +"::OnEnable";
  127. end;
  128.  
  129.  
  130. OnTimer3600000:
  131. // Kill all monsters and reset invasion status
  132. killmonster .map$,"All";
  133. announce "Poring forces have been overcome. They're retreating!",0;
  134. removemapflag .map$, mf_nomobloot;
  135. stopnpctimer;
  136. .count = 0;
  137. .state = 0;
  138. end;
  139.  
  140. OnMobKilled:
  141. // Tier 1
  142. setarray .@tier1[0], 1918;
  143.  
  144. // Tier 2
  145. setarray .@tier2[0], 1919;
  146.  
  147. // Tier 3
  148. setarray .@tier3[0], 1920;
  149.  
  150. // Tier 4
  151. setarray .@tier4[0], 1921;
  152.  
  153. // Tier 5
  154. setarray .@tier5[0], 1916;
  155.  
  156. // Check if monster killed is listed in tiers
  157. for (.@t = 0; .@t < .tiers; .@t++) {
  158. set .@size, getarraysize(getd(".@tier"+ (.@t + 1)));
  159. //debugmes "size of " + .@t + ": " + .@size;
  160. for (.@i = 0; .@i < .@size; .@i++) {
  161. if (.state && killedrid == getelementofarray(".@tier"+ (.@t + 1), .@i)) {
  162. .@amount = .@t + 1;
  163. .@winner++;
  164. }
  165. }
  166. }
  167.  
  168. // Reward and announce winner; increment count
  169. if (.@winner > 0) {
  170. announce .@tier +" "+ getitemname(.reward) +" won by "+ strcharinfo(0) + ".", bc_map | bc_blue;
  171. getitem .reward, .@amount;
  172. .count++;
  173. }
  174.  
  175. if (.count > .limit) {
  176. goto OnTimer3600000;
  177. }
  178.  
  179. end;
  180.  
  181. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement