yuhsing

Untitled

Apr 12th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.44 KB | None | 0 0
  1.  
  2. /* ------------------------- *
  3. * Euphy's Event Manager *
  4. * ------------------------- *
  5. * This is a paid script. *
  6. * Do not redistribute. */
  7.  
  8. zhakastia,98,38,1 script Event Manager 109,{
  9. function SetDefault; function ShowStatus; function Event; function Etc;
  10. while(1) {
  11. mes "[Event Manager]";
  12. if (ShowStatus(.Active,1)) switch(.Active) {
  13. case 6: break; // No warps necessary for Disguise event.
  14. case 4: case 7: if (!.Waiting) break; // Warp only before the event begins.
  15. default: set .@warp,1;
  16. } else mes "There is no ongoing event.";
  17. next;
  18. switch(select(
  19. ((getgmlevel() < .GMBasic)?":":" > ^FF0000GM Menu^000000:")+
  20. ((.@warp)?" > ^0055FFWarp to event^000000:":":")+
  21. " > Event Information:"+
  22. (($0_auto)?" > Event Schedule:":":")+
  23. ((getgmlevel() < .GMFull)?":":" > ^FF0000Edit Reward^000000:")+
  24. " > ^777777Close^000000"
  25. )) {
  26. case 1: break;
  27. case 2: warp getd("."+.Active+"_map$"),0,0; close;
  28. case 3:
  29. if (.Active) set .@i, .Active; // Only show information for active event if one is ongoing.
  30. else set .@i, select(.Menu$);
  31. mes "[Event Manager]";
  32. mes "^0055FF ~ "+.Events$[.@i]+" ~^000000";
  33. mes " > Event Rewards (^FF0000"+$reward$[1]+" x "+$reward$[0]+"^000000)";
  34. switch(.@i) {
  35. case 1:
  36. mes "A group of monsters will randomly";
  37. mes "spawn on a map. Some are normal";
  38. mes "monsters, and some are not. ";
  39. mes "Kill the special ones for prizes!";
  40. break;
  41. case 2:
  42. mes "A random MVP will spawn each";
  43. mes "round of the event. Whoever finds";
  44. mes "and kills it will be rewarded, and";
  45. mes "the next round will begin.";
  46. break;
  47. case 3:
  48. mes "A few monsters will spawn";
  49. mes "randomly on a map. Find";
  50. mes "and kill them for rewards!";
  51. break;
  52. case 4:
  53. mes "When the event starts, 100";
  54. mes "Porings will spawn. Only 1";
  55. mes "is a real Poring, and 99";
  56. mes "are fakes. The event ends";
  57. mes "when the real Poring is killed.";
  58. break;
  59. case 5:
  60. mes "Thousands of zombies spawn";
  61. mes "on a map. Most are normal";
  62. mes "monsters, but some will give";
  63. mes "prizes. The invasion ends when";
  64. mes "all special zombies are killed.";
  65. break;
  66. case 6:
  67. mes "I will disguise as a random";
  68. mes "monster. The first player to";
  69. mes "guess my name correctly";
  70. mes "will receive a prize.";
  71. break;
  72. case 7:
  73. mes "When the event starts,";
  74. mes "free-for-all PVP will be";
  75. mes "turned on. The last player";
  76. mes "alive is the winner.";
  77. break;
  78. }
  79. close;
  80. case 4:
  81. mes "[Event Manager]";
  82. set .@k, getarraysize(.Events$);
  83. freeloop(1); // Just in case. :D
  84. for(set .@i,0; .@i<24; set .@i,.@i+1) if ($0_auto&(1<<.@i))
  85. for(set .@j,1; .@j<.@k; set .@j,.@j+1) if (getd("$"+.@j+"_auto")&(1<<.@i)) {
  86. mes ((.@i < 10)?"0":"")+.@i+".00: ^0055FF"+.Events$[.@j]+"^000000";
  87. break;
  88. }
  89. freeloop(0);
  90. close;
  91. case 5:
  92. mes "[Event Manager]";
  93. mes "Enter ^FF0000ItemID or Variables^000000";
  94. input .@event_reward$;
  95. if( getitemname( atoi( .@event_reward$ ) ) == "null" ){
  96. mes "Enter ^FF0000Reward Name^000000";
  97. input .@event_reward_name$;
  98. }else{
  99. set .@event_reward_name$,getitemname( atoi( .@event_reward$ ) );
  100. }
  101. mes "Amount to be reward";
  102. input .@event_reward_amount;
  103. next;
  104. mes "Name : "+.@event_reward_name$;
  105. mes "Reward : "+.@event_reward$;
  106. mes "Amount : "+.@event_reward_amount;
  107. if( .@event_reward_amount > 0 ){
  108. setarray $reward$,.@event_reward_name$,.@event_reward$,.@event_reward_amount;
  109. }else{
  110. message strcharinfo(0),"Invalid Amount";
  111. }
  112. case 6: close;
  113. }
  114. while(1) {
  115. mes "[Event Manager]";
  116. mes "Select an event to manage.";
  117. next;
  118. set .@i, select(.Menu$+" ~ Automated events: ~ Set values to default: ~ ^777777Back to main menu...^000000");
  119. if (.@i == 10) break;
  120. if (.@i < 8) {
  121. mes "["+.Events$[.@i]+"]";
  122. if (!ShowStatus(.@i)) mes "Status: ^777777Inactive^000000";
  123. next;
  124. }
  125. switch(.@i) {
  126. case 1:
  127. while(1) {
  128. set .@j, select(
  129. "Monster ["+getmonsterinfo(.1_mobID,0)+"]:"+
  130. "Normal Monsters ["+.1_mobNum+"]:"+
  131. "Special Monsters ["+.1_mobNumS+"]:"+
  132. "Points per kill ["+.1_points+"]:"+
  133. "Map ["+.1_map$+"]:"+
  134. ((!.Active)?"^0055FFStart Event^000000:":":")+
  135. ((.Active == 1)?"^FF0000End Event^000000:":":")+
  136. "^777777Back to event menu...^000000"
  137. );
  138. if (.@j == 8) break;
  139. else if (.@j > 5) Event(1,7-.@j,1);
  140. if (Etc(1,1)) switch(.@j) {
  141. case 1:
  142. input .@s;
  143. if (Etc(255,.@s)) set .1_mobID, .@s;
  144. break;
  145. case 2: input .1_mobNum; break;
  146. case 3: if (Etc()) input .1_mobNumS,1; break;
  147. case 4: if (Etc()) input .1_points; break;
  148. case 5: Etc(1); break;
  149. }
  150. }
  151. break;
  152. case 2:
  153. while(1) {
  154. set .@j, select(
  155. "MVP List ["+getarraysize(.2_mvp)+" total]:"+
  156. "Number of Rounds ["+.2_rounds+"]:"+
  157. "Points per kill ["+.2_points+"]:"+
  158. "Map ["+.2_map$+"]:"+
  159. ((!.Active)?"^0055FFStart Event^000000:":":")+
  160. ((.Active == 2)?"^FF0000End Event^000000:":":")+
  161. "^777777Back to event menu...^000000"
  162. );
  163. if (.@j == 7) break;
  164. else if (.@j > 4) Event(2,6-.@j,1);
  165. if (Etc(1,2)) switch(.@j) {
  166. case 1:
  167. message strcharinfo(0),"Select an MVP to remove it.";
  168. while(1) {
  169. set .@list$,"^0055FFAdd a monster...:^777777Go back...^000000:";
  170. for(set .@k,0; .@k<getarraysize(.2_mvp); set .@k,.@k+1)
  171. set .@list$, .@list$+getmonsterinfo(.2_mvp[.@k],0)+":";
  172. set .@k, select(.@list$);
  173. if (.@k == 1) {
  174. input .@s;
  175. if (Etc(255,.@s)) {
  176. message strcharinfo(0),"Added mob '"+getmonsterinfo(.@s,0)+"'.";
  177. set .2_mvp[getarraysize(.2_mvp)], .@s;
  178. }
  179. } else if (.@k == 2) break;
  180. else {
  181. if (getarraysize(.2_mvp) == 1) message strcharinfo(0),"The list cannot be empty.";
  182. else {
  183. message strcharinfo(0),"Deleted '"+getmonsterinfo(.2_mvp[.@k-3],0)+"' from the list.";
  184. deletearray .2_mvp[.@k-3],1;
  185. }
  186. }
  187. }
  188. break;
  189. case 2: input .2_rounds,1; break;
  190. case 3: if (Etc()) input .2_points; break;
  191. case 4: Etc(2); break;
  192. }
  193. }
  194. break;
  195. case 3:
  196. while(1) {
  197. set .@j, select(
  198. "Monster ["+getmonsterinfo(.3_mobID,0)+"]:"+
  199. "Number of Monsters ["+.3_mobNum+"]:"+
  200. "Points per kill ["+.3_points+"]:"+
  201. "Map ["+.3_map$+"]:"+
  202. ((!.Active)?"^0055FFStart Event^000000:":":")+
  203. ((.Active == 3)?"^FF0000End Event^000000:":":")+
  204. "^777777Back to event menu...^000000"
  205. );
  206. if (.@j == 7) break;
  207. else if (.@j > 4) Event(3,6-.@j,1);
  208. if (Etc(1,3)) switch(.@j) {
  209. case 1:
  210. set .@list$,"";
  211. for(set .@k,0; .@k<getarraysize(.3_pre); set .@k,.@k+1)
  212. set .@list$, .@list$+getmonsterinfo(.3_pre[.@k],0)+":";
  213. set .@k, select(.@list$+"^0055FFInput monster...:^777777Cancel^000000");
  214. if (.@k == getarraysize(.3_pre)+1) {
  215. input .@s;
  216. if (Etc(255,.@s)) set .3_mobID, .@s;
  217. } else if (.@k <= getarraysize(.3_pre))
  218. set .3_mobID, .3_pre[.@k-1];
  219. break;
  220. case 2: if (Etc()) input .3_mobNum,1; break;
  221. case 3: if (Etc()) input .3_points; break;
  222. case 4: Etc(3); break;
  223. }
  224. }
  225. break;
  226. case 4:
  227. while(1) {
  228. set .@j, select(
  229. "Wait time ["+.4_wait+" minute"+((.4_wait == 1)?"":"s")+"]:"+
  230. "Points for Winning ["+.4_points+"]:"+
  231. "Map ["+.4_map$+"]:"+
  232. ((!.Active)?"^0055FFStart Event^000000:":":")+
  233. ((.Active == 4)?"^FF0000End Event^000000:":":")+
  234. "^777777Back to event menu...^000000"
  235. );
  236. if (.@j == 6) break;
  237. else if (.@j > 3) Event(4,5-.@j,1);
  238. if (Etc(1,4)) switch(.@j) {
  239. case 1: input .4_wait,0,60; break;
  240. case 2: if (Etc()) input .4_points; break;
  241. case 3: Etc(4); break;
  242. }
  243. }
  244. break;
  245. case 5:
  246. while(1) {
  247. set .@j, select(
  248. "Number of Special Zombies ["+.5_mobNum+"]:"+
  249. "Points per kill ["+.5_points+"]:"+
  250. "MVP Spawn ["+((.5_mvp[0])?"on":"off")+"]:"+
  251. "Map ["+.5_map$+"]:"+
  252. ((!.Active)?"^0055FFStart Event^000000:":":")+
  253. ((.Active == 5)?"^FF0000End Event^000000:":":")+
  254. "^777777Back to event menu...^000000"
  255. );
  256. if (.@j == 7) break;
  257. else if (.@j > 4) Event(5,6-.@j,1);
  258. if (Etc(1,5)) switch(.@j) {
  259. case 1: if (Etc()) input .5_mobNum,1; break;
  260. case 2: if (Etc()) input .5_points; break;
  261. case 3: set .5_mvp[0], !.5_mvp[0]; break;
  262. case 4: Etc(5); break;
  263. }
  264. }
  265. break;
  266. case 6:
  267. while(1) {
  268. set .@j, select(
  269. "Wait time ["+.6_wait+" minute"+((.6_wait == 1)?"":"s")+"]:"+
  270. "Seconds per round ["+.6_time+"]:"+
  271. "Number of Rounds ["+.6_rounds+"]:"+
  272. "Points per answer ["+.6_points+"]:"+
  273. ((!.Active)?"^0055FFStart Event^000000:":":")+
  274. ((.Active == 6)?"^FF0000End Event^000000:":":")+
  275. "^777777Back to event menu...^000000"
  276. );
  277. if (.@j == 7) break;
  278. else if (.@j > 4) Event(6,6-.@j,1);
  279. if (Etc(1,6)) switch(.@j) {
  280. case 1: input .6_wait,0,60; break;
  281. case 2: input .6_time,1,60; break;
  282. case 3: input .6_rounds,1; break;
  283. case 4: if (Etc()) input .6_points,0; break;
  284. }
  285. }
  286. break;
  287. case 7:
  288. while(1) {
  289. set .@j, select(
  290. "Wait time ["+.7_wait+" minute"+((.7_wait == 1)?"":"s")+"]:"+
  291. "Minimum Players ["+.7_min+"]:"+
  292. "Points for Winning ["+.7_points+"]:"+
  293. "Map ["+.7_map$+"]:"+
  294. ((!.Active)?"^0055FFStart Event^000000:":":")+
  295. ((.Active == 7)?"^FF0000End Event^000000:":":")+
  296. "^777777Back to event menu...^000000"
  297. );
  298. if (.@j == 7) break;
  299. else if (.@j > 4) Event(7,6-.@j,1);
  300. if (Etc(1,7)) switch(.@j) {
  301. case 1:
  302. message strcharinfo(0),"Players must register during this time.";
  303. input .7_wait,1,60;
  304. break;
  305. case 2:
  306. message strcharinfo(0),"Event requires at least 2 players to start.";
  307. input .7_min,2;
  308. break;
  309. case 3: if (Etc()) input .7_points; break;
  310. case 4: Etc(7); break;
  311. }
  312. }
  313. break;
  314. case 8:
  315. while(1) {
  316. mes "[Automated Events]";
  317. if (getgmlevel() < .GMFull) {
  318. mes "You aren't authorized";
  319. mes "to change this!";
  320. next;
  321. break;
  322. }
  323. if (!$0_auto) mes "No events are automated.";
  324. else for(set .@i,1; .@i<getarraysize(.Events$); set .@i,.@i+1)
  325. if (getd("$"+.@i+"_auto")) mes .Events$[.@i]+": ^0055FFautomated^000000";
  326. next;
  327. set .@i, select("Edit times...:Turn off all automated events:^777777Back to event menu...^000000");
  328. if (.@i == 1) {
  329. set .@i, select(.Menu$+" > ^777777Cancel^000000");
  330. if (.@i < getarraysize(.Events$)) while(1) {
  331. set .@var$, "$"+.@i+"_auto";
  332. set .@menu$," ~ ^FF0000Finished...^000000:";
  333. for(set .@j,0; .@j<24; set .@j,.@j+1)
  334. set .@menu$, .@menu$+" ~ "+((getd(.@var$)&(1<<.@j))?"^0055FF":"^777777")+((.@j < 10)?"0":"")+.@j+".00^000000:";
  335. set .@j, select(.@menu$)-1;
  336. if (.@j) {
  337. set .@k,(1<<(.@j-1));
  338. if (getd(.@var$)&.@k) set $0_auto, $0_auto^.@k;
  339. else {
  340. if ($0_auto&.@k) {
  341. message strcharinfo(0),"Another event is already scheduled for hour "+(.@j-1)+".";
  342. set .@k,255;
  343. } else set $0_auto, $0_auto|.@k;
  344. }
  345. if (.@k != 255) setd .@var$, getd(.@var$)^.@k;
  346. }
  347. else break;
  348. }
  349. } else if (.@i == 2) {
  350. mes "[Automated Events]";
  351. mes "Do you really want to turn off";
  352. mes "all automated event settings?";
  353. mes "This action cannot be reversed.";
  354. next;
  355. if (select(" > ^0055FFYes^000000: > ^777777No^000000") == 1) {
  356. for(set .@i,1; .@i<getarraysize(.Events$); set.@i,.@i+1)
  357. setd "$"+.@i+"_auto",0;
  358. set $0_auto,0;
  359. }
  360. } else break;
  361. }
  362. break;
  363. case 9:
  364. mes "[Event Manager]";
  365. if (.Active) {
  366. mes "You can't change settings";
  367. mes "while an event is active.";
  368. } else {
  369. SetDefault(.@EventOption);
  370. mes "Defaults set.";
  371. }
  372. next;
  373. break;
  374. }
  375. }
  376. }
  377. close;
  378.  
  379. OnMinute00: // Automated events at the hour.
  380. if (.Active) end; // Stop if an event is already active.
  381. set .@i, (1<<gettime(3));
  382. if ($0_auto&.@i) for(set .@j,1; .@j<getarraysize(.Events$); set .@j,.@j+1)
  383. if (getd("$"+.@j+"_auto")&.@i) {
  384. SetDefault(1<<(.@j-1)); // Use default values for automated events.
  385. Event(.@j,1,0);
  386. set .Active[1], .@j;
  387. break;
  388. }
  389. end;
  390. OnMinute59: // Automated events can only last 59 minutes before they are forced to end.
  391. if (.Active[1]) Event(.Active[1],0,0);
  392. end;
  393.  
  394.  
  395. On0W: // Show "!" emotion while warping players to the event map.
  396. while(.Waiting == 1) {
  397. emotion e_gasp;
  398. sleep 2500;
  399. }
  400. end;
  401. On1N:
  402. set .1_mobNum[1], .1_mobNum[1]-1;
  403. mapannounce .1_map$,"~ "+.1_mobNumS[1]+" special monsters, "+.1_mobNum[1]+" normal monsters ~",16;
  404. end;
  405. On1S:
  406. set .1_mobNumS[1], .1_mobNumS[1]-1;
  407. Etc(127,.1_points);
  408. mapannounce .1_map$,strcharinfo(0)+" has killed a special "+getmonsterinfo(.1_mobID,0)+"!",16;
  409. if (.1_mobNumS[1]) mapannounce .1_map$,"~ "+.1_mobNumS[1]+" special monsters, "+.1_mobNum[1]+" normal monsters ~",16;
  410. else Event(1,0,0);
  411. end;
  412. On2K:
  413. Etc(127,.2_points);
  414. mapannounce .2_map$,strcharinfo(0)+" has slain the "+getmonsterinfo(.2_mobID,0)+"!",16;
  415. sleep 4000;
  416. if (.2_rounds[1] < .2_rounds[0]) {
  417. set .2_rounds[1], .2_rounds[1]+1;
  418. set .2_mobID, .2_mvp[rand(getarraysize(.2_mvp))];
  419. monster .2_map$,0,0,getmonsterinfo(.2_mobID,0),.2_mobID,1,strnpcinfo(0)+"::On2K";
  420. mapannounce .2_map$,"Round "+.2_rounds[1]+": "+getmonsterinfo(.2_mobID,0)+" has spawned!",16;
  421. }
  422. else Event(2,0,0);
  423. end;
  424. On3K:
  425. set .3_mobNum[1], .3_mobNum[1]-1;
  426. Etc(127,.3_points);
  427. set .@str$, ((.3_mobNum[1])?" "+.3_mobNum[1]+" "+getmonsterinfo(.3_mobID,0)+" remain.":"");
  428. mapannounce .3_map$,strcharinfo(0)+" got a kill!"+.@str$,16;
  429. if (!.3_mobNum[1]) Event(3,0,0);
  430. end;
  431. On4A:
  432. if (.4_wait) {
  433. announce "The Poring Catcher event will begin in "+.4_wait+" minute"+((.4_wait == 1)?"":"s")+"!",0;
  434. set .Waiting,1;
  435. donpcevent strnpcinfo(0)+"::On0W";
  436. sleep(60000*.4_wait);
  437. if (!.Waiting) end;
  438. set .Waiting,0;
  439. }
  440. setarray .@n$[0],"Proing","Pouring","Poiring","Poing","Poriing","Porong","Por1ng","P0ring","PoriNg";
  441. setarray .@id[0],1031,1062,1113,1242,1613;
  442. for(set .@i,0; .@i<9; set .@i,.@i+1)
  443. monster .4_map$,0,0,.@n$[.@i],1002,10,strnpcinfo(0)+"::On4F";
  444. for(set .@i,0; .@i<5; set .@i,.@i+1)
  445. monster .4_map$,0,0,"Poring",.@id[.@i],((.@i == 4)?1:2),strnpcinfo(0)+"::On4F";
  446. monster .4_map$,0,0,"Poring",1002,1,strnpcinfo(0)+"::On4R";
  447. announce "The Poring Catcher event has begun!",0;
  448. end;
  449. On4F:
  450. set .4_mobNum, .4_mobNum-1;
  451. dispbottom "I wasn't the correct Poring!";
  452. warp "SavePoint",0,0;
  453. end;
  454. On4R:
  455. Etc(127,.4_points);
  456. mapannounce .4_map$,strcharinfo(0)+" killed the real Poring!",16;
  457. Event(4,0,0);
  458. end;
  459. On5N:
  460. set .5_mobNum[2], .5_mobNum[2]-1;
  461. end;
  462. On5S:
  463. set .5_mobNum[1], .5_mobNum[1]-1;
  464. Etc(127,.5_points);
  465. set .@str$, ((.5_mobNum[1])?" "+.5_mobNum[1]+" remain.":"");
  466. mapannounce .5_map$,strcharinfo(0)+" has killed a special zombie!"+.@str$,16;
  467. if (!.5_mobNum[1]) Event(5,0,0);
  468. end;
  469. On6A:
  470. if (.6_wait) {
  471. announce "The Disguise event will begin in "+.6_wait+" minute"+((.6_wait == 1)?"":"s")+"!",0;
  472. set .Waiting,1;
  473. donpcevent strnpcinfo(0)+"::On0W";
  474. sleep(60000*.6_wait);
  475. if (!.Waiting) end;
  476. set .Waiting,0;
  477. }
  478. announce "The Disguise event has begun in "+strnpcinfo(4)+"!",0;
  479. set .6_rounds[1],1;
  480. On6B:
  481. npctalk "Round "+.6_rounds[1]+"...";
  482. set .Waiting,2;
  483. sleep rand(2000,2500);
  484. if (!.Waiting) end;
  485. set .@valid,0;
  486. while(!.@valid) {
  487. set .6_mobID, rand(1001,1995);
  488. if (!compare(.Blacklist$,""+.6_mobID)) set .@valid,1;
  489. if (.@valid && .6_mobID[1]) if (getmonsterinfo(.6_mobID[0],0) == getmonsterinfo(.6_mobID[1],0)) set .@valid,0;
  490. }
  491. setnpcdisplay(strnpcinfo(1),.6_mobID);
  492. defpattern 1,"([^:]+):.\\s*"+getmonsterinfo(.6_mobID,0)+".*", "On6C";
  493. activatepset 1;
  494. set .Waiting,2;
  495. sleep(1000*.6_time);
  496. if (!.Waiting) end;
  497. set .Waiting,0;
  498. npctalk "Time's up. The answer was '"+getmonsterinfo(.6_mobID,0)+"'.";
  499. donpcevent strnpcinfo(0)+"::On6D";
  500. end;
  501. On6C:
  502. Etc(127,.6_points);
  503. npctalk strcharinfo(0)+" is correct! The answer was '"+getmonsterinfo(.6_mobID,0)+"'.";
  504. set .Waiting,0;
  505. awake strnpcinfo(0);
  506. On6D:
  507. set .6_rounds[1], .6_rounds[1]+1;
  508. deletepset 1;
  509. setnpcdisplay(strnpcinfo(1),109);
  510. set .6_mobID[1], .6_mobID;
  511. sleep 5000;
  512. if (.6_rounds[1] > .6_rounds[0]) {
  513. npctalk "That was the last round. Thanks for playing!";
  514. set .Waiting,3;
  515. sleep 1000;
  516. Event(6,0,0);
  517. } else donpcevent strnpcinfo(0)+"::On6B";
  518. end;
  519. On7A:
  520. announce "The Last Man Standing event will begin in "+.7_wait+" minute"+((.7_wait == 1)?"":"s")+"!",0;
  521. set .Waiting,1;
  522. donpcevent strnpcinfo(0)+"::On0W";
  523. sleep(60000*.7_wait);
  524. if (!.Waiting) end;
  525. if (getmapusers(.7_map$) < .7_min) {
  526. mapannounce .7_map$,"The Last Man Standing event has been cancelled because not enough players registered.",0;
  527. sleep 1000;
  528. Event(7,0,0);
  529. end;
  530. }
  531. set .Waiting,2;
  532. setmapflag .7_map$, mf_loadevent;
  533. mapannounce .7_map$,"The event will start in 10 seconds...",16;
  534. sleep 5000;
  535. if (.Waiting != 2) end;
  536. for(set .@i,5; .@i>0; set .@i,.@i-1) {
  537. mapannounce .7_map$,.@i+"...",16;
  538. sleep 1000;
  539. if (.Waiting != 2) end;
  540. }
  541. set .Waiting,0;
  542. announce "The Last Man Standing event has begun!",0;
  543. pvpon .7_map$;
  544. donpcevent strnpcinfo(0)+"::On7B";
  545. end;
  546. On7B:
  547. while(.Active == 7 && !.Waiting) {
  548. set .@i, getmapusers(.7_map$);
  549. if (.@i == 1) {
  550. set .Waiting,3;
  551. mapwarp .7_map$,.7_map$,0,0;
  552. } else if (.@i == 0) Event(7,0,0);
  553. else sleep 3000;
  554. }
  555. end;
  556. OnPCLogoutEvent:
  557. set .@i,1;
  558. OnPCDieEvent:
  559. if (.Active == 7 && strcharinfo(3) == .7_map$ && !.Waiting) {
  560. mapannounce .7_map$,strcharinfo(0)+" is out!",16;
  561. if (!.@i) warp "SavePoint",0,0;
  562. awake strnpcinfo(0);
  563. }
  564. end;
  565. OnPCLoadMapEvent:
  566. if (.Active != 7 || strcharinfo(3) != .7_map$ || getsavepoint(0) == .7_map$) end;
  567. if (.Waiting < 3) { // Kicks out new players that warp to the LMS map.
  568. dispbottom "The Last Man Standing event is taking place on this map.";
  569. warp "SavePoint",0,0;
  570. } else { // Event trigger for the winner.
  571. Etc(127,.7_points);
  572. announce strcharinfo(0)+" has won the Last Man Standing event!",0;
  573. Event(7,0,0);
  574. }
  575. end;
  576.  
  577. function Etc {
  578. if (!getarg(0,0)) {
  579. if (getgmlevel() < .GMFull) {
  580. message strcharinfo(0),"You are not permitted to change this.";
  581. return 0;
  582. } else return 1;
  583. } else if (getarg(0) == 127) {
  584. if (getarg(1)) {
  585. .@amount = atoi( $reward$[2] );
  586. if( getitemname( atoi( $reward$[1] ) ) == "null" ){
  587. setd( $reward$[1] ),( getd( $reward$[1] ) + .@amount );
  588. }else{
  589. getitem atoi( $reward$[1] ),.@amount;
  590. }
  591. dispbottom "Gained "+$reward$[0]+" x "+$reward$[2]+" "+((getarg(1) > 1)?"s":"")+"!";
  592. }
  593. specialeffect2 568;
  594. return;
  595. } else if (getarg(0) == 255) {
  596. if (getarg(1) < 1001) {
  597. message strcharinfo(0),"Invalid mob ID '"+getarg(1)+"'.";
  598. return 0;
  599. } else if (getmonsterinfo(getarg(1),0) == "" || getmonsterinfo(getarg(1),0) == "null") {
  600. message strcharinfo(0),"Invalid mob ID '"+getarg(1)+"'.";
  601. return 0;
  602. } else return 1;
  603. } else if (getarg(1,0)) {
  604. if (getarg(1) == .Active) {
  605. message strcharinfo(0),"You can't change settings while the event is active.";
  606. return 0;
  607. } else return 1;
  608. } else {
  609. input .@s$,2,12;
  610. if (getmapusers(.@s$) == -1 && .@s$ != "random") message strcharinfo(0),"Invalid map '"+.@s$+"'.";
  611. else setd "."+getarg(0)+"_map$", .@s$;
  612. return;
  613. }
  614. }
  615.  
  616. function Event {
  617. if (getd("."+getarg(0)+"_map$") == "random") { // Allowed 'random' town maps.
  618. setarray .@towns$[0],"prontera","geffen","payon","alberta","izlude","comodo","gonryun","hugel","rachel";
  619. setd "."+getarg(0)+"_map$", .@towns$[rand(getarraysize(.@towns$))];
  620. }
  621. switch(getarg(0)) {
  622. case 1:
  623. if (getarg(1)) {
  624. monster .1_map$,0,0,getmonsterinfo(.1_mobID,0),.1_mobID,.1_mobNum,strnpcinfo(0)+"::On1N";
  625. monster .1_map$,0,0,getmonsterinfo(.1_mobID,0),.1_mobID,.1_mobNumS,strnpcinfo(0)+"::On1S";
  626. set .1_mobNum[1], .1_mobNum[0];
  627. set .1_mobNumS[1], .1_mobNumS[0];
  628. announce "The Monster Summon event has begun in "+.1_map$+"!",0;
  629. announce "~ "+.1_mobNumS[1]+" special monsters, "+.1_mobNum[1]+" normal monsters ~",0;
  630. } else {
  631. killmonster .1_map$,"All";
  632. maprespawnguildid .1_map$,0,3;
  633. set .1_mobNum[1],0;
  634. set .1_mobNumS[1],0;
  635. }
  636. break;
  637. case 2:
  638. if (getarg(1)) {
  639. set .2_mobID, .2_mvp[rand(getarraysize(.2_mvp))];
  640. monster .2_map$,0,0,getmonsterinfo(.2_mobID,0),.2_mobID,1,strnpcinfo(0)+"::On2K";
  641. set .2_rounds[1],1;
  642. announce "The MVP Summon event has begun in "+.2_map$+"!",0;
  643. mapannounce .2_map$,"Round "+.2_rounds[1]+": "+getmonsterinfo(.2_mobID,0)+" has spawned!",16;
  644. } else {
  645. killmonster .2_map$,"All";
  646. maprespawnguildid .2_map$,0,3;
  647. set .2_rounds[1],0;
  648. set .2_mobID,0;
  649. }
  650. break;
  651. case 3:
  652. if (getarg(1)) {
  653. monster .3_map$,0,0,getmonsterinfo(.3_mobID,0),.3_mobID,.3_mobNum,strnpcinfo(0)+"::On3K";
  654. set .3_mobNum[1], .3_mobNum[0];
  655. announce "The Monster Hunt event has begun in "+.3_map$+"!",0;
  656. announce .3_mobNum[1]+" "+getmonsterinfo(.3_mobID,0)+" have spawned!",0;
  657. } else {
  658. killmonster .3_map$,"All";
  659. maprespawnguildid .3_map$,0,3;
  660. set .3_mobNum[1],0;
  661. }
  662. break;
  663. case 4:
  664. if (getarg(1)) {
  665. setmapflag .4_map$, mf_noskill; // Skills are not allowed in Poring Catcher.
  666. setmapflag .4_map$, mf_nosave;
  667. set .4_mobNum,99;
  668. donpcevent strnpcinfo(0)+"::On4A";
  669. } else {
  670. if (.Waiting) {
  671. set .Waiting,0;
  672. awake strnpcinfo(0);
  673. } else killmonster .4_map$,"All";
  674. maprespawnguildid .4_map$,0,3;
  675. removemapflag .4_map$, mf_noskill;
  676. removemapflag .4_map$, mf_nosave;
  677. set .4_mobNum,0;
  678. }
  679. break;
  680. case 5:
  681. if (getarg(1)) {
  682. setarray .@id[0],1015,1036,1298,1197,1864,1865,1403,1169,1870;
  683. setarray .@num[0],400, 325, 100, 175, 75, 75, 150, 175, 25;
  684. for(set .@k,0; .@k<9; set .@k,.@k+1)
  685. monster .5_map$,0,0,getmonsterinfo(.@id[.@k],0),.@id[.@k],.@num[.@k],strnpcinfo(0)+"::On5N";
  686. monster .5_map$,0,0,"Zombie",1015,.5_mobNum,strnpcinfo(0)+"::On5S";
  687. if (.5_mvp[0]) for(set .@k,1; .@k<getarraysize(.5_mvp); set .@k,.@k+1)
  688. monster .5_map$,0,0,getmonsterinfo(.5_mvp[.@k],0),.5_mvp[.@k],1,strnpcinfo(0)+"::On5S";
  689. setarray .5_mobNum[1], .5_mobNum[0]+((.5_mvp[0])?getarraysize(.5_mvp)-1:0), 1500;
  690. announce "The Zombie Invasion event has begun in "+.5_map$+"!",0;
  691. } else {
  692. killmonster .5_map$,"All";
  693. maprespawnguildid .5_map$,0,3;
  694. setarray .5_mobNum[1],0,0;
  695. }
  696. break;
  697. case 6:
  698. if (getarg(1)) {
  699. set .6_rounds[1],0;
  700. donpcevent strnpcinfo(0)+"::On6A";
  701. } else {
  702. if (.Waiting < 3) npctalk "A GM has cancelled the event.";
  703. if (.Waiting != 1) {
  704. setnpcdisplay(strnpcinfo(1),109);
  705. deletepset 1;
  706. }
  707. set .Waiting,0;
  708. awake strnpcinfo(0);
  709. setarray .6_mobID[0],0,0;
  710. set .6_rounds[1],0;
  711. }
  712. break;
  713. case 7:
  714. if (getarg(1)) {
  715. maprespawnguildid .7_map$,0,3;
  716. for(set .@i,0; .@i<7; set .@i,.@i+1)
  717. setmapflag .7_map$, .mf[.@i];
  718. setmapflag .7_map$,mf_restricted,1;
  719. pvpoff .7_map$;
  720. gvgoff .7_map$;
  721. donpcevent strnpcinfo(0)+"::On7A";
  722. } else {
  723. if (.Waiting != 1) {
  724. removemapflag .7_map$, mf_loadevent;
  725. set .Waiting,1;
  726. } else set .Waiting,0;
  727. awake strnpcinfo(0);
  728. set .Waiting,0;
  729. maprespawnguildid .7_map$,0,3;
  730. for(set .@i,0; .@i<7; set .@i,.@i+1)
  731. removemapflag .7_map$, .mf[.@i];
  732. removemapflag .7_map$,mf_restricted,1;
  733. pvpoff .7_map$;
  734. gvgoff .7_map$;
  735. }
  736. break;
  737. }
  738. if (!getarg(1)) {
  739. announce "The "+.Events$[getarg(0)]+" event is now over!",0;
  740. set .Active[1],0;
  741. }
  742. set .Active, ((getarg(1))?getarg(0):0);
  743. if (getarg(2,0)) {
  744. mes "["+.Events$[getarg(0)]+"]";
  745. if (getarg(1)) mes "Event initiated.";
  746. else mes "Event terminated.";
  747. close;
  748. }
  749. return;
  750. }
  751.  
  752. function ShowStatus {
  753. if (!.Active || getarg(0) != .Active) return 0;
  754. if (getarg(1,0)) mes "Event: ^0055FF"+.Events$[getarg(0)]+"^000000";
  755. else mes "Status: ^0055FFActive^000000";
  756. set .@map$, getd("."+getarg(0)+"_map$");
  757. if (.@map$ != "") mes "Location: ^777777"+.@map$+"^000000";
  758. switch(getarg(0)) {
  759. case 1:
  760. mes "Special "+strmobinfo(1,.1_mobID)+" left: ^777777"+.1_mobNumS[1]+"^000000";
  761. mes "Normal "+strmobinfo(1,.1_mobID)+" left: ^777777"+.1_mobNum[1]+"^000000";
  762. mes "Points per kill: ^777777"+.1_points+"^000000";
  763. break;
  764. case 2:
  765. mes "Current MVP: ^777777"+getmonsterinfo(.2_mobID,0)+"^000000";
  766. mes "Rounds left: ^777777"+(.2_rounds[0]-.2_rounds[1])+"^000000";
  767. mes "Points per kill: ^777777"+.2_points+"^000000";
  768. break;
  769. case 3:
  770. mes strmobinfo(1,.3_mobID)+" left: ^777777"+.3_mobNum[1]+"^000000";
  771. mes "Points per kill: ^777777"+.3_points+"^000000";
  772. break;
  773. case 4:
  774. mes "Status: ^777777"+((.Waiting)?"Waiting...":"Started")+"^000000";
  775. if (!.Waiting) mes "Fake Porings left: ^777777"+.4_mobNum+"^000000";
  776. mes "Points for winning: ^777777"+.4_points+"^000000";
  777. break;
  778. case 5:
  779. mes "Special Zombies left: ^777777"+.5_mobNum[1]+"^000000";
  780. mes "Normal Zombies left: ^777777"+.5_mobNum[2]+"^000000";
  781. mes "Points per kill: ^777777"+.5_points+"^000000";
  782. break;
  783. case 6:
  784. mes "Status: ^777777"+((.Waiting == 1)?"Waiting...":"Started")+"^000000";
  785. mes "Rounds left: ^777777"+(.6_rounds[0]-.6_rounds[1])+"^000000";
  786. mes "Points per answer: ^777777"+.6_points+"^000000";
  787. break;
  788. case 7:
  789. mes "Status: ^777777"+((.Waiting)?"Waiting...":"Started")+"^000000";
  790. mes "Points for winning: ^777777"+.7_points+"^000000";
  791. if (.Waiting != 1) mes "Players remaining: ^777777"+getmapusers(.7_map$)+"^000000";
  792. break;
  793. }
  794. return 1;
  795. }
  796.  
  797. function SetDefault {
  798. if (getarg(0)&1) { // < Monster Summon >
  799. set .1_mobID,1002; // ID of monster.
  800. set .1_mobNum,100; // Number of 'normal' monsters.
  801. set .1_mobNumS,100; // Number of 'special' monsters.
  802. set .1_points,3; // Points per 'special' monster kill.
  803. set .1_map$,"random"; // Event map (random = random town).
  804. }
  805. if (getarg(0)&2) { // < MVP Summon >
  806. setarray .2_mvp[0], // List of summonable MVPs.
  807. 1038,1039,1046,1059,1086,1087,1112,1115,1147,1150,1157,
  808. 1159,1190,1251,1252,1272,1312,1373,1389,1418,1492,1511,
  809. 1583,1623,1630,1646,1647,1648,1649,1650,1651,1658,1688,
  810. 1708,1719,1734,1751,1768,1779,1785,1832,1871,1874,1885;
  811. set .2_rounds,10; // Number of rounds.
  812. set .2_points,10; // Points per MVP kill.
  813. set .2_map$,"random"; // Event map (random = random town).
  814. }
  815. if (getarg(0)&4) { // < Monster Hunt >
  816. set .3_mobID,1084; // ID of monster.
  817. setarray .3_pre[0], // List of preset monster options.
  818. 1084,1330,1083;
  819. set .3_mobNum,rand(2,5);// Number of monsters.
  820. set .3_points,5; // Points per kill.
  821. set .3_map$,"random"; // Event map (random = random town).
  822. }
  823. if (getarg(0)&8) { // < Poring Catcher >
  824. set .4_wait,2; // Minutes before event starts, after an announcement.
  825. set .4_points,10; // Points for winning.
  826. set .4_map$,"jupe_ele"; // Event map (should be small).
  827. }
  828. if (getarg(0)&16) { // < Zombie Invasion >
  829. set .5_mobNum,30; // Number of 'special' zombies.
  830. set .5_points,2; // Points per 'special' zombie kill.
  831. setarray .5_mvp[0],0, // Spawn MVPs by default? (0 or 1)
  832. 1038,1112,1272,1389, // List of MVPs to summon.
  833. 1492,1734,1768,1708;
  834. set .5_map$,"rachel"; // Event map (should be large).
  835. }
  836. if (getarg(0)&32) { // < Disguise Event >
  837. set .6_wait,2; // Minutes before event starts, after an announcement.
  838. set .6_time,20; // Seconds to guess the monster.
  839. set .6_rounds,10; // Number of rounds.
  840. set .6_points,3; // Points per correct response.
  841. }
  842. if (getarg(0)&64) { // < Last Man Standing >
  843. set .7_wait,2; // Minutes before event starts, after an announcement.
  844. set .7_min,4; // Minimum players to start event.
  845. set .7_points,5; // Points for winning.
  846. set .7_map$,"guild_vs3";// Event map.
  847. }
  848. return;
  849. }
  850.  
  851. OnInit:
  852. // -------------------- [[ CONFIG START ]] --------------------
  853.  
  854. setarray .Events$[1], // Do NOT comment or delete these!
  855. "Monster Summon", // [1]
  856. "MVP Summon", // [2]
  857. "Monster Hunt", // [4]
  858. "Poring Catcher", // [8]
  859. "Zombie Invasion", // [16]
  860. "Disguise", // [32]
  861. "Last Man Standing"; // [64]
  862. set .@EventOption, 1|2|4|8|16|32|64; // List of available events.
  863. set .GMBasic,80; // GM level for limited access.
  864. set .GMFull, 99; // GM level with full access.
  865.  
  866. // --------------------- [[ CONFIG END ]] ---------------------
  867.  
  868. SetDefault(.@EventOption);
  869. set .Menu$,"";
  870. for(set .@i,1; .@i<getarraysize(.Events$); set .@i,.@i+1) {
  871. if (.@EventOption&(1<<(.@i-1)))
  872. set .Menu$, .Menu$+" > "+.Events$[.@i];
  873. set .Menu$, .Menu$+":";
  874. }
  875. set .Blacklist$,
  876. "1003,1006,1017,1021,1022,1027,1043,1075,1136,1137,1168,1171,1172,1173,1181,1187,1210,"+
  877. "1217,1218,1222,1223,1224,1225,1226,1227,1228,1233,1284,1407,1411,1414,1496,1501,1900";
  878. setarray .mf[0],0,1,2,3,7,13,34;
  879.  
  880. end;
  881. }
Advertisement
Add Comment
Please, Sign In to add comment