Jump to content

Switcho

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by Switcho

  1. Hi ,

    I use this pvp ranking :

    //===== rAthena Script =======================================
    //= PvP log
    //===== By: ================================================== 
    //= Vietlubu
    //===== Description: =========================================
    //= Simple SQL PvP log
    //= Notes:
    //= - Create table `pvplog` when start script.
    //= - Add new record when has OnPCKillEvent
    //= - Remove NCP PvP Ranking if you don't want to use.
    //===== Compatible With: ===================================== 
    //= rAthena Project
    //===== Changelogs: ==========================================
    //= 1.0 First version.
    //============================================================
    
    prontera,155,181,5	script	PvP Ranking	430,{
    	.@limitRanking = 3;
    	.@limitEnemies = 3;
    
    	mes "[PvP Ranking]";
    	//menu "Ranking of month", L_RankMonth, "Ranking of week", L_RankWeek, "Ranking of day", L_RankDay;
    
    	select "Ranking of month", "Ranking of week", "Ranking of day", "My enemies";
    	if (@menu < 4) {
    		// Ranking
    		switch(@menu) {
    			case 1:
    				.@ranking$ = "MONTH";
    				.@message$ = "Ranking of month";
    				break;
    			case 2:
    				.@ranking$ = "WEEK";
    				.@message$ = "Ranking of week";
    				break;
    			case 3:
    				.@ranking$ = "DAY";
    				.@message$ = "Ranking of day";
    				break;
    		}
    
    		query_sql("SELECT `char`.`name`, COUNT(`char`.`name`) AS count_kill FROM `pvplog` INNER JOIN `char` ON `char`.`char_id` = `pvplog`.`killer_id` WHERE " + .@ranking$ + "(`pvplog`.`pvp_date`) = " + .@ranking$ + "(CURRENT_DATE()) GROUP BY `char`.`name` ORDER BY count_kill DESC LIMIT " + .@limitRanking, .@name$, .@count_kill);
    		
    		mes .@message$;
    		for( @i = 0; @i < getarraysize(.@name$); @i++ ) {
    			mes "Top " + (@i+1) + ": ^2ecc71" + .@name$[@i] + "^000000 kills times: ^e74c3c" + .@count_kill[@i] + "^000000";
    		}
    
    	} else if (@menu == 4) {
    		query_sql("SELECT `char`.`name`, COUNT(`char`.`name`) AS count_kill FROM `pvplog` INNER JOIN `char` ON `char`.`char_id` = `pvplog`.`killer_id` WHERE `pvplog`.`victim_id` = " + getcharid(0) + " GROUP BY `char`.`name` ORDER BY count_kill DESC LIMIT " + .@limitEnemies, .@name$, .@count_kill);
    		
    		mes "Top your enemies:";
    		for( @i = 0; @i < getarraysize(.@name$); @i++ ) {
    			mes "Top 1: ^e74c3c" + .@name$[0] + "^000000 kill you ^2ecc71" + .@count_kill[0] + "^000000 times" + "^000000";
    		}
    	}
    	close;
    
    	L_RankMonth:
    		mes "Ranking of month";
    		close;
    	
    	L_RankWeek:
    		mes "Ranking of week";
    		close;
    
    	L_RankDay:
    		mes "Ranking of day";
    		close;
    
    	end;
    }
    
    -	script	pvplog	-1,{
    	OnInit:
    		query_sql("CREATE TABLE IF NOT EXISTS `pvplog` (`pvp_id` mediumint(9) unsigned NOT NULL auto_increment, `pvp_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `killer_id` int(11) NOT NULL default '0', `victim_id` int(11) NOT NULL default '0', `map` varchar(11) NOT NULL default '', PRIMARY KEY  (`pvp_id`)) ENGINE=MyISAM AUTO_INCREMENT=1;");
    		end;
    
    	OnPCKillEvent:
    		query_sql("INSERT INTO `pvplog` (`killer_id`, `victim_id`, `map`) VALUES ('" + getcharid(0) + "', (SELECT `char_id` FROM `char` WHERE `name` = '" + rid2name(killedrid) + "'), '" + strcharinfo(3) + "');");
    		end;
    }

    The script works perfectly , but he show only the kill. :

    kill.jpg.c346ffd09dfedada50378e99ecbc5892.jpg

    I want to add the number of death like this :

    Top 1 : Test1 Nombre de kills/Deaths : 19/14

    Top 2 : Test2 Nombres de kills/Deaths :14/19

     

    but I do not know how to do it

    Thx

  2. Hi,

    i need your help,

    I found this script :

    // ==============================================================================
     
    // BattleGround System - Flavius TD - Flavius Team Deathmatch
     
    // ==============================================================================
     
    // By Suke / s4zuk3
     
    // ==============================================================================
     
    // Registration NPC's
     
    // *********************************************************************
     
     
    bat_room,151,159,4  script  Registration::Fl1R_Guillaume    418,{
        end;
     
    OnInit:
     
        waitingroom "BG DeathMatch",5,"Flavius_BG1::OnGuillaumeJoin",1;
     
        end;
     
    OnEnterBG:
     
        set $@FlaviusBG1_id1, waitingroom2bg("bat_b01",390,10,"Flavius_BG1::OnGuillaumeQuit","");
     
        end;
     
    }
     
     
    bat_room,158,159,4  script  Registration::Fl1R_Croix    414,{
     
        end;
     
    OnInit:
     
        waitingroom "BG DeathMatch",5,"Flavius_BG1::OnCroixJoin",1;
     
        end;
     
    OnEnterBG:
     
        set $@FlaviusBG1_id2, waitingroom2bg("bat_b01",10,290,"Flavius_BG1::OnCroixQuit","");
     
        end;
     
    }
     
     
    // Battleground Engine
     
    // *********************************************************************
     
     
    -   script  Flavius_BG1 -1,{
     
        end;
     
     
    OnInit:
     
        disablenpc "Guillaume Vintenar#fl1";
     
        disablenpc "Croix Vintenar#fl1";
     
        disablenpc "Therapist in battle#fl11";
     
        disablenpc "Therapist in battle#fl12";
     
        end;
     
     
    OnGuillaumeQuit:
     
    OnCroixQuit:
     
    if($@FlaviusBG1 != 1) {end;}
     
    if(Bat_Team == 2) {
     
    for(set .@i,0; .@i < getarraysize($@bg_red$); set .@i,.@i+1){
     
    if($@bg_red$[.@i] == strcharinfo(0)) {break;}
     
    }
     
    deletearray $@bg_red$[.@i],1;
     
    set $@td_a,$@td_a-1;
     
    end;
     
    } else if(Bat_Team == 1) {
     
    for(set .@i,0; .@i < getarraysize($@bg_blue$); set .@i,.@i+1){
     
    if($@bg_blue$[.@i] == strcharinfo(0)) {break;}
     
    }
     
    deletearray $@bg_blue$[.@i],1;
     
    set $@td_b,$@td_b-1;
     
    end;
     
    }
     
    else { end; }
     
        end;
     
     
    OnGuillaumeJoin:
     
    OnCroixJoin:
     
            if( $@FlaviusBG1 == 1 ){
     
        if( $@Guill < 30 && $@Croi < 30){
     
        set .@Guillaume, getwaitingroomstate(0,"Fl1R_Guillaume");
     
        set .@Croix, getwaitingroomstate(0,"Fl1R_Croix");
     
        if (.@Guillaume!=0 && .@Croix!=0){
     
        set $@Guill, ($@Guill + 1);
     
        set $@Croi, ($@Croi + 1);
     
        waitingroom2bg_single($@FlaviusBG1_id1,"bat_b01",311,224,"Fl1R_Guillaume");
     
        waitingroom2bg_single($@FlaviusBG1_id2,"bat_b01",87,75,"Fl1R_Croix");
     
        mapannounce "bat_room","Battleground -- Flavius Team Deathmatch [80-99] G: " + $@Guill + "/30, C: " + $@Croi + "/30 in Progress!!",1,0x006400;
     
            end;
     
        }
     
        }
     
        }
     
     
        if( $@FlaviusBG1 == 0 ){
     
            donpcevent "Flavius_BG1::OnReadyCheck";
     
            end;
     
        }
     
     
    OnReadyCheck:
     
        if( $@FlaviusBG1 )
     
            end;
     
        set .@Guillaume, getwaitingroomstate(0,"Fl1R_Guillaume");
     
        set .@Croix, getwaitingroomstate(0,"Fl1R_Croix");
     
     
        if( .@Guillaume < 1 || .@Croix < 1 ){
     
     
        if( .@Guillaume >=4 && .@Croix >=4 && !agitcheck() && $@FLTD_Flood < gettimetick(2) )
     
    {
     
    announce "Battleground -- Flavius Team Deathmatch [80-99] G: " + .@Guillaume + "/10, C: " + .@Croix + "/10",bc_all,0x006400;
     
    set $@FLTD_Flood, gettimetick(2) + 15;
     
    end;
     
    }
     
            mapannounce "bat_room","Battleground -- Flavius Team Deathmatch [80-99] G: " + .@Guillaume + "/10, C: " + .@Croix + "/10",1,0x006400;
     
            end;
     
        }
     
        //
     
     
            // BG Variables
     
        set $@FlaviusBG1, 1;
     
        set $@FlaviusBG1_Victory, 0;
     
        set .Guillaume_Score, 25;
     
        set .Croix_Score, 25;
     
        // Prepare NPC
     
        donpcevent "#gfl1_respawn::OnBGStart";
     
        donpcevent "#cfl1_respawn::OnBGStart";
     
        donpcevent "#fltd_regroup::OnBGStart";
     
        enablenpc "Therapist in battle#fl11";
     
        enablenpc "Therapist in battle#fl12";
     
        disablenpc "Guillaume Vintenar#fl1";
     
        disablenpc "Croix Vintenar#fl1";
     
        // Build and Warp Teams
     
        donpcevent "Fl1R_Guillaume::OnEnterBG";
     
        donpcevent "Fl1R_Croix::OnEnterBG";
     
        // Vamos contando :3
     
        set $@Guill, 10;
     
        set $@Croi, 10;
     
        announce "Battleground -- Flavius Team Deathmatch [80-99] has started!",0,0x006400;
     
        initnpctimer;
     
        // Death!!
     
     
    OnRoundStart:
     
        if( $@FlaviusBG1 != 1 ) end;
     
        bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score;
     
        areapercentheal "bat_b01",382,2,397,17,100,100;
     
        areapercentheal "bat_b01",2,282,17,297,100,100;
     
        bg_warp $@FlaviusBG1_id1,"bat_b01",311,224;
     
        bg_warp $@FlaviusBG1_id2,"bat_b01",87,75;
     
        sleep 2000;
     
        if( $@FlaviusBG1 != 1 ) end;
     
        mapannounce "bat_b01","The Battle of Flavius Team Deathmatch has begun!!",1,0x006400;
     
        bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score;
     
        end;
     
     
    OnPCDieEvent:
     
        if( $@FlaviusBG1 == 1 )
     
        {
     
         getmapxy (mapname$,.@mapx,.@mapy,0,strcharinfo(0));
     
         if ( mapname$ != "bat_b01") end;
     
         if( Bat_Team == 1) {
     
         set .Croix_Score, .Croix_Score -1;
     
         bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score;
     
         if (.Croix_Score < 1) donpcevent "Flavius_BG1::OnCroixTDWin";
     
         end;
     
         }
     
         if ( Bat_Team == 2) {
     
    set .Guillaume_Score, .Guillaume_Score -1;
     
    bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score;
     
    if (.Guillaume_Score < 1) donpcevent "Flavius_BG1::OnGuillaumeTDWin";
     
    end;
     
    }
     
    }
     
    end;
     
     
    OnGuillaumeTDWin:
     
        set $@FlaviusBG1, 2;
     
        set $@FlaviusBG1_Victory, 1;
     
        mapannounce "bat_b01","The Guillaume Army has won the battle of Flavius Team Deathmatch",1,0x0000FF;
     
        stopnpctimer;
     
        sleep 2000;
     
        donpcevent "Flavius_BG1::OnMatchEnd";
     
        end;
     
     
    OnCroixTDWin:
     
        set $@FlaviusBG1, 2;
     
        set $@FlaviusBG1_Victory, 2;
     
        mapannounce "bat_b01","The Croix Army has won the battle of Flavius Team Deathmatch",1,0xFF0000;
     
        stopnpctimer;
     
        sleep 2000;
     
        donpcevent "Flavius_BG1::OnMatchEnd";
     
        end;
     
     
    OnTimer900000:
     
    if ($@FlaviusBG1 != 1) end;
     
        mapannounce "bat_b01","Battle of Flavius Team Deathmatch will ends in 5 minutes",1,0x006400;
     
        end;
     
    OnTimer1140000:
     
    if ($@FlaviusBG1 != 1) end;
     
        mapannounce "bat_b01","Battle of Flavius Team Deathmatch will ends in 1 minute",1,0x006400;
     
        end;
     
     
    OnTimer1200000:
     
    if ($@FlaviusBG1 != 1) end;
     
        if( .Croix_Score > .Guillaume_Score )
     
        {
     
            mapannounce "bat_b01","The Croix army has won the Battle of Flavius Team Deathmatch!",1,0xFF0000;
     
            donpcevent "Flavius_BG1::OnCroixTDWin";
     
        }
     
        else if( .Croix_Score < .Guillaume_Score )
     
        {
     
            mapannounce "bat_b01","The Guillaume army has won the Battle of Flavius Team Deathmatch!",1,0x0000FF;
     
            donpcevent "Flavius_BG1::OnGuillaumeTDWin";
     
        }
     
        else
     
        {
     
            mapannounce "bat_b01","The Battle of Flavius Team Deathmatch is over. The time is out, this is a Tie",1,0x006400;
     
            set $@FlaviusBG1, 2;
     
            set $@FlaviusBG1_Victory, 3;
     
            stopnpctimer;
     
            sleep 2000;
     
        }
     
     
    OnMatchEnd:    
     
        donpcevent "#gfl1_respawn::OnBGStop";
     
        donpcevent "#cfl1_respawn::OnBGStop";
     
        donpcevent "#fltd_regroup::OnBGStop";
     
        disablenpc "Therapist in battle#fl11";
     
        disablenpc "Therapist in battle#fl12";
     
        enablenpc "Guillaume Vintenar#fl1";
     
        enablenpc "Croix Vintenar#fl1";
     
        bg_warp $@FlaviusBG1_id1,"bat_b01",390,10;
     
        bg_warp $@FlaviusBG1_id2,"bat_b01",10,290;
     
        deletearray $@bg_red$;
     
    deletearray $@bg_blue$;
     
    set $@td_a,0;
     
    set $@td_b,0;
     
        sleep 3000;
     
        mapannounce "bat_b01","Battle of Flavius Team Deathmatch will close in 1 minute!",1,0x006400;
     
        initnpctimer;
     
        end;
     
     
    OnTimer30000:
     
        if( $@FlaviusBG1 == 2 )
     
            mapannounce "bat_b01","Battle of Flavius Team Deathmatch will close in 30 seconds!",1,0x006400;
     
        end;
     
    OnTimer50000:
     
        if( $@FlaviusBG1 == 2 )
     
            mapannounce "bat_b01","Battle of Flavius Team Deathmatch will close in 10 seconds!",1,0x006400;
     
        end;
     
     
    OnTimer60000:
     
        if( $@FlaviusBG1 != 2 ) end;
     
     
    OnReset:
     
        stopnpctimer;
     
        set .Guillaume_Score, 25;
     
        set .Croix_Score, 25;
     
        set $@FlaviusBG1_Victory, 0;
     
        // NPC's
     
        disablenpc "Guillaume Vintenar#fl1";
     
        disablenpc "Croix Vintenar#fl1";
     
        disablenpc "Therapist in battle#fl11";
     
        disablenpc "Therapist in battle#fl12";
     
        if( $@FlaviusBG1_id1 ) { bg_destroy $@FlaviusBG1_id1; set $@FlaviusBG1_id1, 0; }
     
        if( $@FlaviusBG1_id2 ) { bg_destroy $@FlaviusBG1_id2; set $@FlaviusBG1_id2, 0; }
     
        sleep 1000;
     
        mapwarp "bat_b01","bat_room",155,150;
     
        sleep 2000;
     
        bg_updatescore "bat_b01",.Guillaume_Score,.Croix_Score;
     
        set $@FlaviusBG1, 0;
     
        donpcevent "Flavius_BG1::OnReadyCheck";
     
        end;
     
    }
     
     
     
    // View oponentes en el mapa <3
     
    -   script  viewtd  -   ,{
     
    end;
     
    OnPCLoadMapEvent:
     
    if($@FlaviusBG1 != 1) {end;}
     
    if(Bat_Team == 2) {
     
    getmapxy .@MAPNAME$,.@X,.@Y,0,strcharinfo(0);
     
    while(.@MAPNAME$ == "bat_b01"){
     
    if($@FlaviusBG1 != 1) {end;}
     
    getmapxy .@MAPNAME$,.@X,.@Y,0,strcharinfo(0);
     
    if(.@MAPNAME$ != "bat_b01") { end;}
     
    for(set .@i,0; .@i < getarraysize($@bg_red$); set .@i,.@i+1){
     
    if($@bg_red$[.@i] == strcharinfo(0)) { set .@ontd,1; break;}
     
    }
     
    if(.@ontd != 1) {
     
    setarray $@bg_red$[$@td_a],strcharinfo(0);
     
    set $@td_a,$@td_a+1; }
     
    set .@j,0;
     
    for (set .@i,0; .@i < getarraysize($@bg_blue$); set .@i,.@i+1){
     
    set .@j,.@j+1;
     
    getmapxy(.mapES$, .xI, .yI,0,$@bg_blue$[.@i]);
     
    viewpoint 1,.xI,.yI,.@j,0x0000ff;
     
    } // cierre for
     
    sleep2 1000;
     
    } // cierre while
     
    } else if(Bat_Team == 1) {
     
    getmapxy .@MAPNAME$,.@X,.@Y,0,strcharinfo(0);
     
    while(.@MAPNAME$ == "bat_b01"){
     
    if($@FlaviusBG1 != 1) {end;}
     
    getmapxy .@MAPNAME$,.@X,.@Y,0,strcharinfo(0);
     
    if(.@MAPNAME$ != "bat_b01") { end;}
     
    for(set .@i,0; .@i < getarraysize($@bg_blue$); set .@i,.@i+1){
     
    if($@bg_blue$[.@i] == strcharinfo(0)) { set .@ontd,1; break;}
     
    }
     
    if(.@ontd != 1) {
     
    setarray $@bg_blue$[$@td_b],strcharinfo(0);
     
    set $@td_b,$@td_b+1; }
     
    set .@j,0;
     
    for (set .@i,0; .@i < getarraysize($@bg_red$); set .@i,.@i+1){
     
    set .@j,.@j+1;
     
    getmapxy(.mapES$, .xE, .yE,0,$@bg_red$[.@i]);
     
    viewpoint 1,.xE,.yE,.@j,0xff0000;
     
    } // cierre for
     
    sleep2 1000;
     
    } // cierre while
     
    }
     
    else { end; }
     
    }
     
     
    // Battleground rewards
     
    // *********************************************************************
     
     
    bat_b01,390,13,5    script  Guillaume Vintenar#fl1  419,{
     
        if( $@FlaviusBG1_Victory )
     
        {
     
            if( $@FlaviusBG1_Victory == Bat_Team )
     
            { // Victory
     
                mes "[Swandery]";
     
                mes "Blessed Guillaume!!";
     
                mes "Let's enjoy our glorious victory!";
     
                mes "" + strcharinfo(0) + ", its a sign reflecting victory";
     
                close2;
     
                set .@Reward,18;
     
            }
     
            else
     
            { // Derrota
     
                mes "[Swandery]";
     
                mes "You lost, but you're dedicated to this battle.";
     
                mes "This is a reward for your great dedication by Guillaume Marollo!";
     
                mes "Just take this defeat a lesson, and later you would definitely learn.";
     
                close2;
     
                set .@Reward,6;
     
            }
     
     
            set Flavius_BG_Tick, gettimetick(2) + 300; //setquest 2070;
     
            getitem 7829, .@Reward;
     
            set .@ontd,0;
     
            bg_leave;
     
            warp "bat_room",155,150;
     
            end;
     
        }
     
        end;
     
    }
     
     
    bat_b01,10,293,5    script  Croix Vintenar#fl1  415,{
     
        if( $@FlaviusBG1_Victory )
     
        {
     
            if( $@FlaviusBG1_Victory == Bat_Team )
     
            { // Victory
     
                mes "[Swandery]";
     
                mes "Blessed Croax!!";
     
                mes "Let's enjoy our glorious victory!";
     
                mes "" + strcharinfo(0) + ", its a sign reflecting victory";
     
                close2;
     
                set .@Reward, 18;
     
            }
     
            else
     
            { // Derrota
     
                mes "[Swandery]";
     
                mes "Oh, " + strcharinfo(0) + ". Don't be sad.";
     
                mes "Even though we didn't win, we did our best.";
     
                mes "This is a Royal gift from Croix, and please don't forget this battle. We can win the next.";
     
                close2;
     
                set .@Reward, 6;
     
            }
     
     
            set Flavius_BG_Tick, gettimetick(2) + 300; //setquest 2070;
     
            getitem 7829, .@Reward;
     
            set .@ontd,0;
     
            bg_leave;
     
            warp "bat_room",155,150;
     
            end;
     
        }
     
        end;
     
    }
     
     
    // Battleground Therapist
     
    // *********************************************************************
     
     
    bat_b01,390,13,5    script  Therapist in battle#fl12    95,{
     
        mes "[Therapist in battle]";
     
        mes "Just close your eyes, and take a deep breathe.";
     
        mes "You can be free from pain.";
     
        specialeffect2 312;
     
        if (select("Close:Repairman")==1){
     
                close;
     
                }
     
        next;
     
    callfunc "repairmain","Repairman";
     
        end;
     
    }
     
     
    bat_b01,10,293,5    script  Therapist in battle#fl11    95,{
     
        mes "[Therapist in battle]";
     
        mes "Just close your eyes, and take a deep breathe.";
     
        mes "You can be free from pain.";
     
        specialeffect2 312;
     
        if (select("Close:Repairman")==1){
     
                close;
     
                }
     
        next;
     
    callfunc "repairmain","Repairman";
     
        end;
     
    }
     
     
    // Battleground Respawn and Regroup
     
    // *********************************************************************
     
     
    -   script  #fltd_regroup   -1,{
     
    end;
     
     
    OnBGStart:
     
    initnpctimer;
     
    end;
     
    OnBGStop:
     
    stopnpctimer;
     
    end;
     
    OnTimer150000:
     
    mapannounce "bat_b01","Regroup Team in 30 Seconds...",1,0x006400;
     
    end;
     
    OnTimer175000:
     
    mapannounce "bat_b01","Regroup Team in 5 Seconds...",1,0x006400;
     
    end;
     
    OnTimer180000:
     
    mapannounce "bat_b01","Regroup Team!!",1,0x006400;
     
    bg_warp $@FlaviusBG1_id1,"bat_b01",328,150;
     
        bg_warp $@FlaviusBG1_id2,"bat_b01",62,150;
     
        initnpctimer;
     
        end;
     
    }
     
     
    bat_b01,390,10,0    script  #gfl1_respawn   139,{
     
        end;
     
     
    OnBGStart:
     
        initnpctimer;
     
        end;
     
     
    OnBGStop:
     
        stopnpctimer;
     
        end;
     
     
    OnTimer9000:
     
        misceffect 83;
     
        end;
     
     
    OnTimer10000:
     
        areapercentheal "bat_b01",382,2,397,17,100,100;
     
        set .@mapx,rand(309,327);
     
        set .@mapy,rand(141,159);
     
        areawarp "bat_b01",382,2,397,17,"bat_b01",.@mapx,.@mapy;
     
        initnpctimer;
     
        end;
     
    }
     
     
    bat_b01,10,290,0    script  #cfl1_respawn   139,{
     
        end;
     
     
    OnBGStart:
     
        initnpctimer;
     
        end;
     
     
    OnBGStop:
     
        stopnpctimer;
     
        end;
     
     
    OnTimer9000:
     
        misceffect 83;
     
        end;
     
     
    OnTimer10000:
     
        areapercentheal "bat_b01",2,282,17,297,100,100;
     
        set .@mapx,rand(72,91);
     
        set .@mapy,rand(141,159);
     
        areawarp "bat_b01",2,282,17,297,"bat_b01",.@mapx,.@mapy;
     
        initnpctimer;
     
        end;
     
    }
     
     
    // Flags
     
    // *********************************************************************
     
    /*
    bat_b01,304,231,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat1 973
     
    bat_b01,319,231,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat2 973
     
    bat_b01,304,218,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat3 973
     
    bat_b01,319,218,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat4 973
     
    bat_b01,304,231,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat5 973
       
    bat_b01,304,231,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat6 973
     
    bat_b01,335,142,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat7 973
     
    bat_b01,335,157,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat8 973
     
    bat_b01,390,16,1    duplicate(Guillaume camp#bat)   Guillaume camp#bat9 973
     
    bat_b01,292,163,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat19    973
     
    bat_b01,292,136,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat20    973
     
    bat_b01,241,185,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat21    973
     
    bat_b01,247,179,1   duplicate(Guillaume camp#bat)   Guillaume camp#bat22    973
     
     
    bat_b01,96,81,1 duplicate(Croix camp#bat)   Croix camp#bat1 974
     
    bat_b01,96,68,1 duplicate(Croix camp#bat)   Croix camp#bat2 974
     
    bat_b01,79,81,1 duplicate(Croix camp#bat)   Croix camp#bat3 974
     
    bat_b01,79,68,1 duplicate(Croix camp#bat)   Croix camp#bat4 974
     
    bat_b01,96,81,1 duplicate(Croix camp#bat)   Croix camp#bat5 974
     
    bat_b01,96,81,1 duplicate(Croix camp#bat)   Croix camp#bat6 974
     
    bat_b01,59,164,1    duplicate(Croix camp#bat)   Croix camp#bat7 974
     
    bat_b01,59,137,1    duplicate(Croix camp#bat)   Croix camp#bat8 974
     
    bat_b01,10,296,1    duplicate(Croix camp#bat)   Croix camp#bat9 974
     
    bat_b01,110,162,1   duplicate(Croix camp#bat)   Croix camp#bat18    974
     
    bat_b01,110,137,1   duplicate(Croix camp#bat)   Croix camp#bat19    974
     
    bat_b01,152,120,1   duplicate(Croix camp#bat)   Croix camp#bat20    974
     
    bat_b01,158,114,1   duplicate(Croix camp#bat)   Croix camp#bat21    974
    */
     
    // MapFlags
     
    // *********************************************************************
     
     
    bat_b01 mapflag battleground    2
     
    bat_b01 mapflag nomemo
     
    bat_b01 mapflag nosave  SavePoint
     
    bat_b01 mapflag noteleport
     
    bat_b01 mapflag nowarp
     
    bat_b01 mapflag nowarpto
     
    bat_b01 mapflag noreturn
     
    bat_b01 mapflag nobranch
     
    bat_b01 mapflag nopenalty
     
    bat_b01 mapflag loadevent
     
     
    // ***********************************************************************

    (https://pastebin.com/qjY38fv5)

    But the problem ,The score won't decrease when someone (croix or guillaume) has been killed?  the score still the same and i have 0 error

     

  3. Hi , 

    I use the script bg_kvm01 from npc/custom/battleground/unofficial

     

    // ==============================================================================
    // BattleGround System - KvM 80~99
    // ==============================================================================
    
    // Registration NPC's
    // *********************************************************************
    
    bat_room,253,227,4	script	Registration::KvM01R_Guillaume	418,{ // KvM Guillaume
    	end;
    
    OnInit:
    	waitingroom "Battle Station 5 Players",5,"KvM01_BG::OnGuillaumeJoin",1;
    	end;
    	
    OnEnterBG:
    	set $@KvM01BG_id1, waitingroom2bg("bat_c01",53,128,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
    	end;
    }
    
    bat_room,253,204,0	script	Registration::KvM01R_Croix	414,{ // KvM Croix
    	end;
    
    OnInit:
    	waitingroom "Battle Station 5 Players",5,"KvM01_BG::OnCroixJoin",1;
    	end;
    
    OnEnterBG:
    	set $@KvM01BG_id2, waitingroom2bg("bat_c01",146,55,"KvM01_BG::OnCroixQuit","KvM01_BG::OnCroixDie");
    	end;
    }
    
    // Light Effects
    // *********************************************************************
    
    bat_c01,54,123,0	script	#bat_c01a	111,{
    	end;
    
    OnKvM01LightA: specialeffect EF_BEGINSPELL2; end;
    OnKvM01LightB: specialeffect EF_BEGINSPELL3; end;
    OnKvM01LightC: specialeffect EF_BEGINSPELL4; end;
    }
    
    bat_c01,56,125,0	duplicate(#bat_c01a)	#bat_c01b	111
    bat_c01,58,127,0	duplicate(#bat_c01a)	#bat_c01c	111
    bat_c01,141,56,0	duplicate(#bat_c01a)	#bat_c01d	111
    bat_c01,143,58,0	duplicate(#bat_c01a)	#bat_c01e	111
    bat_c01,145,60,0	duplicate(#bat_c01a)	#bat_c01f	111
    
    // Battleground Engine
    // *********************************************************************
    
    -	script	KvM01_BG	-1,{
    	end;
    
    OnInit:
    	setwall "bat_c01",54,122,6,7,0,"batc01wall_a";
    	setwall "bat_c01",55,122,5,7,0,"batc01wall_b";
    	setwall "bat_c01",140,56,6,7,0,"batc01wall_c";
    	setwall "bat_c01",140,57,5,7,0,"batc01wall_d";
    	disablenpc "TherapistKvM01a";
    	disablenpc "TherapistKvM01b";
    	disablenpc "VintenarKvM01a";
    	disablenpc "VintenarKvM01b";
    	end;
    
    OnGuillaumeJoin:
    OnCroixJoin:
    	donpcevent "KvM01_BG::OnReadyCheck";
    	end;
    
    OnGuillaumeQuit:
    	set BG_Delay_Tick, gettimetick(2) + 1200;
    OnGuillaumeDie:
    	if( $@KvM01BG == 2 )
    	{
    		set .Guillaume_Count, .Guillaume_Count - 1;
    		set .Croix_Score, .Croix_Score + 1;
    		bg_updatescore "bat_c01",.Guillaume_Score,.Croix_Score;
    		if( .Guillaume_Count < 1 ) donpcevent "KvM01_BG::OnCroixWin";
    	}
    	end;
    
    OnCroixQuit:
    	set BG_Delay_Tick, gettimetick(2) + 1200;
    OnCroixDie:
    	if( $@KvM01BG == 2 )
    	{
    		set .Croix_Count, .Croix_Count - 1;
    		set .Guillaume_Score, .Guillaume_Score + 1;
    		bg_updatescore "bat_c01",.Guillaume_Score,.Croix_Score;
    		if( .Croix_Count < 1 ) donpcevent "KvM01_BG::OnGuillaumeWin";
    	}
    	end;
    
    OnReadyCheck:
    	if( $@KvM01BG )
    		end;
    	set .@Guillaume, getwaitingroomstate(0,"KvM01R_Guillaume");
    	set .@Croix, getwaitingroomstate(0,"KvM01R_Croix");
    
    	if( .@Guillaume < 5 || .@Croix < 5 )
    	{
    		if( .@Guillaume > 3 && .@Croix > 3 && !agitcheck() && !agitcheck2() && $@KvM_Flood < gettimetick(2) )
    		{
    			announce "Battleground -- Kreiger Von Midgard [80-99] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",0,0x696969;
    			set $@KvM_Flood, gettimetick(2) + 15;
    		}
    		else
    			mapannounce "bat_room","Battleground -- Kreiger Von Midgard [80-99] G: " + .@Guillaume + "/5, C: " + .@Croix + "/5",1,0x696969;
    		end;
    	}
    
    	set $@KvM01BG, 1; // Starting
    	donpcevent "KvM01R_Croix::OnEnterBG";
    	donpcevent "KvM01R_Guillaume::OnEnterBG";
    	donpcevent "KvM01_BG::OnStart";
    	end;
    
    OnStart:
    	announce "Battleground -- Kreiger Von Midgard [80-99] has started!",0,0x696969;
    	enablenpc "TherapistKvM01a";
    	enablenpc "TherapistKvM01b";
    	disablenpc "VintenarKvM01a";
    	disablenpc "VintenarKvM01b";
    	set $@KvM01BG_Victory, 0;
    	sleep 2000;
    	// Warp Teams
    	bg_warp $@KvM01BG_id1,"bat_c01",53,128;
    	bg_warp $@KvM01BG_id2,"bat_c01",146,55;
    	// ScoreBoard
    	set .Guillaume_Score, 0;
    	set .Croix_Score, 0;
    	initnpctimer;
    	end;
    
    OnTimer5000:
    	areapercentheal "bat_c01",50,123,58,131,100,100;
    	areapercentheal "bat_c01",141,52,149,60,100,100;
    	mapannounce "bat_c01","The Battle will start in 25 seconds!!",1,0x696969;
    	end;
    
    OnTimer26000:
    	mapannounce "bat_c01","The Battle will start in 4 seconds!!",1,0x696969;
    	end;
    
    OnTimer27000:
    	donpcevent "::OnKvM01LightA";
    	end;
    
    OnTimer28000:
    	donpcevent "::OnKvM01LightB";
    	end;
    	
    OnTimer29000:
    	donpcevent "::OnKvM01LightC";
    	end;
    
    OnTimer30000:
    	// Team Members
    	set .Guillaume_Count, bg_get_data($@KvM01BG_id1, 0);
    	set .Croix_Count, bg_get_data($@KvM01BG_id2, 0);
    	if( .Guillaume_Count < 5 || .Croix_Count < 5 )
    	{
    		set $@KvM01BG_Victory, 3;
    		set $@KvM01BG, 3;
    		mapannounce "bat_c01","There are not enough players to start the battle",1,0x696969;
    		stopnpctimer;
    		sleep 2000;
    		donpcevent "KvM01_BG::OnStop";
    		end;
    	}
    
    	set $@KvM01BG, 2; // Playing
    	areapercentheal "bat_c01",50,123,58,131,100,100;
    	bg_warp $@KvM01BG_id1,"bat_c01",62,119;
    	areapercentheal "bat_c01",141,52,149,60,100,100;
    	bg_warp $@KvM01BG_id2,"bat_c01",137,64;
    	end;
    
    OnTimer32000:
    	mapannounce "bat_c01","The Battle of Kreiger Von Midgard has begun!!",1,0x696969;
    	end;
    
    OnTimer300000:
    	mapannounce "bat_c01","The Battle will ends in 30 seconds!!",1,0x696969;
    	end;
    
    OnTimer330000:
    	if( .Croix_Count > .Guillaume_Count )
    		donpcevent "KvM01_BG::OnCroixWin";
    	else if( .Croix_Count < .Guillaume_Count )
    		donpcevent "KvM01_BG::OnGuillaumeWin";
    	else
    	{ // Draw Game
    		set $@KvM01BG, 3;
    		set $@KvM01BG_Victory, 3;
    
    		stopnpctimer;
    		sleep 2000;
    		mapannounce "bat_c01","The time is out! This is a Tie...",1,0x696969;
    		donpcevent "KvM01_BG::OnStop";
    	}
    	end;
    
    OnGuillaumeWin:
    	set $@KvM01BG, 3;
    	set $@KvM01BG_Victory, 1;
    	
    	stopnpctimer;
    	sleep 2000;
    	mapannounce "bat_c01","The Guillaume Army has won the Battle of Kreiger Von Midgard",1,0x0000FF;
    	donpcevent "KvM01_BG::OnStop";
    	end;
    
    OnCroixWin:
    	set $@KvM01BG, 3;
    	set $@KvM01BG_Victory, 2;
    
    	stopnpctimer;
    	sleep 2000;
    	mapannounce "bat_c01","The Croix Army has won the Battle of Kreiger Von Midgard",1,0xFF0000;
    	donpcevent "KvM01_BG::OnStop";
    	end;
    
    OnStop:
    	disablenpc "TherapistKvM01a";
    	disablenpc "TherapistKvM01b";
    	enablenpc "VintenarKvM01a";
    	enablenpc "VintenarKvM01b";
    	// Warp Teams
    	bg_warp $@KvM01BG_id1,"bat_c01",53,128;
    	bg_warp $@KvM01BG_id2,"bat_c01",146,55;
    	donpcevent "KvM01_BG_Out::OnBegin";
    	end;
    
    OnReset:
    	stopnpctimer;
    	stopnpctimer "KvM01_BG_Out";
    	set .Croix_Count, 0;
    	set .Guillaume_Count, 0;
    	set .Croix_Score, 0;
    	set .Guillaume_Score, 0;
    	set $@KvM01BG_Victory, 0;
    	if( $@KvM01BG_id1 ) { bg_destroy $@KvM01BG_id1; set $@KvM01BG_id1, 0; }
    	if( $@KvM01BG_id2 ) { bg_destroy $@KvM01BG_id2; set $@KvM01BG_id2, 0; }
    	disablenpc "TherapistKvM01a";
    	disablenpc "TherapistKvM01b";
    	disablenpc "VintenarKvM01a";
    	disablenpc "VintenarKvM01b";
    	sleep 1000;
    	mapwarp "bat_c01","bat_room",155,150;
    	sleep 2000;
    	maprespawnguildid "bat_c01",0,3; // Just in case someone else
    	bg_updatescore "bat_c01",0,0;
    	sleep 2000;
    	set $@KvM01BG, 0;
    	donpcevent "KvM01_BG::OnReadyCheck"; // Maybe a game is ready to start
    	end;
    }
    
    -	script	KvM01_BG_Out	-1,{
    	end;
    
    OnBegin:
    	initnpctimer;
    	end;
    
    OnTimer3000:
    	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 1 minute!",1,0x696969;
    	end;
    OnTimer30000:
    	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 30 seconds!",1,0x696969;
    	end;
    OnTimer50000:
    	mapannounce "bat_c01","Battle of Kreiger Von Midgard will close in 10 seconds!",1,0x696969;
    	end;
    OnTimer60000:
    	donpcevent "KvM01_BG::OnReset";
    	end;
    }
    
    // Battleground Therapist
    // *********************************************************************
    
    bat_c01,51,130,5	script	Therapist in battle::TherapistKvM01a	95,{
    	mes "[Therapist in battle]";
    	mes "Just close your eyes, and take a deep breathe.";
    	mes "You can be free from pain.";
    	specialeffect2 EF_HEAL;
    	close;
    }
    
    bat_c01,148,53,1	script	Therapist in battle::TherapistKvM01b	95,{
    	mes "[Therapist in battle]";
    	mes "Just close your eyes, and take a deep breathe.";
    	mes "You can be free from pain.";
    	specialeffect2 EF_HEAL;
    	close;
    }
    
    // Battleground rewards
    // *********************************************************************
    
    bat_c01,51,130,5	script	Guillaume Vintenar::VintenarKvM01a	419,{
    	if( $@KvM01BG_Victory )
    	{
    		if( $@KvM01BG_Victory == 3 )
    		{
    			setquest 6025;
    			bg_leave;
    			warp "bat_room",155,150;
    			end;
    		}
    		else if( $@KvM01BG_Victory == Bat_Team )
    		{ // Victory
    			set .@Reward, 5;
    			mes "[Swandery]";
    			mes "Blessed Guillaume!!";
    			mes "Let's enjoy our glorious victory!";
    			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
    			close2;
    		}
    		else
    		{ // 
    			set .@Reward, 1;
    			mes "[Swandery]";
    			mes "You lost, but you're dedicated to this battle.";
    			mes "This is a reward for your great dedication by Guillaume Marollo!";
    			mes "Just take this defeat a lesson, and later you would definitely learn.";
    			close2;
    		}
    
    		setquest 6025;
    		getitem 7773, .@Reward;
    		bg_leave;
    		warp "bat_room",155,150;
    		end;
    	}
    	end;
    }
    
    bat_c01,148,53,1	script	Croix Vintenar::VintenarKvM01b	415,{
    	if( $@KvM01BG_Victory )
    	{
    		if( $@KvM01BG_Victory == 3 )
    		{
    			setquest 6025;
    			bg_leave;
    			warp "bat_room",155,150;
    			end;
    		}
    		else if( $@KvM01BG_Victory == Bat_Team )
    		{ // Victory
    			set .@Reward, 5;
    			mes "[Swandery]";
    			mes "Blessed Croax!!";
    			mes "Let's enjoy our glorious victory!";
    			mes "" + strcharinfo(0) + ", its a sign reflecting victory";
    			close2;
    		}
    		else
    		{ // 
    			set .@Reward, 1;
    			mes "[Swandery]";
    			mes "Oh, " + strcharinfo(0) + ". Don't be sad.";
    			mes "Even though we didn't win, we did our best.";
    			mes "This is a Royal gift from Croix, and please don't forget this battle. We can win the next.";
    			close2;
    		}
    
    		setquest 6025;
    		getitem 7773, .@Reward;
    		bg_leave;
    		warp "bat_room",155,150;
    		end;
    	}
    	end;
    }

    But when the bg end , the both team get the "not victory reward"

    kvmwin.PNG.c7d7b49901363a990309cb194c868717.PNGkvmwin2.PNG.8faa914865354221aa0eaa1f5a434c9c.PNGkvmwin3.PNG.29049db54ef9fa31cf640a5c9fad566e.PNG

×
×
  • Create New...