bg_kvm02.txt 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. // ==============================================================================
  2. // BattleGround System - KvM 60~79
  3. // ==============================================================================
  4. // Registration NPC's
  5. // *********************************************************************
  6. bat_room,225,227,4 script Registration::KvM02R_Guillaume 418,{ // KvM Guillaume
  7. end;
  8. OnInit:
  9. waitingroom "Battle Station 5 Players",5,"KvM02_BG::OnGuillaumeJoin",1;
  10. end;
  11. OnEnterBG:
  12. set $@KvM02BG_id1, waitingroom2bg("bat_c02",53,128,"KvM02_BG::OnGuillaumeQuit","KvM02_BG::OnGuillaumeDie");
  13. end;
  14. }
  15. bat_room,225,204,0 script Registration::KvM02R_Croix 414,{ // KvM Croix
  16. end;
  17. OnInit:
  18. waitingroom "Battle Station 5 Players",5,"KvM02_BG::OnCroixJoin",1;
  19. end;
  20. OnEnterBG:
  21. set $@KvM02BG_id2, waitingroom2bg("bat_c02",146,55,"KvM02_BG::OnCroixQuit","KvM02_BG::OnCroixDie");
  22. end;
  23. }
  24. // Light Effects
  25. // *********************************************************************
  26. bat_c02,54,123,0 script #bat_c02a 111,{
  27. end;
  28. OnKvM02LightA: misceffect 54; end;
  29. OnKvM02LightB: misceffect 55; end;
  30. OnKvM02LightC: misceffect 56; end;
  31. }
  32. bat_c02,56,125,0 duplicate(#bat_c02a) #bat_c02b 111
  33. bat_c02,58,127,0 duplicate(#bat_c02a) #bat_c02c 111
  34. bat_c02,141,56,0 duplicate(#bat_c02a) #bat_c02d 111
  35. bat_c02,143,58,0 duplicate(#bat_c02a) #bat_c02e 111
  36. bat_c02,145,60,0 duplicate(#bat_c02a) #bat_c02f 111
  37. // Battleground Engine
  38. // *********************************************************************
  39. - script KvM02_BG -1,{
  40. end;
  41. OnInit:
  42. setwall "bat_c02",54,122,6,7,0,"batc02wall_a";
  43. setwall "bat_c02",55,122,5,7,0,"batc02wall_b";
  44. setwall "bat_c02",140,56,6,7,0,"batc02wall_c";
  45. setwall "bat_c02",140,57,5,7,0,"batc02wall_d";
  46. disablenpc "TherapistKvM02a";
  47. disablenpc "TherapistKvM02b";
  48. disablenpc "VintenarKvM02a";
  49. disablenpc "VintenarKvM02b";
  50. end;
  51. OnGuillaumeJoin:
  52. OnCroixJoin:
  53. donpcevent "KvM02_BG::OnReadyCheck";
  54. end;
  55. OnGuillaumeQuit:
  56. set BG_Delay_Tick, gettimetick(2) + 1200;
  57. OnGuillaumeDie:
  58. if( $@KvM02BG == 2 )
  59. {
  60. set .Guillaume_Count, .Guillaume_Count - 1;
  61. set .Croix_Score, .Croix_Score + 1;
  62. bg_updatescore "bat_c02",.Guillaume_Score,.Croix_Score;
  63. if( .Guillaume_Count < 1 ) donpcevent "KvM02_BG::OnCroixWin";
  64. }
  65. end;
  66. OnCroixQuit:
  67. set BG_Delay_Tick, gettimetick(2) + 1200;
  68. OnCroixDie:
  69. if( $@KvM02BG == 2 )
  70. {
  71. set .Croix_Count, .Croix_Count - 1;
  72. set .Guillaume_Score, .Guillaume_Score + 1;
  73. bg_updatescore "bat_c02",.Guillaume_Score,.Croix_Score;
  74. if( .Croix_Count < 1 ) donpcevent "KvM02_BG::OnGuillaumeWin";
  75. }
  76. end;
  77. OnReadyCheck:
  78. if( $@KvM02BG )
  79. end;
  80. set .@Guillaume, getwaitingroomstate(0,"KvM02R_Guillaume");
  81. set .@Croix, getwaitingroomstate(0,"KvM02R_Croix");
  82. if( .@Guillaume < 5 || .@Croix < 5 )
  83. {
  84. if( .@Guillaume > 3 && .@Croix > 3 && !agitcheck() && $@KvM_Flood < gettimetick(2) )
  85. {
  86. announce "Battleground -- Kreiger Von Midgard [60-79] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",0,0x808080;
  87. set $@KvM_Flood, gettimetick(2) + 15;
  88. }
  89. else
  90. mapannounce "bat_room","Battleground -- Kreiger Von Midgard [60-79] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",1,0x808080;
  91. end;
  92. }
  93. set $@KvM02BG, 1; // Starting
  94. donpcevent "KvM02R_Croix::OnEnterBG";
  95. donpcevent "KvM02R_Guillaume::OnEnterBG";
  96. donpcevent "KvM02_BG::OnStart";
  97. end;
  98. OnStart:
  99. announce "Battleground -- Kreiger Von Midgard [60-79] has started!",0,0x808080;
  100. enablenpc "TherapistKvM02a";
  101. enablenpc "TherapistKvM02b";
  102. disablenpc "VintenarKvM02a";
  103. disablenpc "VintenarKvM02b";
  104. set $@KvM02BG_Victory, 0;
  105. sleep 2000;
  106. // Warp Teams
  107. bg_warp $@KvM02BG_id1,"bat_c02",53,128;
  108. bg_warp $@KvM02BG_id2,"bat_c02",146,55;
  109. // ScoreBoard
  110. set .Guillaume_Score, 0;
  111. set .Croix_Score, 0;
  112. initnpctimer;
  113. end;
  114. OnTimer5000:
  115. areapercentheal "bat_c02",50,123,58,131,100,100;
  116. areapercentheal "bat_c02",141,52,149,60,100,100;
  117. mapannounce "bat_c02","The Battle will start in 25 seconds!!",1,0x808080;
  118. end;
  119. OnTimer26000:
  120. mapannounce "bat_c02","The Battle will start in 4 seconds!!",1,0x808080;
  121. end;
  122. OnTimer27000:
  123. donpcevent "::OnKvM02LightA";
  124. end;
  125. OnTimer28000:
  126. donpcevent "::OnKvM02LightB";
  127. end;
  128. OnTimer29000:
  129. donpcevent "::OnKvM02LightC";
  130. end;
  131. OnTimer30000:
  132. // Team Members
  133. set .Guillaume_Count, bg_get_data($@KvM02BG_id1, 0);
  134. set .Croix_Count, bg_get_data($@KvM02BG_id2, 0);
  135. if( .Guillaume_Count < 5 || .Croix_Count < 5 )
  136. {
  137. set $@KvM02BG_Victory, 3;
  138. set $@KvM02BG, 3;
  139. mapannounce "bat_c02","There are not enough players to start the battle",1,0x808080;
  140. stopnpctimer;
  141. sleep 2000;
  142. donpcevent "KvM02_BG::OnStop";
  143. end;
  144. }
  145. set $@KvM02BG, 2; // Playing
  146. areapercentheal "bat_c02",50,123,58,131,100,100;
  147. bg_warp $@KvM02BG_id1,"bat_c02",62,119;
  148. areapercentheal "bat_c02",141,52,149,60,100,100;
  149. bg_warp $@KvM02BG_id2,"bat_c02",137,64;
  150. end;
  151. OnTimer32000:
  152. mapannounce "bat_c02","The Battle of Kreiger Von Midgard has begun!!",1,0x808080;
  153. end;
  154. OnTimer300000:
  155. mapannounce "bat_c02","The Battle will ends in 30 seconds!!",1,0x808080;
  156. end;
  157. OnTimer330000:
  158. if( .Croix_Count > .Guillaume_Count )
  159. donpcevent "KvM02_BG::OnCroixWin";
  160. else if( .Croix_Count < .Guillaume_Count )
  161. donpcevent "KvM02_BG::OnGuillaumeWin";
  162. else
  163. { // Draw Game
  164. set $@KvM02BG, 3;
  165. set $@KvM02BG_Victory, 3;
  166. stopnpctimer;
  167. sleep 2000;
  168. mapannounce "bat_c02","The time is out! This is a Tie...",1,0x808080;
  169. donpcevent "KvM02_BG::OnStop";
  170. }
  171. end;
  172. OnGuillaumeWin:
  173. set $@KvM02BG, 3;
  174. set $@KvM02BG_Victory, 1;
  175. stopnpctimer;
  176. sleep 2000;
  177. mapannounce "bat_c02","The Guillaume Army has won the Battle of Kreiger Von Midgard",1,0x0000FF;
  178. donpcevent "KvM02_BG::OnStop";
  179. end;
  180. OnCroixWin:
  181. set $@KvM02BG, 3;
  182. set $@KvM02BG_Victory, 2;
  183. stopnpctimer;
  184. sleep 2000;
  185. mapannounce "bat_c02","The Croix Army has won the Battle of Kreiger Von Midgard",1,0xFF0000;
  186. donpcevent "KvM02_BG::OnStop";
  187. end;
  188. OnStop:
  189. disablenpc "TherapistKvM02a";
  190. disablenpc "TherapistKvM02b";
  191. enablenpc "VintenarKvM02a";
  192. enablenpc "VintenarKvM02b";
  193. // Warp Teams
  194. bg_warp $@KvM02BG_id1,"bat_c02",53,128;
  195. bg_warp $@KvM02BG_id2,"bat_c02",146,55;
  196. donpcevent "KvM02_BG_Out::OnBegin";
  197. end;
  198. OnReset:
  199. stopnpctimer;
  200. stopnpctimer "KvM02_BG_Out";
  201. set .Croix_Count, 0;
  202. set .Guillaume_Count, 0;
  203. set .Croix_Score, 0;
  204. set .Guillaume_Score, 0;
  205. set $@KvM02BG_Victory, 0;
  206. if( $@KvM02BG_id1 ) { bg_destroy $@KvM02BG_id1; set $@KvM02BG_id1, 0; }
  207. if( $@KvM02BG_id2 ) { bg_destroy $@KvM02BG_id2; set $@KvM02BG_id2, 0; }
  208. disablenpc "TherapistKvM02a";
  209. disablenpc "TherapistKvM02b";
  210. disablenpc "VintenarKvM02a";
  211. disablenpc "VintenarKvM02b";
  212. sleep 1000;
  213. mapwarp "bat_c02","bat_room",155,150;
  214. sleep 2000;
  215. maprespawnguildid "bat_c02",0,3; // Just in case someone else
  216. bg_updatescore "bat_c02",0,0;
  217. sleep 2000;
  218. set $@KvM02BG, 0;
  219. donpcevent "KvM02_BG::OnReadyCheck"; // Maybe a game is ready to start
  220. end;
  221. }
  222. - script KvM02_BG_Out -1,{
  223. end;
  224. OnBegin:
  225. initnpctimer;
  226. end;
  227. OnTimer3000:
  228. mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 1 minute!",1,0x808080;
  229. end;
  230. OnTimer30000:
  231. mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 30 seconds!",1,0x808080;
  232. end;
  233. OnTimer50000:
  234. mapannounce "bat_c02","Battle of Kreiger Von Midgard will close in 10 seconds!",1,0x808080;
  235. end;
  236. OnTimer60000:
  237. donpcevent "KvM02_BG::OnReset";
  238. end;
  239. }
  240. // Battleground Therapist
  241. // *********************************************************************
  242. bat_c02,51,130,5 script Therapist in battle::TherapistKvM02a 95,{
  243. mes "[Therapist in battle]";
  244. mes "Just close your eyes, and take a deep breathe.";
  245. mes "You can be free from pain.";
  246. specialeffect2 312;
  247. close;
  248. }
  249. bat_c02,148,53,1 script Therapist in battle::TherapistKvM02b 95,{
  250. mes "[Therapist in battle]";
  251. mes "Just close your eyes, and take a deep breathe.";
  252. mes "You can be free from pain.";
  253. specialeffect2 312;
  254. close;
  255. }
  256. // Battleground rewards
  257. // *********************************************************************
  258. bat_c02,51,130,5 script Guillaume Vintenar::VintenarKvM02a 419,{
  259. if( $@KvM02BG_Victory )
  260. {
  261. if( $@KvM02BG_Victory == 3 )
  262. {
  263. setquest 6025;
  264. bg_leave;
  265. warp "bat_room",155,150;
  266. end;
  267. }
  268. else if( $@KvM02BG_Victory == Bat_Team )
  269. { // Victory
  270. set .@Reward, 3;
  271. mes "[Swandery]";
  272. mes "Blessed Guillaume!!";
  273. mes "Let's enjoy our glorious victory!";
  274. mes "" + strcharinfo(0) + ", its a sign reflecting victory";
  275. close2;
  276. }
  277. else
  278. { //
  279. set .@Reward, 1;
  280. mes "[Swandery]";
  281. mes "You lost, but you're dedicated to this battle.";
  282. mes "This is a reward for your great dedication by Guillaume Marollo!";
  283. mes "Just take this defeat a lesson, and later you would definitely learn.";
  284. close2;
  285. }
  286. setquest 6025;
  287. getitem 7773, .@Reward;
  288. bg_leave;
  289. warp "bat_room",155,150;
  290. end;
  291. }
  292. end;
  293. }
  294. bat_c02,148,53,1 script Croix Vintenar::VintenarKvM02b 415,{
  295. if( $@KvM02BG_Victory )
  296. {
  297. if( $@KvM02BG_Victory == 3 )
  298. {
  299. setquest 6025;
  300. bg_leave;
  301. warp "bat_room",155,150;
  302. end;
  303. }
  304. else if( $@KvM02BG_Victory == Bat_Team )
  305. { // Victory
  306. set .@Reward, 3;
  307. mes "[Swandery]";
  308. mes "Blessed Croax!!";
  309. mes "Let's enjoy our glorious victory!";
  310. mes "" + strcharinfo(0) + ", its a sign reflecting victory";
  311. close2;
  312. }
  313. else
  314. { //
  315. set .@Reward, 1;
  316. mes "[Swandery]";
  317. mes "Oh, " + strcharinfo(0) + ". Don't be sad.";
  318. mes "Even though we didn't win, we did our best.";
  319. mes "This is a Royal gift from Croix, and please don't forget this battle. We can win the next.";
  320. close2;
  321. }
  322. setquest 6025;
  323. getitem 7773, .@Reward;
  324. bg_leave;
  325. warp "bat_room",155,150;
  326. end;
  327. }
  328. end;
  329. }
  330. // MapFlags
  331. // *********************************************************************
  332. bat_c02 mapflag battleground 2
  333. bat_c02 mapflag nomemo
  334. bat_c02 mapflag nosave SavePoint
  335. bat_c02 mapflag noteleport
  336. bat_c02 mapflag nowarp
  337. bat_c02 mapflag nowarpto
  338. bat_c02 mapflag noreturn
  339. bat_c02 mapflag nobranch
  340. bat_c02 mapflag nopenalty