function script timeleft__ { .@left = getarg(0); if ( .@left <= 0 ) return getarg(0); .@day = .@left / 86400; .@hour = .@left % 86400 / 3600; .@min = .@left % 3600 / 60; .@sec = .@left % 60; if ( .@day ) return .@day +" day "+ .@hour +" hour"; else if ( .@hour ) return .@hour +" hour "+ .@min +" min"; else if ( .@min ) return .@min +" min "+ .@sec +" sec"; else return .@sec +" sec"; } //===== eAthena Script ===================================== //= Fight Your Clone //===== By: ================================================ //= Annieruru //===== Current Version: =================================== //= 2.0 //===== Compatible With: =================================== //= Hercules 2015-12-24 //===== Description: ======================================= //= kill as many clones as possible and get the most kills in ranking //===== Topic ============================================== //= http://hercules.ws/board/topic/4850-fight-your-clone/ //===== Additional Comments: =============================== //= nope, its not popular at all //========================================================== /* SQL Query alter table `char` add column clone_kills smallint(6) unsigned default 0, add index (clone_kills); */ prontera,155,180,0 script Fight Your Clone 1_F_MARIA,{ mes "["+ strnpcinfo(1) +"]"; mes "Do you want to prove yourself by fighting your own clones ?"; next; switch ( select ( "Yes", "View Ranking", ( getgmlevel() >= .gm_reset )? "Reset Ladder" : "" ) ) { case 1: if ( FYC_deny + .deny > gettimetick(2) ) { mes "["+ strnpcinfo(1) +"]"; mes "You can't play this game immediately."; mes "Have to wait "+ callfunc( "timeleft__", FYC_deny + .deny - gettimetick(2) ) +"."; close; } if ( has_instance2("guild_vs2") >= 0 ) instance_destroy has_instance2("guild_vs2"); if ( ( .@ins = instance_create( strnpcinfo(0), getcharid(3), IOT_CHAR ) ) < 0 ) { mes "error : "+ .@ins; close; } if ( !getstrlen( instance_attachmap( "guild_vs2", .@ins, 1, ( getcharid(3) - 2000000 )+"FYC" ) ) ) { mes "error : 5"; instance_destroy .@ins; close; } instance_set_timeout 3600, 15, .@ins; // 1 hour to kill, 15 seconds to destroy instance_attach .@ins; 'cid = getcharid(0); 'qid = queue(); queueopt 'qid, QUEUEOPT_DEATH, strnpcinfo(0) +"::OnDeath"; queueopt 'qid, QUEUEOPT_LOGOUT, strnpcinfo(0)+"::OnQuit"; queueopt 'qid, QUEUEOPT_MAPCHANGE, strnpcinfo(0)+"::OnMapChange"; queueadd 'qid, getcharid(3); instance_init .@ins; warp has_instance("guild_vs2"), 0,0; percentheal 100,100; FYC_deny = gettimetick(2); end; case 2: .@nb = query_sql( "select name, clone_kills from `char` where clone_kills > 0 order by clone_kills desc limit "+ .ladder_length, .@name$, .@clone_kills ); if ( !.@nb ) { mes "["+ strnpcinfo(1) +"]"; mes " "; mes "The Ranking currently is empty."; close; } for ( .@j = 0; .@j < .@nb; .@j += .show_per_page ) { mes "["+ strnpcinfo(1) +"]"; for ( .@i = .@j; .@i < ( .show_per_page + .@j ) && .@i < .@nb; .@i++ ) mes "^996600"+( .@i +1 )+". ^0000FF"+ .@name$[.@i] +" ^FF0000"+ .@clone_kills[.@i] +"^000000 Kill(s)"; if ( .@j + .show_per_page < .@nb ) next; else close; } close; case 3: mes "["+ strnpcinfo(1) +"]"; mes "Are you sure you want to reset this ladder ?"; if ( select ( "No", "Yes " ) == 1 ) close; query_sql "update `char` set clone_kills = 0"; mes " "; mes "The ladder has been reset"; close; } end; OnInit: if ( QUEUEOPT_MAPCHANGE != 3 ) end; // if your server is outdated, will see an error message .gm_reset = 99; // at which GM level can reset the ladder ? .ladder_length = 100; // display how many players in the ladder ? 100 = display top 100 players .show_per_page = 10; // show how many players in 1 page ? .deny = 30*60; // how many seconds to deny player from entering the room again ? 30*60 = 30 minutes end; OnMapChange: if ( @Queue_Destination_Map$ == has_instance("guild_vs2") ) end; OnQuit: instance_attach has_instance2("guild_vs2"); queuedel 'qid; end; OnDeath: instance_attach has_instance2("guild_vs2"); queuedel 'qid; announce strcharinfo(0) +" die at killing "+ 'evil_clone_killed +" clones", bc_map; getitem Poring_Coin, 'evil_clone_killed; // reward items based on how many clones were killed query_sql "update `char` set clone_kills = "+ 'evil_clone_killed +" where char_id = "+ getcharid(0) +" and clone_kills <= "+ 'evil_clone_killed; sleep2 10000; if ( strcharinfo(3) != has_instance("guild_vs2") ) end; warp "Save", 0,0; end; } guild_vs2,0,0,0 script FYC_instance_npc FAKE_NPC,{ OnInstanceInit: clone strnpcinfo(4), 0,0, instance_npcname( strnpcinfo(0) )+"::OnCloneKilled", 'cid, 0, 0x8D; end; OnCloneKilled: 'evil_clone_killed++; clone strnpcinfo(4), 0,0, instance_npcname( strnpcinfo(0) )+"::OnCloneKilled", 'cid, 0, 0x8D; clone strnpcinfo(4), 0,0, instance_npcname( strnpcinfo(0) )+"::OnCloneKilled", 'cid, 0, 0x8D; end; } guild_vs2 mapflag nosave SavePoint guild_vs2 mapflag nowarp guild_vs2 mapflag nowarpto guild_vs2 mapflag noreturn guild_vs2 mapflag noteleport guild_vs2 mapflag nomemo guild_vs2 mapflag nopenalty guild_vs2 mapflag nobranch guild_vs2 mapflag noicewall guild_vs2 mapflag src4instance guild_vs2 mapflag nochangeequip guild_vs2 mapflag pvp