//===== eAthena Script ======================================= //= Capture the Flag //===== By: ================================================== //= Memorykiller //===== Current Version: ===================================== //= 1.4 //===== Description: ========================================= //= Halo CTF style. GM has to start it but does not have to supervise it //= The players are divided up into two teams, Red Team and Blue Team. //= There are two flags, each team must capture the other team's flag and return //= it to their own. They cannot score if their flag is taken. First team to //= score 3 captures wins! //===== Additional Comments: ================================= //= Technically, there are 4 Flags, 2 for the starting base. 2 for dropped flags //= Beware of issues via player logout, the bug should be fixed though //= Starter NPC is located at "bat_b01,389,8". Careful not to touch the flags //= Clothes color change when joining teams and when picking up the flag to add //= some coolness! =) //= Players should use the Starter NPC in jupe_ele. GMs should use the one in //= bat_b01 //= GM can configure CTF settings with the CTF NPC //============================================================ bat_b01 mapflag pvp bat_b01 mapflag nomemo bat_b01 mapflag noreturn bat_b01 mapflag nowarp bat_b01 mapflag nowarpto bat_b01 mapflag noicewall bat_b01,0,0,0 script ctf_sys -1,{ end; OnPCLogoutEvent: If(BlueTeam == 1){ //If PC has the red flag, drops on logout if( RedFlagTaken == 1 ){ mapannounce "bat_b01","The Red Flag has been dropped",bc_map,0xFF0000; getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0)); movenpc "Red_Flag_1",.@mapx,.@mapy; } setlook 7,"normallook"+strcharinfo(0);//Clearing all variables, restoring original look, and saving in prontera set BlueTeam, 0; set RedTeam, 0; set RedFlagTaken, 0; set BlueFlagTaken, 0; savepoint "prontera",156,191; set Blue_Flag_Carrier$,0; set Red_Flag_Carrier$,0; } if(RedTeam == 1){ //If PC has the blue flag, drops on logout if( BlueFlagTaken == 1 ){ mapannounce "bat_b01","The Blue Flag has been dropped",bc_map,0x0000FF; getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0)); movenpc "Blue_Flag_1",.@mapx,.@mapy; } setlook 7,"normallook"+strcharinfo(0);//Clearing all variables, restoring original look, and saving in prontera set BlueTeam, 0; set RedTeam, 0; set RedFlagTaken, 0; set BlueFlagTaken, 0; savepoint "prontera",156,191; set Blue_Flag_Carrier$,0; set Red_Flag_Carrier$,0; } end; OnPCDieEvent: if( BlueFlagTaken == 1 ){ mapannounce "bat_b01", "The Blue Flag has been dropped",bc_map,0x0000FF; setlook 7, 122; getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0)); movenpc "Blue_Flag_1",.@mapx,.@mapy; set BlueFlagTaken, 0; set Blue_Flag_Carrier$,0; end; } if( RedFlagTaken == 1 ){ mapannounce "bat_b01", "The Red Flag has been dropped",bc_map,0xFF0000; setlook 7, 103; getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0)); movenpc "Red_Flag_1",.@mapx,.@mapy; set RedFlagTaken, 0; set Red_Flag_Carrier$,0; end; } end; OnCTFEndGame: atcommand "@pvpoff"; //Pvp off, ressurects everyone, and disables the flags atcommand "@raisemap"; movenpc "Prontera Warper#1",72,148; movenpc "Prontera Warper#2",321,151; movenpc "Prontera Warper#3",311,229; movenpc "Prontera Warper#4",87,79; movenpc "Red_Flag",391,15; //Incase flags come back, move them to a remote location [safety Precaution] movenpc "Blue_Flag",391,14; movenpc "Red_Flag_1",392,15; movenpc "Blue_Flag_1",392,14; enablenpc "Wall#1"; enablenpc "Wall#2"; enablenpc "Wall#3"; enablenpc "Wall#4"; set $Blue_Password$,"blue"; set $Red_Password$,"red"; set Blue_Flag_Carrier$,0; set Red_Flag_Carrier$,0; end; } // This is the NPC players will use to join the game. GMS can start CTF, join, or kill a player. // Also duplicated on the map [bat_b01 389 8] dicastes01,248,127,2 script Capture The Flag 874,{ if(getgmlevel() == 99){ mes "[CTF]"; mes "Want do you want to do?"; menu "Start CTF",start_ctf,"Join the fight",jtf,"Kill Somebody",k1,"Configure CTF",CTFConfig; CTFConfig: mes "[CTF]"; mes "What setting do you wish to change?"; menu "Team Passwords",STpass,"Max Capture Limit",CTFcapL,"Set Base Levels",SBlvl,"Disable/Enable Carrier Viewing",DEview; STpass: mes "Which team do you want to set a password for?"; menu "Blue Team",SBpass,"Red Team",SRpass; SBpass: mes "What will Blue Teams password be?"; input $Blue_Password$; announce "Capture The Flag Event:",0; announce "The Blue Password has been changed by a GM",0; next; mes "Please notify the Blue Team party leader of the new password"; close; SRpass: mes "What will Red Teams password be?"; input $Red_Password$; announce "Capture The Flag Event:",0; announce "The Red Password has been changed by a GM",0; next; mes "Please notify the Red Team party leader of the new password"; close; CTFcapL: mes "How many flag captures until the match is over? (3 reccommended and default, cannot go over 10)"; input $Cap_Limit; if($Cap_Limit > 10){ mes "Sorry, you can only have a range or 1-10 captures"; close; } if($Cap_Limit <= 0){ mes "Sorry, you can only have a range or 1-10 captures"; close; } mes "The Cap Limit is now "+$Cap_Limit; close; SBlvl: if($FBlvl_Set == 0){ mes "You have not configured this setting before, what is the maximum baselevel for your server?"; input $Blvl_Max; mes "Your maximum base level is "+$Blvl_Max; next; } mes "Do you want to configure a new Max Base Level on your server, or set a Minimum Base Level that players have to be to join?"; menu "Set Minimum Base Level",SminBL,"Set Maximum Base Level",SmaxBL; SminBL: mes "What will be the minumum base level requirement to join Capture The Flag?"; input $Blvl_Min; if($Blvl_Min <= 0){ mes "The minimum baselevel must be between 1-"+$Blvl_Max; close; } if($Blvl_Min > $Blvl_Max){ mes "The Minimum baselevel can't be greater than the maximum baselevel("+$Blvl_Max+")!!! Then no one could join!"; close; } next; mes "The minimum baselevel requirement is "+$Blvl_Min; close; SmaxBL: mes "What is the maximum baselevel for your server?"; input $Blvl_Max; mes "Your maximum base level is "+$Blvl_Max; close; DEview: mes "Do you wish to disable/enable the indicators on the mini-map for the flag carriers? (Default is turned ON)"; menu "Enable",Eview,"Disable",Dview; Eview: enablenpc "Flag_Indicator"; mes "The Flag Carrier indicators are now turned ON"; close; Dview: disablenpc "Flag_Indicator"; mes "The Flag Carrier indicators are now turned OFF"; close; k1: mes "Input the players name [Case Sensitive]"; input player$; atcommand strcharinfo(0)+":nuke "+player$; close; start_ctf: if($Cap_Limit == 0){ set $Cap_Limit,3; } disablenpc "Wall#1"; disablenpc "Wall#2"; disablenpc "Wall#3"; disablenpc "Wall#4"; movenpc "Prontera Warper",396,9; movenpc "Prontera Warper#1",396,8; movenpc "Blue_Flag",329,149; //Moving flags to original startpoint just incase movenpc "Red_Flag",62,149; movenpc "Red_Flag_1",319,14; movenpc "Blue_Flag#2",319,15; mapannounce "bat_b01","Capture the other team's flag and return it to yours",0; sleep2 4000; mapannounce "bat_b01","You can't score if your Flag is taken!!",0; sleep2 4000; mapannounce "bat_b01","First team to "+$Cap_Limit+" captures wins! Now...GO!!",0; close; } jtf: mes "[CTF]"; if(BaseLevel < $Blvl_Min){ mes "Im afraid your Baselevel is not high enough to join the event!"; close; } mes "Which team do you want to join?"; menu "Blue Team",joinblueteam,"Red Team",joinredteam; joinblueteam: mes "What is the password for Blue Team?"; input .@Gpass$; if(.@Gpass$ != $Blue_Password$){ mes "Sorry, that is wrong!"; close; } set normallook,(getlook(7)); setlook 7, 103; set BlueTeam, 1; set RedTeam, 0; set RedFlagTaken, 0; set BlueFlagTaken, 0; savepoint "bat_b01",312,223; warp "bat_b01",312,223; close; joinredteam: input .@Gpass$; if(.@Gpass$ != $Red_Password$){ mes "Sorry, that is wrong!"; close; } set normallook,(getlook(7)); setlook 7, 122; set RedTeam, 1; set BlueTeam, 0; set RedFlagTaken, 0; set BlueFlagTaken, 0; savepoint "bat_b01",87,74; warp "bat_b01",87,74; close; } bat_b01,389,8,5 duplicate(Capture The Flag) Capture The Flag#1 874 // Base Flags bat_b01,62,149,5 script Red_Flag 722,2,2,{ end; OnTouch: if( BlueTeam == 1 ){ //Blue Team takes the Red Flag and disables and moves the flag set RedFlagTaken, 1; set Red_Flag_Carrier$,strcharinfo(0); mapannounce "bat_b01", strcharinfo(0) + " has taken the Red Flag",bc_map,0x0000FF; announce "Take the flag back to yours!",3,0x0000FF; setlook 7, 129; movenpc "Red_Flag",391,15; disablenpc "Red_Flag"; } if( BlueFlagTaken == 1 ){ //Red Team scores if PC has the variable "BlueFlagTaken" percentheal 100,100; mapannounce "bat_b01", "Red Team Scores!",bc_map,0xFF0000; set BlueFlagTaken, 0; set Blue_Flag_Carrier$,0; setlook 7, 122; enablenpc "Blue_Flag"; movenpc "Blue_Flag",329,149; setd "$@redscore"+strcharinfo(1), getd("$@redscore"+strcharinfo(1))+1; if(getd("$@redscore"+strcharinfo(1)) >= $Cap_Limit){ mapannounce "bat_b01","Red team has won the match!",bc_map,0xFF0000; setd "CTF_Winner"+strcharinfo(1),1; donpcevent "ctf_sys::OnCTFEndGame"; } mapannounce "bat_b01","Red Score:" + getd("$@redscore"+strcharinfo(1)),bc_map,0xFF0000; } end; } bat_b01,329,149,5 script Blue_Flag 722,2,2,{ end; OnTouch: if( RedTeam == 1 ){ //Red Team takes the Blue Flag and disables and moves the flag mapannounce "bat_b01", strcharinfo(0) + " has taken the Blue Flag",bc_map,0xFF0000; announce "Take the flag back to yours!",3,0xFF0000; set BlueFlagTaken, 1; set Blue_Flag_Carrier$,strcharinfo(0); setlook 7, 235; movenpc "Blue_Flag",391,14; disablenpc "Blue_Flag"; } if( RedFlagTaken == 1){ //Blue Team scores if PC has the variable "RedFlagTaken" percentheal 100,100; mapannounce "bat_b01", "Blue Team Scores!",bc_map,0x0000FF; set RedFlagTaken, 0; set Red_Flag_Carrier$,0; setlook 7, 103; enablenpc "Red_Flag"; movenpc "Red_Flag",62,149; setd "$@bluescore"+strcharinfo(1), getd("$@bluescore"+strcharinfo(1))+1; if(getd("$@bluescore"+strcharinfo(1)) >= $Cap_Limit){ mapannounce "bat_b01","Blue team has won the match!",bc_map,0x0000FF; setd "CTF_Winner"+strcharinfo(1),1; donpcevent "ctf_sys::OnCTFEndGame"; } mapannounce "bat_b01","Blue Score:" + getd("$@bluescore"+strcharinfo(1)),bc_map,0x0000FF; } end; } //Non-Base Flags. Flags that appear when the Flag is dropped bat_b01,390,13,5 script Blue_Flag_1 722,2,2,{ end; OnTouch: if( RedTeam == 1 ){ mapannounce "bat_b01",strcharinfo(0)+" has taken the Blue Flag",bc_map,0xFF0000; set BlueFlagTaken, 1; set Blue_Flag_Carrier$,strcharinfo(0); setlook 7, 235; movenpc "Blue_Flag_1",390,13; disablenpc "Blue_Flag"; end; } if( BlueTeam == 1 ){ mapannounce "bat_b01", strcharinfo(0)+" has returned the Blue Flag",bc_map,0x0000FF; enablenpc "Blue_Flag"; movenpc "Blue_Flag",329,149; movenpc "Blue_Flag_1",390,13; end; } end; } bat_b01,390,14,5 script Red_Flag_1 722,2,2,{ end; OnTouch: if( BlueTeam == 1 ){ mapannounce "bat_b01", strcharinfo(0) + " has picked up the Red Flag",bc_map,0x0000FF; set RedFlagTaken, 1; set Red_Flag_Carrier$,strcharinfo(0); setlook 7, 129; movenpc "Red_Flag_1",390,13; disablenpc "Red_Flag"; end; } if( RedTeam == 1 ){ mapannounce "bat_b01",strcharinfo(0)+" has returned the Red Flag",bc_map,0xFF0000; enablenpc "Red_Flag"; movenpc "Red_Flag",62,149; movenpc "Red_Flag_1",390,14; end; } end; } //Incase Players try to get out of the starting box before CTF actually starts bat_b01,292,225,5 script Wall#1 -111,7,7,{ end; OnTouch: warp "bat_b01",311,224; end; } bat_b01,331,224,5 script Wall#2 -111,7,7,{ end; OnTouch: warp "bat_b01",311,224; end; } bat_b01,107,74,5 script Wall#3 -111,7,7,{ end; OnTouch: warp "bat_b01",88,74; end; } bat_b01,70,74,5 script Wall#4 -111,5,5,{ end; OnTouch: warp "bat_b01",88,74; end; } //Precaution incase team variables reset upon respawn bat_b01,312,223,5 script Spawn#blue -111,7,7,{ end; OnTouch: if( RedTeam == 1){ end; } if( BlueFlagTaken == 1 ){ end; } if( RedFlagTaken == 1 ){ end; } if( BlueTeam <= 0 ){ set BlueTeam, 1; end; } } bat_b01,87,74,5 script Spawn#red -111,7,7,{ end; OnTouch: if( BlueTeam == 1 ){ end; } if( RedFlagTaken == 1 ){ end; } if( BlueFlagTaken == 1 ){ end; } if( RedTeam <= 1 ){ set RedTeam, 1; end; } } //= Prontera/Prize Warpers bat_b01,396,9,5 script Prontera Warper#1 405,{ mes "[Prontera Warper]"; mes "Seems that the match is over, would you like to return to Prontera? Or, if you are the winning team, you may claim your reward."; menu "Yes",Wpront,"No",Wno,"Claim Reward",Crew; Wpront: warp "prontera",156,178; savepoint "prontera",158,189; setlook 7,"normallook"+strcharinfo(0); set BlueTeam, 0; set RedTeam, 0; set RedFlagTaken, 0; set BlueFlagTaken, 0; set Blue_Flag_Carrier$,0; set Red_Flag_Carrier$,0; close; Wno: close; Crew: if(getd("CTF_Winner"+strcharinfo(1)) == 1){ warp "bat_b01",6,290; close; } mes "Sorry, you didn't win.."; close; } bat_b01,396,8,5 duplicate(Prontera Warper#1) Prontera Warper#2 405 bat_b01,397,9,5 duplicate(Prontera Warper#1) Prontera Warper#3 405 bat_b01,397,8,5 duplicate(Prontera Warper#1) Prontera Warper#4 405 //= Invisible Flag Carrier NPC //- If NPC is turned ON, flag carriers will be shown with dots on the mini-map //- Indicator still in testing! //bat_b01,150,150,5 script Flag_Indicator -1,500,500,{ //end; //OnTouch: // getmapxy (mapname$,.@mapx,.@mapy,0,(Red_Flag_Carrier$); // viewpoint 1,.@mapx,.@mapy,1,0xFF0000; // getmapxy (mapname$,.@mapx,.@mapy,0,(Blue_Flag_Carrier$); // viewpoint 1,.@mapx,.@mapy,1,0x0000FF; // end; //}
And it working fine, but a few tweaks would be nice, I like it to auto create a party after ive chosen a team, or any alternative that do not attack team mates? how to add a char limit?
Question
VhayneRO
So im using MemoryKiller's CTF Script
this one
And it working fine, but a few tweaks would be nice, I like it to auto create a party after ive chosen a team, or any alternative that do not attack team mates? how to add a char limit?
Edited by jem578Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.