HI . can someone edit this script for me ? i found the old capture the flag script of memory killer. and now i want to have some changes in the script . I want the winners and losers get a prizes like 2 tcg for the Winner and 1 tcg for the loser . thanks in advance
here's the script
//===== eAthena Script =======================================
//= Capture the Flag
//===== By: ==================================================
//= mathio (based on script by Memorykiller)
//===== Current Version: =====================================
//= 1.1
//===== Description: =========================================
//= The players are divided up into two teams, Red Team and Blue Team.
//= Players subscribe into teams - each subscriber needs a party with 5
//= (or other set amount) players in it. Whole party is signed up.
//= 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 (or other set amount) 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 pvp_noguild
bat_b01 mapflag nobranch
bat_b01 mapflag nomemo
bat_b01 mapflag nopenalty
bat_b01 mapflag noreturn
bat_b01 mapflag noteleport
bat_b01 mapflag nowarp
bat_b01 mapflag nowarpto
bat_b01 mapflag noicewall
jupe_ele mapflag nomemo
jupe_ele mapflag noreturn
jupe_ele mapflag nowarp
jupe_ele mapflag nowarpto
jupe_ele mapflag noicewall
bat_b01,0,0,0 script ctf_sys -1,{
end;
OnPCLogoutEvent:
//do this only when logged out from game
if (BlueTeam == 1 || RedTeam == 1) {
//Clearing all variables, restoring original look, and saving in prontera
setlook 7,"normallook"+strcharinfo(0);
if (getsavepoint(0) == "bat_b01" || getsavepoint(0) == "jupe_ele")
savepoint "prontera",116,73;
if( RedFlagTaken == 1 ){ //If PC has the red flag, drops on logout
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;
}
if( BlueFlagTaken == 1 ){ //If PC has the blue flag, drops on logout
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;
}
set BlueTeam, 0;
set RedTeam, 0;
set RedFlagTaken, 0;
set BlueFlagTaken, 0;
set Blue_Flag_Carrier$,0;
set Red_Flag_Carrier$,0;
if (getmapusers("bat_b01.gat") == 1) {
goto OnCTFEndGame;
}
}
if (getsavepoint(0) == "bat_b01" || getsavepoint(0) == "jupe_ele") //restore savepoint to prontera
savepoint "prontera",116,73;
end;
OnPCDieEvent:
if( BlueFlagTaken == 1 ){
mapannounce "bat_b01", "The Blue Flag has been dropped",bc_map,0x0000FF;
setlook 7, 79;
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, 78;
getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0));
movenpc "Red Flag 1",.@mapx,.@mapy;
set RedFlagTaken, 0;
set Red_Flag_Carrier$,0;
end;
}
end;
OnCTFEndGame:
//Incase flags come back, move them to a remote location [Safety Precaution]
movenpc "Red Flag",391,15;
movenpc "Blue Flag",391,14;
movenpc "Red Flag 1",392,15;
movenpc "Blue Flag 1",392,14;
//announce
mapannounce "bat_b01", "The CTF game ended! You will be warped out in few seconds.",0;
mapannounce "jupe_ele", "The CTF game ended",0;
mapannounce "jupe_ele", getpartyname($BlueParty)+" (blue) "+$@bluescore+" : "+$@bluescore+" "+getpartyname($RedParty)+" (red)",0;
//reset parties
set $BlueParty,0;
set $RedParty,0;
//disable entrance warp
disablenpc "CtfEntrance";
//warp all players
sleep 3000;
mapwarp "bat_b01","jupe_ele",44,46;
end;
}
prontera,169,71,3 script CTF Warper#prt 874,{
mes "[CTF Warper]";
mes "Welcome, do you want to play ^0000ffCapture the Flag^000000?";
//check if game in progress
if ($BlueParty > 0 && $RedParty > 0) {
mes "^ff0000There is a game in progress.^000000";
} else {
mes "^008800There is no game in progress.^000000";
}
mes "There are "+getmapusers("jupe_ele.gat")+" players in waiting room.";
next;
menu "I want to play!",warpme,
"No thank you...",-;
close;
warpme:
warp "jupe_ele",44,46;
close;
}
// This is the NPC players will use to join the game. GMs can join the game, configure CTF or force current game to end
jupe_ele,37,36,7 script CTF Warper#game 874,{
set @pid, getcharid(1);
mes "[CTF Warper]";
mes "Do you really want to leave?";
mes "If your party is signed up for CTF it will be ^0000ffcanceled if you leave^000000!";
if (select("I will stay:I want to go back") == 1)
close;
setlook 7,"normallook"+strcharinfo(0);
if (getsavepoint(0) == "bat_b01" || getsavepoint(0) == "jupe_ele")
savepoint "prontera",116,73;
if (@pid == $BlueParty)
set $BlueParty, 0;
if (@pid == $RedParty)
set $RedParty, 0;
warp "prontera",116,73;
close;
}
jupe_ele,46,55,5 script Capture The Flag 873,{
if($Cap_Limit == 0 || $Play_Limit == 0) {
set $Cap_Limit, 3;
set $Play_Limit, 5;
}
//check nonexistent parties
getpartymember($BlueParty);
set @bluecount,$@partymembercount;
getpartymember($RedParty);
set @redcount,$@partymembercount;
if (getpartyname($BlueParty) == "null" || @bluecount != $Play_Limit)
set $BlueParty,0;
if (getpartyname($RedParty) == "null" || @redcount != $Play_Limit)
set $RedParty,0;
if(getgmlevel() >= 60) {
gmmenu:
mes "[CTF]";
mes "Want do you want to do?";
next;
menu "Join the fight",jtf,
"Configure CTF",CTFConfig,
"Force the end of current game",ForceEnd,
"Cancel",-;
close;
CTFConfig:
mes "[CTF]";
mes "What setting do you wish to change?";
next;
menu "Max Capture Limit ("+$Cap_Limit+")",CTFcapL,
"Players Limit For Each Team ("+$Play_Limit+")",CTFplayL;
CTFcapL:
mes "How many flag captures until the match is over? (3 recommended, maximum 10)";
input $Cap_Limit;
if($Cap_Limit > 10 || $Cap_Limit <= 0){
mes "Sorry, you can only have a range or 1-10 captures";
goto gmmenu;
}
mes "The Cap Limit is now "+$Cap_Limit;
goto gmmenu;
CTFplayL:
mes "How many players are required for each team?";
input $Play_Limit;
if($Cap_Limit > 10 || $Cap_Limit <= 0){
mes "Sorry, you can only have only 1-10 players limit";
goto gmmenu;
}
mes "The Player Limit is now "+$Play_Limit;
goto gmmenu;
ForceEnd:
mes "Really force the current game to end?";
if (select("No:Yes") == 1)
goto gmmenu;
mes "The current game was ended!";
close2;
//Incase flags come back, move them to a remote location [Safety Precaution]
movenpc "Red Flag",391,15;
movenpc "Blue Flag",391,14;
movenpc "Red Flag 1",392,15;
movenpc "Blue Flag 1",392,14;
//announce
mapannounce "bat_b01", "The CTF game ended by a GM! You will be warped out in few seconds.",0;
mapannounce "jupe_ele", "The CTF game ended by a GM",0;
mapannounce "jupe_ele", getpartyname($BlueParty)+" (blue) "+$@bluescore+" : "+$@bluescore+" "+getpartyname($RedParty)+" (red)",0;
//reset parties
set $BlueParty,0;
set $RedParty,0;
//disable entrance warp
disablenpc "CtfEntrance";
//warp all players
sleep 3000;
mapwarp "bat_b01","jupe_ele",44,46;
end;
}
jtf:
mes "[CTF]";
//check base level
if(BaseLevel < 40){
mes "I'm afraid your Baselevel is not high enough to join the event! You need to be at least ^0000ffBaselevel 40^000000.";
close;
}
//check if game in progress
if ($BlueParty > 0 && $RedParty > 0) {
mes "There is already a game in progress. Please wait untill the game is over.";
mes "Do you need some help?";
next;
if (select("Yes, what is CTF?:No, thanks") == 1)
goto explain;
close;
}
set @pid, getcharid(1);
getpartymember(@pid);
set @partymembercount,$@partymembercount;
if (@pid == 0 || @partymembercount != $Play_Limit) {
mes "You need a ^0000ffparty of "+$Play_Limit+" people^000000 to participate!";
mes "Do you need some help?";
next;
if (select("Yes, what is CTF?:No, thanks") == 1)
goto explain;
close;
}
if (@pid == $BlueParty) {
mes "Your party is already signed up as ^0000ffBlue Team^000000.";
mes "Please note that if someone from your party leaves this map your subscription will be cancelled.";
next;
if (select("Okay!:Sign out") == 1)
close;
set $BlueParty,0;
mes "Your party signed out.";
close;
}
if (@pid == $RedParty) {
mes "Your party is already signed up as ^ff0000Red Team^000000.";
next;
if (select("Okay!:Sign out") == 1)
close;
set $RedParty,0;
mes "Your party signed out.";
close;
}
mes "Which team do you want to join with your party?";
mes "Or do you need some help?";
next;
pickteam:
menu "^0000ffBlue Team^000000",joinblueteam,
"^ff0000Red Team^000000",joinredteam,
"What is CTF?",-;
explain:
mes "[CTF]";
mes "CTF stands for ^0000ffCapture the Flag^000000. This is a game where ^0000fftwo parties of "+$Play_Limit+" people^000000 compete against each other";
next;
mes "[CTF]";
mes "You can score by taking your enemy's flag and bring it to yours. You pick up a flag by aproaching it. When you die you respawn at the map but you drop the flag (if you caried it). Than the flag can be picked up by other players.";
next;
mes "[CTF]";
mes "If you kill enemy player carying a flag (and pick it up) it will be recovered. Please note that you cannot score if your flag is not recovered.";
next;
mes "[CTF]";
mes "A team that scores "+$Cap_Limit+" times wins the game.";
mes "Currently there are no prizes for this game.";
close;
joinblueteam:
if ($BlueParty > 0) {
mes "Sorry ^0000ffBlue Team^000000 is already taken.";
goto pickteam;
}
mes "[CTF]";
mes "Your party is now subscribed as ^0000ffBlue Team^000000.";
mes "Please note that if someone from your party leaves this map your subscription will be cancelled.";
set $BlueParty,@pid;
if ($RedParty > 0 && $BlueParty > 0)
goto start_ctf;
close;
joinredteam:
if ($RedParty > 0) {
mes "Sorry ^ff0000Red Team^000000 is already taken.";
goto pickteam;
}
mes "[CTF]";
mes "Your party is now subscribed as ^ff0000Red Team^000000.";
mes "Please note that if someone from your party leaves this map your subscription will be cancelled.";
set $RedParty,@pid;
if ($RedParty > 0 && $BlueParty > 0)
goto start_ctf;
close;
start_ctf:
//Moving flags to original startpoint just incase
movenpc "Blue Flag",329,149;
movenpc "Red Flag",62,149;
movenpc "Red Flag 1",319,14;
movenpc "Blue Flag 1",319,15;
close2;
//announce the begining
mapannounce "jupe_ele", "The CTF game will start in few moments!",0;
sleep2 2000;
mapannounce "jupe_ele", getpartyname($BlueParty)+" (blue) vs. "+getpartyname($RedParty)+" (red)",0;
sleep 3000;
mapannounce "jupe_ele", "Please use the nearby warp to enter the game!",0;
//show warp to game
enablenpc "CtfEntrance";
end;
OnInit:
disablenpc "CtfEntrance";
}
//warp to enter CTF map
jupe_ele,39,57,0 script CtfEntrance 45,1,2,{
set @pid, getcharid(1);
if (@pid == $BlueParty) {
set BlueTeam, 1;
set RedTeam, 0;
set RedFlagTaken, 0;
set BlueFlagTaken, 0;
set normallook,(getlook(7));
setlook 7, 78;
savepoint "bat_b01",312,223;
warp "bat_b01",312,223;
close;
}
if (@pid == $RedParty) {
set RedTeam, 1;
set BlueTeam, 0;
set RedFlagTaken, 0;
set BlueFlagTaken, 0;
set normallook,(getlook(7));
setlook 7, 79;
savepoint "bat_b01",87,74;
warp "bat_b01",87,74;
close;
}
mes "Sorry but you havent signed up for CTF!";
close;
}
// 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, 44;
movenpc "Red Flag",391,15;
disablenpc "Red Flag";
}
if( BlueFlagTaken == 1 ){ //Red Team scores if PC has the variable "BlueFlagTaken"
percentheal 100,0;
mapannounce "bat_b01", "Red Team Scores!",bc_map,0xFF0000;
set BlueFlagTaken, 0;
set Blue_Flag_Carrier$,0;
setlook 7, 79;
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, 44;
movenpc "Blue Flag",391,14;
disablenpc "Blue Flag";
}
if( RedFlagTaken == 1){ //Blue Team scores if PC has the variable "RedFlagTaken"
percentheal 100,0;
mapannounce "bat_b01", "Blue Team Scores!",bc_map,0x0000FF;
set RedFlagTaken, 0;
set Red_Flag_Carrier$,0;
setlook 7, 78;
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, 44;
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, 44;
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;
}
//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;
}
}
//Healers
//Red Healer
bat_b01,93,82,5 script Red Healer 935,{
if(RedTeam == 1){
mes "[Red Healer]";
mes "You look weak..want a heal?";
mes "You look like a person who needs it";
mes "Want it?";
next;
menu "Heal",-,"No thanks",CANCEL;
percentheal 100,0;
mes "[Healer]";
mes "Ok, Here you go.";
mes "Now get out there and kill!!";
close;
CANCEL:
mes "[Red Healer]";
mes "Allright, come back if you need a heal.";
close;
}
end;
}
//Blue Healer
bat_b01,316,232,5 script Blue Healer 932,{
if(BlueTeam == 1){
mes "[Blue Healer]";
mes "You look weak..want a heal?";
mes "You look like a person who needs it";
mes "Want it?";
next;
menu "Heal",-,"No thanks",CANCEL;
percentheal 100,0;
mes "[Healer]";
mes "Ok, here you go.";
mes "Now get out there and kill!!";
close;
CANCEL:
mes "[Healer]";
mes "Allright, come back if you need a heal.";
close;
}
end;
}