yuhsing

Untitled

Sep 11th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1.  
  2.  
  3. /*
  4. If player failed to join the PVP...ask them click any of the 3 NPC at town , then re-enter.
  5. Party wont affect the PVP since it's actually a Battleground.
  6.  
  7. Both Red and Blue Team required X member before can warp inside,
  8. but player can join anytime when both team created and have available slot.
  9. Solo team can join anytime.
  10. */
  11.  
  12.  
  13. - script bg_pk -1,{
  14. OnInit:
  15. // both red and blue team required how many player
  16. $@team_count = 5;
  17. // map that will be used.
  18. .map$ = "bat_c01";
  19. // cloth color for red team
  20. .bg_cloth_red = 2;
  21. // cloth color for blue team
  22. .bg_cloth_blue = 10;
  23.  
  24. $@bg_npc_name$ = strnpcinfo(0);
  25. setmapflag .map$,mf_loadevent;
  26. setmapflag .map$,mf_battleground;
  27. setmapflag .map$,mf_partylock;
  28. mapwarp .map$,"prontera",155,175;
  29. donpcevent "::OnBGEnable";
  30. end;
  31.  
  32. OnRedJoin:
  33. .@bg_user_count = bg_get_data( .bg_red,0 );
  34. if( .@bg_user_count == $@team_count ){
  35. kickwaitingroomall "bg_red";
  36. end;
  37. }else if( .@bg_user_count && .@bg_user_count < $@team_count ){
  38. .@count = 1;
  39. }else{
  40. .@count = $@team_count;
  41. }
  42. if( getwaitingroomstate( 0,"bg_red" ) == .@count ){
  43. if( .@count == 1 && .bg_red ){
  44. waitingroom2bg_single( .bg_red,.map$,0,0,"bg_red" );
  45. mapannounce .map$,"A Player joined RED Team. Red Team has "+bg_get_data( .bg_red,0 )+" users now.",0;
  46. }else{
  47. .bg_red = waitingroom2bg( .map$,0,0,$@bg_npc_name$+"::OnQuit",$@bg_npc_name$+"::OnDead","bg_red" );
  48. mapannounce .map$,"Red Team joined...",0;
  49. bg_warp .bg_red,.map$,0,0;
  50. }
  51. }
  52. end;
  53.  
  54. OnBlueJoin:
  55. .@bg_user_count = bg_get_data( .bg_blue,0 );
  56. if( .@bg_user_count == $@team_count ){
  57. kickwaitingroomall "bg_blue";
  58. end;
  59. }else if( .@bg_user_count && .@bg_user_count < $@team_count ){
  60. .@count = 1;
  61. }else{
  62. .@count = $@team_count;
  63. }
  64. if( getwaitingroomstate( 0,"bg_blue" ) == .@count ){
  65. if( .@count == 1 && .bg_blue ){
  66. waitingroom2bg_single( .bg_blue,.map$,0,0,"bg_red" );
  67. mapannounce .map$,"A Player joined BLUE Team. BLUE Team has "+bg_get_data( .bg_blue,0 )+" users now.",0;
  68. }else{
  69. .bg_blue = waitingroom2bg( .map$,0,0,$@bg_npc_name$+"::OnQuit",$@bg_npc_name$+"::OnDead","bg_blue" );
  70. mapannounce .map$,"Blue Team joined...",0;
  71. bg_warp .bg_blue,.map$,0,0;
  72. }
  73. }
  74. end;
  75.  
  76. OnSoloJoin:
  77. .@bg_solo = waitingroom2bg( .map$,0,0,$@bg_npc_name$+"::OnQuit",$@bg_npc_name$+"::OnDead","bg_solo" );
  78. mapannounce .map$,"A Solo Player joined.",0;
  79. bg_warp .@bg_solo,.map$,0,0;
  80. end;
  81.  
  82. OnDead:
  83. .@bg_id = getcharid(4);
  84. if( .@bg_id == .bg_red || .@bg_id == .bg_blue )
  85. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  86. warp "SavePoint",0,0;
  87. OnQuit:
  88. .@bg_id = getcharid(4);
  89. bg_leave;
  90. if( .@bg_id == .bg_red ){
  91. announce "BG Red Team have an empty slot since a player just left the team.",0;
  92. }else if( .@bg_id == .bg_blue ){
  93. announce "BG Blue Team have an empty slot since a player just left the team.",0;
  94. }
  95. if( bg_get_data( .@bg_id,0 ) == 0 ){
  96. if( .@bg_id == .bg_red ) .bg_red = 0;
  97. else if( .@bg_id == .bg_blue ) .bg_blue = 0;
  98. bg_destroy .@bg_id;
  99. }
  100. end;
  101.  
  102. OnPCLoadMapEvent:
  103. if( strcharinfo(3) == .map$ ){
  104. .@bg_id = getcharid(4);
  105. if( !.@bg_id ){
  106. warp "SavePoint",0,0;
  107. }else if( .@bg_id == .bg_red ){
  108. changelook LOOK_CLOTHES_COLOR,.bg_cloth_red;
  109. }else if( .@bg_id == .bg_blue ){
  110. changelook LOOK_CLOTHES_COLOR,.bg_cloth_blue;
  111. }else{
  112. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  113. }
  114. }
  115. end;
  116. }
  117.  
  118.  
  119.  
  120. prontera,151,182,5 script Red Team::bg_red 100,{
  121. if( getcharid(4) ){
  122. bg_leave;
  123. message strcharinfo(0),"You leaved the Group.";
  124. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  125. }
  126. end;
  127. OnBGEnable:
  128. delwaitingroom;
  129. waitingroom "Red TEAM",( $@team_count + 1 ),$@bg_npc_name$+"::OnRedJoin",1;
  130. end;
  131. }
  132. prontera,160,182,5 script Blue Team::bg_blue 100,{
  133. if( getcharid(4) ){
  134. bg_leave;
  135. message strcharinfo(0),"You leaved the Group.";
  136. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  137. }
  138. end;
  139. OnBGEnable:
  140. delwaitingroom;
  141. waitingroom "Blue TEAM",( $@team_count + 1 ),$@bg_npc_name$+"::OnBlueJoin",1;
  142. end;
  143. }
  144. prontera,155,182,5 script SOLO Team::bg_solo 100,{
  145. if( getcharid(4) ){
  146. bg_leave;
  147. message strcharinfo(0),"You leaved the Group.";
  148. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  149. }
  150. end;
  151. OnBGEnable:
  152. delwaitingroom;
  153. waitingroom "SOLO TEAM",2,$@bg_npc_name$+"::OnSoloJoin",1;
  154. end;
  155. }
Advertisement
Add Comment
Please, Sign In to add comment