Guest User

Untitled

a guest
Nov 24th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.34 KB | None | 0 0
  1. // Automated GvG Event 2.0 Beta version
  2. // Event runs every hour via OnMinute timer.
  3. // Feel free to edit as you wish
  4. // By : Mabuhay
  5. // Free release
  6. // Dont remove credit
  7. // Updated to v 2.0
  8. /*
  9. - Added gepard support and check to every members
  10. - More flexible options
  11. - Can set cash, members, timer, and winpoints if gm starts the command.
  12.  
  13. New mechanics.
  14.  
  15. - When using @gvgeventjoin, all your members must be around you by 5x5 cell.
  16.  
  17. NOTE:
  18. item rewards are only to be set here in script because adding them
  19. in the GM option would be quite troublesome for me :D
  20. */
  21. //
  22. - script gvg_event -1,{
  23. OnInit:
  24. // Enable gepard check?
  25. // set to true to enable
  26. .gepard = true;
  27.  
  28. // How many guild members are required?
  29. // 3 = 3v3
  30. // 5 = 5v5
  31. // etc..
  32. // only to be set once..
  33. if ( !$gvgevent_mem ) $gvgevent_mem = 3;
  34.  
  35. // registration timer in mins.
  36. // only to be set once..
  37. if ( !$gvgevent_time ) $gvgevent_time = 1;
  38.  
  39. // how much points to win? Points is earned per kill
  40. // only to be set once..
  41. if ( !$gvgevent_winpts ) $gvgevent_winpts = 2;
  42.  
  43. // item reward
  44. // <item_id>, <amount>
  45. setarray .item,
  46. 30002, 1000,
  47. 14232, 1;
  48.  
  49. // how much cash points earned
  50. // set to 0 to disable
  51. if ( !$gvgevent_cash ) $gvgevent_cash = 0;
  52.  
  53. .size = getarraysize(.item);
  54. bindatcmd "gvgeventstart", strnpcinfo(0)+"::OnStartEvent",60,60;
  55. bindatcmd "gvgeventend", strnpcinfo(0)+"::OnEndEvent",60,60;
  56. bindatcmd "gvgeventjoin", strnpcinfo(0)+"::OnJoinEvent";
  57. end;
  58.  
  59. OnStartEvent:
  60. mes "Hi GM, what do you want to do?";
  61. mes "Current settings :";
  62. mes "Member count : "+ $gvgevent_mem;
  63. mes "Registration time : "+ $gvgevent_time;
  64. mes "Win points : "+ $gvgevent_winpts;
  65. mes "Cashpoint reward : "+ $gvgevent_cash;
  66. next;
  67. switch(select("Start Event:Set Mem Count:Set Reg timer:Set Win Points:Set Cashpoint Reward")) {
  68. case 1:
  69. mes "Starting event..";
  70. close2;
  71. break;
  72. case 2:
  73. mes "Enter member count value";
  74. mes "current : "+ $gvgevent_mem;
  75. next;
  76. input .@amt, 1;
  77. mes "Do you want to set member count to "+ .@amt +"?";
  78. next;
  79. select("Yes");
  80. mes "Done!";
  81. close2;
  82. $gvgevent_mem = .@amt;
  83. end;
  84. case 3:
  85. mes "Enter registration time value";
  86. mes "current : "+ $gvgevent_time;
  87. next;
  88. input .@amt, 1;
  89. mes "Do you want to set registration time to "+ .@amt +"?";
  90. next;
  91. select("Yes");
  92. mes "Done!";
  93. close2;
  94. $gvgevent_time = .@amt;
  95. end;
  96. case 4:
  97. mes "Enter win points value";
  98. mes "current : "+ $gvgevent_winpts;
  99. next;
  100. input .@amt, 1;
  101. mes "Do you want to set win points to "+ .@amt +"?";
  102. next;
  103. select("Yes");
  104. mes "Done!";
  105. close2;
  106. $gvgevent_winpts = .@amt;
  107. end;
  108. case 5:
  109. mes "To disable, set to zero (0)";
  110. mes "current : "+ $gvgevent_cash;
  111. next;
  112. input .@amt;
  113. mes "Do you want to set cashpoints to "+ .@amt +"?";
  114. next;
  115. select("Yes");
  116. mes "Done!";
  117. close2;
  118. $gvgevent_cash = .@amt;
  119. end;
  120. }
  121. OnMinute00: // runs every hour..
  122. if ( .start ) end;
  123. .start = 1;
  124. .@m = $gvgevent_mem;
  125. gvgoff "guild_vs1";
  126. for ( .@j = 1; .@j < 9; .@j++ )
  127. enablenpc "#bari0"+.@j;
  128. setwall "guild_vs1", 12, 48, 4, DIR_NORTH, 0, "wonderwall_1";
  129. setwall "guild_vs1", 87, 48, 4, DIR_NORTH, 0, "wonderwall_2";
  130. for ( .@i = $gvgevent_time; .@i > 0; .@i-- ) {
  131. if ( .start < 2 ) {
  132. announce "<"+.@m+"v"+.@m+" Guild Event> Event start in "+.@i+" min(s) until slots are taken. Type @gvgeventjoin to register.", bc_all;
  133. sleep 60000;
  134. }
  135. }
  136. if ( !.slot1 || !.slot2 ) {
  137. announce "<"+.@m+"v"+.@m+" Guild Event> Event is cancelled. Not enough participants.", bc_all;
  138. donpcevent strnpcinfo(0)+"::OnEndEvent";
  139. end;
  140. }
  141. announce "<"+.@m+"v"+.@m+" Guild Event> Guild ["+getguildname(.slot1)+"] vs Guild ["+getguildname(.slot2)+"].", bc_all;
  142. end;
  143.  
  144. OnJoinEvent:
  145. .@GID = getcharid(2);
  146. if (.@GID == 0) {
  147. mes "Sorry, you are not in a guild.";
  148. close;
  149. }
  150. if (!is_guild_leader(.@GID)) {
  151. mes "Sorry, only your guild master can register.";
  152. close;
  153. }
  154. if ( !.start ) {
  155. mes "Event has not started.";
  156. close;
  157. } else if ( .start == 2 ) {
  158. mes "Event is still on-going.";
  159. close;
  160. } else {
  161. if ( .slot1 && .slot2 ) {
  162. mes "All slots has been taken.";
  163. close;
  164. }
  165. if ( !.slot1 ) .@slot = 1;
  166. else if ( !.slot2) .@slot = 2;
  167. if ( .slot1 == .@GID ) {
  168. mes "You're guild has already registered.";
  169. close;
  170. }
  171. getmapxy(.@map$, .@x, .@y, BL_PC);
  172. getareaunits(BL_PC,.@map$,.@x+5,.@y+5,.@x-5,.@y-5,.@char_name$[0]);
  173. freeloop(true);
  174. for(.@i=0;.@i<getarraysize(.@char_name$);.@i++)
  175. if ( getcharid(2, .@char_name$[.@i] ) == .@GID ) {
  176. if ( .gepard ) {
  177. query_sql("SELECT `last_unique_id` FROM `login` WHERE `account_id` = '"+ getcharid(3, .@char_name$[.@i] ) +"'", .@unique_id$);
  178. .@gvg_gepard$[.@gsize++] = .@unique_id$;
  179. if ( countinarray( .@gvg_gepard$[0], .@unique_id$ ) > 1 ) .@duplicate++;
  180. }
  181. .@current_mem++;
  182. .@aid[.@size++] = convertpcinfo(.@char_name$[.@i], CPC_ACCOUNT);
  183. .@validmem$[.@size2++] = .@char_name$[.@i];
  184. }
  185. freeloop(false);
  186. if ( .@current_mem < $gvgevent_mem ) {
  187. mes "You need at least "+$gvgevent_mem+" guild members around you"+(.gepard ? " with unique gepard id":"")+".";
  188. close;
  189. }
  190. if ( .@current_mem > $gvgevent_mem ) {
  191. mes "You need only need "+$gvgevent_mem+" guild members around you"+(.gepard ? " with unique gepard id":"")+".";
  192. close;
  193. }
  194. if ( .gepard && .@duplicate ) {
  195. mes "Gepard ID duplicate detected.";
  196. mes "A member around you is using dual account.";
  197. close;
  198. }
  199. mes "Participating members are :";
  200. for ( .@i = 0; .@i < .@size2; .@i++)
  201. mes "~ "+ .@validmem$[.@i];
  202. next;
  203. mes "Are you ready ?";
  204. next;
  205. select("Yes");
  206. switch ( .@slot ) {
  207. case 1: .slot1 = .@GID; break;
  208. case 2: .slot2 = .@GID; break;
  209. }
  210. for ( .@j = 0; .@j < .@size; .@j++ ) {
  211. attachrid(.@aid[.@j]);
  212. .@gid = getcharid(2);
  213. sc_end SC_ALL; // remove all status buffs
  214. percentheal 100,100; // heals before warp
  215. warp "guild_vs1", ( .slot1 == .@gid ) ? 7 : 92, 50;
  216. }
  217. detachrid;
  218. if ( .slot1 && .slot2 ) {
  219. .start = 2;
  220. awake strnpcinfo(0);
  221. sleep 3000;
  222. mapannounce "guild_vs1", "Get ready !~", bc_blue;
  223. sleep 2000;
  224. for ( .@i = 5; .@i > 0; --.@i ) {
  225. mapannounce "guild_vs1", .@i +" !~", bc_blue;
  226. sleep 1000;
  227. }
  228. mapannounce "guild_vs1", "Start !~", bc_blue;
  229. gvgon "guild_vs1";
  230. for ( .@j = 1; .@j < 9; .@j++ )
  231. disablenpc "#bari0"+.@j;
  232. delwall "wonderwall_1";
  233. delwall "wonderwall_2";
  234. }
  235. }
  236. end;
  237.  
  238. OnPCKillEvent:
  239. if ( .start && strcharinfo(3) == "guild_vs1" ) {
  240. .@GID = getcharid(2);
  241. if ( .@GID == .slot1 ) .guild1_score++;
  242. else if ( .@GID == .slot2 ) .guild2_score++;
  243. mapannounce "guild_vs1", strcharinfo(0) +" of Guild ["+getguildname(.@GID)+"] has pawned "+ rid2name(killedrid), bc_blue;
  244. mapannounce "guild_vs1", "Guild ["+getguildname(.slot1)+"] - "+.guild1_score+" || Guild ["+getguildname(.slot2)+"] - "+.guild2_score+"", bc_blue;
  245. if ( .guild1_score == $gvgevent_winpts || .guild2_score == $gvgevent_winpts ) {
  246. gvgoff "guild_vs1";
  247. if ( .guild1_score > .guild2_score ) { .winner = .slot1; .loser = .slot2; }
  248. else { .winner = .slot2; .loser = .slot1; }
  249. .@m = $gvgevent_mem;
  250. announce "<"+.@m+"v"+.@m+" Guild Event> Guild ["+getguildname(.winner)+"] is victorious against Guild ["+getguildname(.loser)+"] !", bc_all;
  251. mapannounce "guild_vs1", "Rewards will be delivered in few seconds before warping out.", bc_blue;
  252. sleep 8000; // 8 sec pause so participating members can re-warp if dead
  253. getmapunits(BL_PC, "guild_vs1", .@aid[0]);
  254. for(.@i=0;.@i<getarraysize(.@aid);.@i++) {
  255. attachrid(.@aid[.@i]);
  256. if ( getcharid(2) == .winner ) { // if winner
  257. for ( .@j = 0; .@j < .size; .@j+=2 )
  258. getitem .item[.@j], .item[.@j+1];
  259. if ( $gvgevent_cash ) {
  260. #CASHPOINTS += $gvgevent_cash;
  261. dispbottom "You have gained "+$gvgevent_cash+" cashpoints. Total : "+ #CASHPOINTS;
  262. }
  263. } else if ( getcharid(2) == .loser ) { // if loser
  264. dispbottom "Thank you for participating GvG Event.";
  265. }
  266. }
  267. detachrid;
  268. sleep 2000; // 2 sec pause..
  269. donpcevent strnpcinfo(0)+"::OnEndEvent";
  270. end;
  271. }
  272. attachrid( killedrid );
  273. .@GID = getcharid(2);
  274. if ( .@GID == .slot1 || .@GID == .slot2 ) {
  275. dispbottom "You will be warped back to the battle area in few secs.";
  276. sleep2 4000; // return to battle in 5 sec
  277. warp "guild_vs1", (.@GID == .slot1) ? 7:(.@GID == .slot2) ? 92:50, 50;
  278. sleep2 1000; // heal in 1 sec
  279. percentheal 100,100;
  280. }
  281. }
  282. end;
  283.  
  284. OnEndEvent:
  285. if ( !.start ) end;
  286. .start = .slot1 = .slot2 = .loser = .winner = .guild1_score = .guild2_score = false;
  287. mapwarp "guild_vs1", "gonryun", 159, 118;
  288. end;
  289. }
  290.  
  291. // Barricades
  292. guild_vs1,12,48,0 script #bari01 1906,{ end; OnInit: disablenpc strnpcinfo(0); }
  293. guild_vs1,12,49,0 script #bari02 1906,{ end; OnInit: disablenpc strnpcinfo(0); }
  294. guild_vs1,12,50,0 script #bari03 1906,{ end; OnInit: disablenpc strnpcinfo(0); }
  295. guild_vs1,12,51,0 script #bari04 1906,{ end; OnInit: disablenpc strnpcinfo(0); }
  296. guild_vs1,87,48,0 script #bari05 1906,{ end; OnInit: disablenpc strnpcinfo(0); }
  297. guild_vs1,87,49,0 script #bari06 1906,{ end; OnInit: disablenpc strnpcinfo(0); }
  298. guild_vs1,87,50,0 script #bari07 1906,{ end; OnInit: disablenpc strnpcinfo(0); }
  299. guild_vs1,87,51,0 script #bari08 1906,{ end; OnInit: disablenpc strnpcinfo(0); }
Add Comment
Please, Sign In to add comment