Jump to content

n0tttt

Members
  • Posts

    303
  • Joined

  • Days Won

    12

Posts posted by n0tttt

  1. -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end;
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		set .@cid,getcharid(0);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			// Player 2.
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes.") == 2) {
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				close2;
    				attachrid @wait_duelaid;
    				// Player 1.
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("Não","Sim") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,true;
    					setmapflag .duel_map$,mf_pvp,false;
    					set .@first_id,getcharid(3);
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					set @duel,.@oid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					detachrid;
    					set .@i,30;
    					while(.@i > 0 && !.cancel) {
    						if(!(.@i % 10) || .@i < 6)
    							announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue;
    						sleep 1000;
    						set .@i,.@i - 1;
    					}
    					if(.@i || .cancel) {
    						announce "The Death Duel has been cancelled!",bc_all|bc_blue;
    						if(!isloggedin(.@oid) || !isloggedin(.@first_id))
    							announce "One of the participans logged out.",bc_all|bc_blue;
    						set .cancel,false;
                       			} else {
    						setmapflag .duel_map$,mf_pvp,true;
    						donpcevent "Duel_Death::OnStuck";
                        			}
    					end;
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			}
    			if(!.duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    					message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    					set .@id,@wait_duelaid;
    				}
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close2;
    				if(.@id) {
    					attachrid .@id;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    				}
    				end;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	close;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    			set .@id,@wait_duelaid;
    		}
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		if(.@id) {
    			attachrid .@id;
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    		set .cancel,true;
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			setoption 0x40,1;
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		announce rid2name(@duel)+" was deleted.",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		message strcharinfo(0),"Game Over";
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		set .cancel,true;
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,0;
    	end;
    
    OnStuck:
    
    	while(.@i < .time && .duel && !.cancel) {
    		sleep 5000;
    		set .@i,.@i + 5;
    	}
    	if(.cancel)
    		set .cancel,false;
    	if(.duel)
    		set .duel,false;
    	addrid 5,0,.duel_map$;
    	setoption 0x40,0;
    	if(!@duel)
    		atcommand "@rmvperm disable_pvp";
    	else
    		set @duel,0;
    	set .@i,5;
    	while(.@i) {
    		message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out.";
    		sleep2 1000;
    		set .@i,.@i - 1;
    	}
    	warp "prontera",156,161;
    	pcblockskill getcharid(3),0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"pvp_n_8-5";
    	// Coordinates
    	set .duel_xy$, "95,100,"+  // x,y first player
    		       "103,100";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*120;
    	end;
    
    }
    
    pvp_n_8-5	mapflag	pvp
    pvp_n_8-5	mapflag	pvp_nocalcrank
    pvp_n_8-5	mapflag	noreturn
    pvp_n_8-5	mapflag	nowarp
    pvp_n_8-5	mapflag	nocommand	99
    pvp_n_8-5	mapflag	nowarpto
    pvp_n_8-5	mapflag	nosave	SavePoint
    pvp_n_8-5	mapflag	nomemo
    pvp_n_8-5	mapflag	notrade
    pvp_n_8-5	mapflag	nodrop
    pvp_n_8-5	mapflag	nobranch
    pvp_n_8-5	mapflag	nochat
    pvp_n_8-5	mapflag	novending

    Let's see now.

    • MVP 1
  2. What about now?

    -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end;
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		set .@cid,getcharid(0);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			// Player 2.
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes.") == 2) {
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				close2;
    				attachrid @wait_duelaid;
    				// Player 1.
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("Não","Sim") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,true;
    					setmapflag .duel_map$,mf_pvp,false;
    					set .@first_id,getcharid(3);
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					set @duel,.@oid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					detachrid;
    					set .@i,30;
    					while(.@i > 0 && !.cancel && isloggedin(.@oid) && isloggedin(.@first_id)) {
    						if(!(.@i % 10) || .@i < 6)
    							announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue;
    						sleep 1000;
    						set .@i,.@i - 1;
    					}
    					if(.@i || .cancel) {
    						announce "The Death Duel has been cancelled!",bc_all|bc_blue;
    						if(!isloggedin(.@oid) || !isloggedin(.@first_id))
    							announce "One of the participans logged out.",bc_all|bc_blue;
    						set .cancel,0;
                       			} else {
    						setmapflag .duel_map$,mf_pvp,true;
    						donpcevent "Duel_Death::OnStuck";
                        			}
    					end;
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			}
    			if(!.duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    					message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    					set .@id,@wait_duelaid;
    				}
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close2;
    				if(.@id) {
    					attachrid .@id;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    				}
    				end;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	close;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    			set .@id,@wait_duelaid;
    		}
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		if(.@id) {
    			attachrid .@id;
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    		set .cancel,true;
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			setoption 0x40,1;
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		announce rid2name(@duel)+" was deleted.",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		message strcharinfo(0),"Game Over";
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		set .duel,false;
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,0;
    	end;
    
    OnStuck:
    
    	while(.@i < .time && .duel && !.cancel) {
    		sleep 5000;
    		set .@i,.@i + 5;
    	}
    	if(.cancel)
    		set .cancel,false;
    	if(.duel)
    		set .duel,false;
    	addrid 5,0,.duel_map$;
    	setoption 0x40,0;
    	if(!@duel)
    		atcommand "@rmvperm disable_pvp";
    	else
    		set @duel,0;
    	set .@i,5;
    	while(.@i) {
    		message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out.";
    		sleep2 1000;
    		set .@i,.@i - 1;
    	}
    	warp "prontera",156,161;
    	pcblockskill getcharid(3),0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"pvp_n_8-5";
    	// Coordinates
    	set .duel_xy$, "95,100,"+  // x,y first player
    		       "103,100";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*120;
    	end;
    
    }
    
    pvp_n_8-5	mapflag	pvp
    pvp_n_8-5	mapflag	pvp_nocalcrank
    pvp_n_8-5	mapflag	noreturn
    pvp_n_8-5	mapflag	nowarp
    pvp_n_8-5	mapflag	nocommand	99
    pvp_n_8-5	mapflag	nowarpto
    pvp_n_8-5	mapflag	nosave	SavePoint
    pvp_n_8-5	mapflag	nomemo
    pvp_n_8-5	mapflag	notrade
    pvp_n_8-5	mapflag	nodrop
    pvp_n_8-5	mapflag	nobranch
    pvp_n_8-5	mapflag	nochat
    pvp_n_8-5	mapflag	novending

     

    • MVP 1
  3. Well tell me how this one goes. I put the keywords var outside of OnInit, if it works it means OnInit wasn't being executed or something.

    //Morphogenic Hat Script
    //Allows a player to change their look to absolutely any hat available or to a defined upper limit. Check the "OnInit" label for information on this.
    //
    //By Slam
    
    -	script	Morpho	-1,{
    OnWhisperGlobal:
    	//Array of keywords for the script
    	setarray .@keywords$[0],"help","upper","middle","lower","clear","info","upperdawn","middledawn","lowerdawn";
    	set .@var0$, @whispervar0$;
    	set .@var1, atoi(@whispervar1$);
    	if(inarray(.morpho_disallowed, .@var1) != -1){
    		dispbottom "Sorry, you cannot change your Morpho into this headgear. Please try another.";
    		end;
    	}
    	set .@i,inarray(.@keywords$, .@var0$);
    	if(.@i == -1) {
    		dispbottom "---------------[Morpho Helper]---------------";
    		dispbottom " ";
    		dispbottom "Sorry, I didn't understand the option you have";
    		dispbottom "have given me. Please type 'help' for more info";
    		dispbottom " ";
    		end;
    	} else {
    		switch(.@i){
    
    		case 0:
    
    			goto help;
    
    		case 1:
    
    			goto tophead;
    
    		case 2:
    
    			goto midhead;
    
    		case 3:
    
    			goto lowhead;
    
    		case 4:
    
    			goto clear_h;
    
    		case 5:
    
    			goto info;
    
    		case 6:
    
    			goto topheadlow;
    		case 7:
    
    			goto midheadlow;
    
    		case 8:
    
    			goto lowheadlow;
    		}
    	}
    
    	help:
    
    		dispbottom "---------------[Morpho Helper]---------------";
    		dispbottom " ";
    		dispbottom "Welcome to the Morpho Settings NPC!";
    		dispbottom "I can help you set what your Morphohat looks like";
    		dispbottom " ";
    		dispbottom "To use this NPC, whisper NPC:Morpho (you should";
    		dispbottom "know this already) with upper/middle/lower or ";
    		dispbottom "wing. The wing section is not yet implemented";
    		dispbottom "however. Now, to set your Morphohat use the ";
    		dispbottom "following layout:";
    		dispbottom " ";
    		dispbottom "upper#5232 - This will make it a Pink Kitty";
    		dispbottom " ";
    		dispbottom "Protip: Use RateMyServer.net for item IDs.";
    		end;
    
    	tophead:
    
    		if(!isequipped(.top_morpho)){
    			goto wrong_headgear;
    		}
    		if((.@var1 >= 5001 && .@var1 <= 5859) || (.@var1 >= 60000 && .@var1 <= 61196)){
    			set .@viewid,getiteminfo(.@var1,11);
    			set .@equipslot,getiteminfo(.@var1,5);
    //			if(.@equipslot != 256 && .@equipslot != 768){ //Upper and Upper+Mid Only. Comment out this line and the two below it to remove this functionality.
    //				goto denied_wrongslot;
    //			}
    			set viewid_top,.@viewid;
    			dispbottom "Selected headgear ID: "+.@viewid;
    			setlook 4,.@viewid;
    			end;
    		}
    		dispbottom "Unavailable ID";
    		end;
    
    	midhead:
    
            if(!isequipped(.mid_morpho)){
                goto wrong_headgear;
            }
    	if((.@var1 >= 5001 && .@var1 <= 5859) || (.@var1 >= 60000 && .@var1 <= 61196)){
            	set .@viewid,getiteminfo(.@var1,11);
    		set .@equipslot,getiteminfo(.@var1,5);
    //        	if(.@equipslot != 512 && .@equipslot != 513){ //Mid and Mid+Lower only. Comment out this line and the two below it to remove this functionality.
    //           		goto denied_wrongslot;
    //        	}
            	set viewid_mid,.@viewid;
    		dispbottom "Selected headgear ID: "+.@viewid;
            	setlook 5,.@viewid;
    		end;
    	}
    	dispbottom "Unavailable ID";
    	end;
    
    	lowhead:
    
    	if(!isequipped(.low_morpho)){
    		goto wrong_headgear;
    	}
    	if((.@var1 >= 5001 && .@var1 <= 5859) || (.@var1 >= 60000 && .@var1 <= 61196)){
    		set .@viewid,getiteminfo(.@var1,11);
    		set .@equipslot,getiteminfo(.@var1,5);
    //		if(.@equipslot != 1){ // Lower Only. Comment out this line and the two below it to remove this functionality.
    //			goto denied_wrongslot;
    //		}
    		set viewid_low,.@viewid;
    		dispbottom "Selected headgear ID: "+.@viewid;
    		setlook 3,.@viewid;
    		end;
    	}
    	dispbottom "Unavailable ID";
    	end;
    
    	topheadlow:
    
    		if(!isequipped(.top_morphos)){
    			goto wrong_headgear;
    		}
    		if((.@var1 >= 5001 && .@var1 <= 5859) || (.@var1 >= 60000 && .@var1 <= 61196)){
    			set .@viewid,getiteminfo(.@var1,11);
    			set .@equipslot,getiteminfo(.@var1,5);
    //			if(.@equipslot != 256 && .@equipslot != 768){ //Upper and Upper+Mid Only. Comment out this line and the two below it to remove this functionality.
    //				goto denied_wrongslot;
    //			}
    			set viewid_tops,.@viewid;
    			dispbottom "Selected headgear ID: "+.@viewid;
    			setlook 4,.@viewid;
    			end;
    		}
    		dispbottom "Unavailable ID";
    		end;
    
    	midheadlow:
    	if((.@var1 >= 5001 && .@var1 <= 5859) || (.@var1 >= 60000 && .@var1 <= 61196)){
    		if(!isequipped(.mid_morphos)){
    			goto wrong_headgear;
    		}
            	set .@viewid,getiteminfo(.@var1,11);
    		set .@equipslot,getiteminfo(.@var1,5);
    //      	if(.@equipslot != 512){ // Lower Only. Comment out this line and the two below it to remove this functionality.
    //           		goto denied_wrongslot;
    //        	}
           		set viewid_mids,.@viewid;
    		dispbottom "Selected headgear ID: "+.@viewid;
            	setlook 5,.@viewid;
           		end;
    	}
    	dispbottom "Unavailable ID";
    	end;
    
    	lowheadlow:
    	if((.@var1 >= 5001 && .@var1 <= 5859) || (.@var1 >= 60000 && .@var1 <= 61196)){
            	if(!isequipped(.low_morphos)){
                 	goto wrong_headgear;
            	}
            	set .@viewid,getiteminfo(.@var1,11);
    		set .@equipslot,getiteminfo(.@var1,5);
    //      	if(.@equipslot != 1){ // Lower Only. Comment out this line and the two below it to remove this functionality.
    //          		 goto denied_wrongslot;
    //        	}
            	set viewid_lows,.@viewid;
    		dispbottom "Selected headgear ID: "+.@viewid;
            	setlook 3,.@viewid;
            	end;
    	}
    	dispbottom "Unavailable ID";
    	end;
    
    	clear_h:
    
    		set viewid_low, 1;
    		set viewid_mid, 2;
    		set viewid_top, 3;
    		if (getequipid(1) == .top_morpho)
    			setlook 5,0;
    		if (getequipid(9) == .mid_morpho)
    			setlook 4,0;
    		if (getequipid(10) == .low_morpho)
    			setlook 3,0;
    		dispbottom "Your Morphing Hats list has been cleared.";
    		end;
    
    	info:
    
    		dispbottom "---------------[Morpho Helper]---------------";
    		dispbottom " ";
    		dispbottom "You currently have the following items set for your Morpho hat:";
    		dispbottom "Upper - "+getitemname(viewid_top);
    		dispbottom "Middle - "+getitemname(viewid_mid);
    		dispbottom "Lower - "+getitemname(viewid_low);
    		end;
    
    	denied_wrongslot:
    		dispbottom "Sorry, this headgear was not designed for this headgear slot.";
    		end;
    
    	wrong_headgear:
    
    		dispbottom "Sorry, you do not currently have your Morpho equipped. Please equip it and try again!";
    
    		end;
    
    	OnInit:
    
    		//Change this to the upper limit of the headgears that you wish to make available
    		setarray .morpho_disallowed[0], 9001; //inb4OVERNINETHOUSAND
    
    		//Equip IDs - Change these to the ID numbers of the hat you wish to designate as the Morphing hat
    		set .top_morpho,60683;
    		set .mid_morpho,60684;
    		set .low_morpho,60685;
    		end;
    }
    
    //Use 'callfunc "MorphoEquip",<1,2,3>;' for the "OnEquip" script to let people know that they need to set the view ID or to set the viewid if the person has already set one.
    //If you wish to make the "Morph" an Account bound variable, simply change all instances of "viewid_" with "#viewid_"
    function	script	MorphoEquip	{
    	set .@equipslot,getarg(0);
    	switch(.@equipslot) {
    		case 1:  //Upper
    			if (!viewid_top) {
    				dispbottom "No headgear set for upper. PM \"NPC:Morpho\" with the word \"help\" for more information.";
    				end;
    			}
    			setlook LOOK_HEAD_TOP,viewid_top;
    			break;
    		case 2: //Mid
    			if (!viewid_mid) {
    				dispbottom "No headgear set for middle. PM \"NPC:Morpho\" with the word \"help\" for more information.";
    				end;
    			}
    			setlook LOOK_HEAD_MID,viewid_mid;
    			break;
    		case 3: //Lower
    			if (!viewid_low) {
    				dispbottom "No headgear set for lower. PM \"NPC:Morpho\" with the word \"help\" for more information.";
    				end;
    			}
    			setlook LOOK_HEAD_BOTTOM,viewid_low;
    			break;
        }
    }

     

  4. In the first post you specified it had 50% chance. We probably were reading different files, you the outdated skill.cpp and I the updated one, which includes the formula. So I interpreted as it was calculating 50% on a given context, and you wanted that context to go down to 20%, so it means you wanted 40% of the original formula, since 20 is the 40% of 50.

    It was a missunderstanding.

    • Upvote 1
  5. If you want a static 20% at lvl 5 change it to:

    Quote

    rate = 4 * skill_lv;

    If you want to reduce the formula to some % then use

    Quote

    rate = (2 * skill_lv + job_lv / 4 + sstatus->dex / 10) * efectiveness / 100; 

    and it will be efectiveness% chances of the original formula.

    It depends on how you want it to be.

  6. Just added that. Also added a few checks to try to avoid that message.

    -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end;
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes.") == 2) {
    				close2;
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				attachrid @wait_duelaid;
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("Não","Sim") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,true;
    					setmapflag .duel_map$,mf_pvp,false;
    					set .@first_id,getcharid(3);
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					set @duel,.@oid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					detachrid;
    					set .@i,30;
    					while(.@i > 0 && !.cancel && isloggedin(.@oid) && isloggedin(.@first_id)) {
    						if(!(.@i % 10) || .@i < 6)
    							announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue;
    						sleep 1000;
    						set .@i,.@i - 1;
    					}
    					if(.@i || .cancel) {
    						announce "The Death Duel has been cancelled!",bc_all|bc_blue;
    						if(!isloggedin(.@oid) || !isloggedin(.@first_id))
    							announce "One of the participans logged out.",bc_all|bc_blue;
    						set .cancel,0;
                       			} else {
    						setmapflag .duel_map$,mf_pvp,true;
    						donpcevent "Duel_Death::OnStuck";
                        			}
    					end;
    				} else {
    					message strcharinfo(0,@wait_duelcid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			}
    			if(!.duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    					message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    					set .@id,@wait_duelaid;
    				}
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close2;
    				if(.@id) {
    					attachrid .@id;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    				}
    				end;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	close;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    			set .@id,@wait_duelaid;
    		}
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		if(.@id) {
    			attachrid .@id;
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    		set .cancel,true;
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			setoption 0x40,1;
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		announce rid2name(@duel)+" was deleted.",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		message strcharinfo(0),"Game Over";
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		set .duel,false;
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,0;
    	end;
    
    OnStuck:
    
    	while(.@i < .time && .duel && !.cancel) {
    		sleep 5000;
    		set .@i,.@i + 5;
    	}
    	if(.cancel)
    		set .cancel,false;
    	if(.duel)
    		set .duel,false;
    	addrid 5,0,.duel_map$;
    	setoption 0x40,0;
    	if(!@duel)
    		atcommand "@rmvperm disable_pvp";
    	else
    		set @duel,0;
    	set .@i,5;
    	while(.@i) {
    		message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out.";
    		sleep2 1000;
    		set .@i,.@i - 1;
    	}
    	warp "prontera",156,161;
    	pcblockskill getcharid(3),0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"pvp_n_8-5";
    	// Coordinates
    	set .duel_xy$, "95,100,"+  // x,y first player
    		       "103,100";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*120;
    	end;
    
    }
    
    pvp_n_8-5	mapflag	pvp
    pvp_n_8-5	mapflag	pvp_nocalcrank
    pvp_n_8-5	mapflag	noreturn
    pvp_n_8-5	mapflag	nowarp
    pvp_n_8-5	mapflag	nocommand	99
    pvp_n_8-5	mapflag	nowarpto
    pvp_n_8-5	mapflag	nosave	SavePoint
    pvp_n_8-5	mapflag	nomemo
    pvp_n_8-5	mapflag	notrade
    pvp_n_8-5	mapflag	nodrop
    pvp_n_8-5	mapflag	nobranch
    pvp_n_8-5	mapflag	nochat
    pvp_n_8-5	mapflag	novending

     

  7. I fixed the first thing after editing the post. I added a close2 to the menu now. Tell me how it goes. And addrid lacked a parameter. Damn.

    -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end;
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes.") == 2) {
    				close2;
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				attachrid @wait_duelaid;
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("Não","Sim") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,true;
    					setmapflag .duel_map$,mf_pvp,false;
    					set .@first_id,getcharid(3);
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					set @duel,.@oid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					detachrid;
    					set .@i,30;
    					while(.@i > 0 && !.cancel && isloggedin(.@oid) && isloggedin(.@first_id)) {
    						if(!(.@i % 10) || .@i < 6)
    							announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue;
    						sleep 1000;
    						set .@i,.@i - 1;
    					}
    					if(.@i || .cancel) {
    						announce "The Death Duel has been cancelled!",bc_all|bc_blue;
    						if(!isloggedin(.@oid) || !isloggedin(.@first_id))
    							announce "One of the participans logged out.",bc_all|bc_blue;
    						set .cancel,0;
                       			} else {
    						setmapflag .duel_map$,mf_pvp,true;
    						donpcevent "Duel_Death::OnStuck";
                        			}
    					end;
    				}
    			}
    			if(!.duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    				set .@id,@wait_duelaid;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close2;
    				attachrid .@id;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				end;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	close;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    		set .@id,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		attachrid .@id;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		set .cancel,true;
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			setoption 0x40,1;
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		announce rid2name(@duel)+" was deleted.",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		message strcharinfo(0),"Game Over";
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		set .duel,false;
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,0;
    	end;
    
    OnStuck:
    
    	while(.@i < .time && .duel && !.cancel) {
    		sleep 5000;
    		set .@i,.@i + 5;
    	}
    	if(.cancel)
    		set .cancel,false;
    	if(.duel)
    		set .duel,false;
    	addrid 5,0,.duel_map$;
    	setoption 0x40,0;
    	if(!@duel)
    		atcommand "@rmvperm disable_pvp";
    	else
    		set @duel,0;
    	set .@i,5;
    	while(.@i) {
    		message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out.";
    		sleep2 1000;
    		set .@i,.@i - 1;
    	}
    	warp "prontera",156,161;
    	pcblockskill getcharid(3),0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"pvp_n_8-5";
    	// Coordinates
    	set .duel_xy$, "95,100,"+  // x,y first player
    		       "103,100";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*120;
    	end;
    
    }
    
    pvp_n_8-5	mapflag	pvp
    pvp_n_8-5	mapflag	pvp_nocalcrank
    pvp_n_8-5	mapflag	noreturn
    pvp_n_8-5	mapflag	nowarp
    pvp_n_8-5	mapflag	nocommand	99
    pvp_n_8-5	mapflag	nowarpto
    pvp_n_8-5	mapflag	nosave	SavePoint
    pvp_n_8-5	mapflag	nomemo
    pvp_n_8-5	mapflag	notrade
    pvp_n_8-5	mapflag	nodrop
    pvp_n_8-5	mapflag	nobranch
    pvp_n_8-5	mapflag	nochat
    pvp_n_8-5	mapflag	novending

     

  8. Okay, so I added a message for when one of them log outs. It should cancel the duel and say it. That message should only appear if one uses @reject or one of the characters logs out. Also I think I fixed the menu.

    -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end;
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes.") == 2) {
    				close2;
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				attachrid @wait_duelaid;
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("Não","Sim") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,1;
    					//close2;
    					setmapflag .duel_map$,mf_pvp,false;
    					set .@first_id,getcharid(3);
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					set @duel,.@oid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					detachrid;
    					set .@i,30;
    					while(.@i > 0 && !.cancel && isloggedin(.@oid) && isloggedin(.@first_id)) {
    						if(!(.@i % 10) || .@i < 6)
    							announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue;
    						sleep 1000;
    						set .@i,.@i - 1;
    					}
    					if(.@i || .cancel) {
    						announce "The Death Duel has been cancelled!",bc_all|bc_blue;
    						if(!isloggedin(.@oid) || !isloggedin(.@first_id))
    							announce "One of the participans logged out.",bc_all|bc_blue;
    						set .cancel,0;
                       			} else {
    						setmapflag .duel_map$,mf_pvp,true;
    						donpcevent "Duel_Death::OnStuck";
                        			}
    					end;
    				}
    			}
    			if(!@duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    				set .@id,@wait_duelaid;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				attachrid .@id;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	close;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    		set .@id,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		attachrid .@id;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		set .cancel,1;
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			setoption 0x40,1;
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		announce rid2name(@duel)+" was deleted.",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		message strcharinfo(0),"Game Over";
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		set .duel,0;
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,0;
    	end;
    
    OnStuck:
    
    	while(.@i < .time && .duel && !.cancel) {
    		sleep 5000;
    		set .@i,.@i + 5;
    	}
    	if(.cancel)
    		set .cancel,0;
    	if(.duel)
    		set .duel,0;
    	addrid 5,.duel_map$;
    	setoption 0x40,0;
    	if(!@duel)
    		atcommand "@rmvperm disable_pvp";
    	else
    		set @duel,0;
    	set .@i,5;
    	while(.@i) {
    		message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out.";
    		sleep2 1000;
    		set .@i,.@i - 1;
    	}
    	warp "SavePoint",0,0;
    	pcblockskill getcharid(3),0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"pvp_n_8-5";
    	// Coordinates
    	set .duel_xy$, "95,100,"+  // x,y first player
    		       "103,100";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*120;
    	end;
    
    }
    
    pvp_n_8-5	mapflag	pvp
    pvp_n_8-5	mapflag	pvp_nocalcrank
    pvp_n_8-5	mapflag	noreturn
    pvp_n_8-5	mapflag	nowarp
    pvp_n_8-5	mapflag	nocommand	99
    pvp_n_8-5	mapflag	nowarpto
    pvp_n_8-5	mapflag	nosave	SavePoint
    pvp_n_8-5	mapflag	nomemo
    pvp_n_8-5	mapflag	notrade
    pvp_n_8-5	mapflag	nodrop
    pvp_n_8-5	mapflag	nobranch
    pvp_n_8-5	mapflag	nochat
    pvp_n_8-5	mapflag	novending

     

  9. Yes, the announcement is right. I removed it now since if it's appears then the label is being executed.

    So it's starting to work. Nice.

    -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			dispbottom .@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end;
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes.") == 2) {
    				close2;
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				attachrid @wait_duelaid;
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("Não","Sim") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce strcharinfo(0)+" e "+rid2name(.@oid)+" gonna make a Death Duel where the loser get's his character deleted!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,1;
    					//close2;
    					setmapflag .duel_map$,mf_pvp,false;
    					set .@first_id,getcharid(3);
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					set @duel,.@oid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					setoption 0x40,0;
    					detachrid;
    					set .@i,30;
    					while(.@i > 0 && !.cancel && isloggedin(.@oid) && isloggedin(.@first_id)) {
    						if(!(.@i % 10) || .@i < 6)
    							announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" vs "+rid2name(.@oid)+"!",bc_all|bc_blue;
    						sleep 1000;
    						set .@i,.@i - 1;
    					}
    					if(.@i || .cancel) {
    						announce "The Death Duel has been cancelled!",bc_all|bc_blue;
    						set .cancel,0;
                       			} else {
    						setmapflag .duel_map$,mf_pvp,true;
    						donpcevent "Duel_Death::OnStuck";
                        			}
    				}
    			}
    			if(!@duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    				set .@id,@wait_duelaid;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				attachrid .@id;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    		set .@id,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		attachrid .@id;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		set .cancel,1;
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			setoption 0x40,1;
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		announce rid2name(@duel)+" was deleted.",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		message strcharinfo(0),"Game Over";
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		.duel = 0;
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,0;
    	end;
    
    OnStuck:
    
    	while(.@i < .time && .duel) {
    		sleep2 5000;
    		.@i+= 5;
    	}
    	addrid 5,.duel_map$;
    	setoption 0x40,0;
    	if(!@duel)
    		atcommand "@rmvperm disable_pvp";
    	else
    		set @duel,0;
    	set .@i,5;
    	while(.@i) {
    		message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out.";
    		sleep2 1000;
    		set .@i,.@i - 1;
    	}
    	warp "SavePoint",0,0;
    	pcblockskill getcharid(3),0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"pvp_n_8-5";
    	// Coordinates
    	set .duel_xy$, "95,100,"+  // x,y first player
    		       "103,100";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*120;
    	end;
    
    }
    
    pvp_n_8-5	mapflag	pvp
    pvp_n_8-5	mapflag	pvp_nocalcrank
    pvp_n_8-5	mapflag	noreturn
    pvp_n_8-5	mapflag	nowarp
    pvp_n_8-5	mapflag	nocommand	99
    pvp_n_8-5	mapflag	nowarpto
    pvp_n_8-5	mapflag	nosave	SavePoint
    pvp_n_8-5	mapflag	nomemo
    pvp_n_8-5	mapflag	notrade
    pvp_n_8-5	mapflag	nodrop
    pvp_n_8-5	mapflag	nobranch
    pvp_n_8-5	mapflag	nochat
    pvp_n_8-5	mapflag	novending

     

  10. Change:

    Quote

                getitem .@q[0],.@q[2];


    to:
     

    Quote

            if(@shop_index == <your rental shop number>)
                rentitem .@q[0],<rental time>;
            else
                getitem .@q[0],.@q[2];

    And don't forget to put the name here:

    Quote

        setarray .Shops$[1],
            "Headgears",    // Shop Named 1
            "Weapons",        // Shop Named 2
            "Other";        // Shop Named 3

    Something like [Rental] Headgears

    • MVP 1
  11. Nice catch that @. Fixed it.

    I added a debug announce to check if the OnStuck label gets initiated or not, because that's what handles the warping everyone out of the duel. rAthena has some problems with multiprocessing so sometimes donpcevent doesn't work if I remember correctly.

    -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end,
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes.") == 2) {
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				close2;
    				attachrid @wait_duelaid;
    				doevent "Death_Duel::OnSecondAsk";
    			} else {
    				message strcharinfo(0),"The duel has been cancelled.";
    				message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    				set .@id,@wait_duelaid;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				attachrid .@id;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSecondAsk:
    
    	mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    	if(select("No.","Yes.") == 2) {
    		set .@second_id,@wait_duelaid;
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has accepted the duel.";
    		announce "There'll be a Death Duel between "+strcharinfo(0)+" and "+rid2name(.@second_id)+"!",bc_all|bc_blue;
    		announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    		set .duel,1;
    		close2;
    		setmapflag .duel_map$,mf_pvp,false;
    		set .@first_id,getcharid(3);
    		explode .@xy$,.duel_xy$,",";
    		set .@r,rand(2);
    		set @duel,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    		setoption 0x40,0;
    		attachrid .@second_id;
    		set @duel,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		set .@r,!.@r;
    		warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    		setoption 0x40,0;
    		detachrid;
    		set .@i,60;
    		while(.@i > 0 && !.cancel) {
    			if(!(.@i % 5) || .@i < 5)
    				announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" and "+rid2name(.@second_id)+"!",bc_all|bc_blue;
    			sleep 1000;
    			set .@i,.@i - 1;
    		}
    		if(.@i) {
    			announce "The Death Duel has been cancelled!",bc_all|bc_blue;
    			set .cancel,0;
    		} else {
    			setmapflag .duel_map$,mf_pvp,true;
    			donpcevent "Duel_Death::OnStuck";
    		}
    	} else {
    		message strcharinfo(0),"The duel has been cancelled.";
    		message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    		set .@id,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		attachrid .@id;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		close;
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    		set .@id,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		attachrid .@id;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		set .cancel,1;
    		awake "Death_Duel";
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			setoption 0x40,1;
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    		awake "Death_Duel";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		awake "Death_Duel";
    	end;
    
    OnStuck:
    
    	announce "donpcevent OnStuck succesful label.",bc_all;
    	sleep .time*1000;
    	if(.duel) {
    		set .duel,0;
    		addrid 5,.duel_map$;
    		setoption 0x40,0;
    		if(!@duel)
    			atcommand "@rmvperm disable_pvp";
    		else
    			set @duel,0;
    		set .@i,5;
    		while(.@i) {
    			message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out.";
    			sleep2 1000;
    			set .@i,.@i - 1;
    		}
    		warp "SavePoint",0,0;
    		pcblockskill getcharid(3),0;
    	}
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"map"; //put the map name where you want to Death Duel happens.
    	// Coordinates
    	set .duel_xy$, "x,y,"+  // x,y first player
    		       "x,y";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*60;
    	end;
    
    }
    
    //change the "map"s below to the same mape you've put on OnInit.
    
    map	mapflag	pvp
    map	mapflag	pvp_nocalcrank
    map	mapflag	noreturn
    map	mapflag	nowarp
    map	mapflag	nocommand	99
    map	mapflag	nowarpto
    map	mapflag	nosave	SavePoint
    map	malflag	nomemo
    map	mapflag	notrade
    map	mapflag	nodrop
    map	mapflag	nobranch
    map	mapflag	nochat
    map	mapflag	novending

    If it doesn't work, here's the one without donpcevent:

    -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			message strcharinfo(0),.@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end,
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes.") == 2) {
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				close2;
    				attachrid @wait_duelaid;
    				doevent "Death_Duel::OnSecondAsk";
    			} else {
    				message strcharinfo(0),"The duel has been cancelled.";
    				message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    				set .@id,@wait_duelaid;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				attachrid .@id;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSecondAsk:
    
    	mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    	if(select("No.","Yes.") == 2) {
    		set .@second_id,@wait_duelaid;
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has accepted the duel.";
    		announce "There'll be a Death Duel between "+strcharinfo(0)+" and "+rid2name(.@second_id)+"!",bc_all|bc_blue;
    		announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    		set .duel,1;
    		close2;
    		setmapflag .duel_map$,mf_pvp,false;
    		set .@first_id,getcharid(3);
    		explode .@xy$,.duel_xy$,",";
    		set .@r,rand(2);
    		set @duel,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    		setoption 0x40,0;
    		attachrid .@second_id;
    		set @duel,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		set .@r,!.@r;
    		warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    		setoption 0x40,0;
    		detachrid;
    		set .@i,60;
    		while(.@i > 0 && !.cancel) {
    			if(!(.@i % 5) || .@i < 5)
    				announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" and "+rid2name(.@second_id)+"!",bc_all|bc_blue;
    			sleep 1000;
    			set .@i,.@i - 1;
    		}
    		if(.@i) {
    			announce "The Death Duel has been cancelled!",bc_all|bc_blue;
    			set .cancel,0;
    		} else {
    			setmapflag .duel_map$,mf_pvp,true;
    			sleep .time*1000;
    			if(.duel) {
    				set .duel,0;
    				addrid 5,.duel_map$;
    				setoption 0x40,0;
    				if(!@duel)
    					atcommand "@rmvperm disable_pvp";
    				else
    					set @duel,0;
    				set .@i,5;
    				while(.@i) {
    					message strcharinfo(0),.@i+" second"+((.@i > 1)? "s" : "")+" to warp you out.";
    					sleep2 1000;
    					set .@i,.@i - 1;
    				}
    				warp "SavePoint",0,0;
    				pcblockskill getcharid(3),0;
    			}
    		}
    	} else {
    		message strcharinfo(0),"The duel has been cancelled.";
    		message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    		set .@id,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		attachrid .@id;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		close;
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    		set .@id,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		attachrid .@id;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		set .cancel,1;
    		awake "Death_Duel";
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			setoption 0x40,1;
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .@char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    		awake "Death_Duel";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		awake "Death_Duel";
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"map"; //put the map name where you want to Death Duel happens.
    	// Coordinates
    	set .duel_xy$, "x,y,"+  // x,y first player
    		       "x,y";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*60;
    	end;
    
    }
    
    //change the "map"s below to the same mape you've put on OnInit.
    
    map	mapflag	pvp
    map	mapflag	pvp_nocalcrank
    map	mapflag	noreturn
    map	mapflag	nowarp
    map	mapflag	nocommand	99
    map	mapflag	nowarpto
    map	mapflag	nosave	SavePoint
    map	malflag	nomemo
    map	mapflag	notrade
    map	mapflag	nodrop
    map	mapflag	nobranch
    map	mapflag	nochat
    map	mapflag	novending

     

  12. Damn, this is what happens when you don't have a test server.

    -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			dispbottom .@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end,
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes") == 2) {
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				attachrid @wait_duelaid;
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("No.","Yes") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce "There'll be a Death Duel between "+strcharinfo(0)+" and "+rid2name(.@oid)+"!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,1;
    					//close2;
    					setmapflag .duel_map$,mf_pvp,false;
    					set .@first_id,getcharid(3);
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					set @duel,.@oid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					detachrid;
    					set .@i,60;
    					while(.@i > 0) {
    						if(!(.@i % 5) || .@i < 5)
    							announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" and "+rid2name(.@oid)+"!",bc_all|bc_blue;
    						sleep 1000;
    						set .@i,.@i - 1;
    					}
    					if(.@i) {
    						announce "The Death Duel has been cancelled!",bc_all|bc_blue;
                        } else {
    						setmapflag .duel_map$,mf_pvp,true;
    						donpcevent "Duel_Death::OnStuck";
                        }
    				}
    			}
    			if(!@duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    				set .@id,@wait_duelaid;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				attachrid .@id;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				close;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    		set .@id,@wait_duelaid;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		attachrid .@id;
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    		awake "Death_Duel";
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(@duel) {
    		message strcharinfo(0),"You're part of the duel.";
    	} else if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			atcommand "@hide";
    			atcommand "@addperm disable_pvp";
    			pcblockskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    		awake "Death_Duel";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel)
    		awake "Death_Duel";
    	end;
    
    OnStuck:
    
    	sleep .time*1000;
    	if(.duel) {
    		set .duel,0;
    		addrid 5,.duel_map$;
    		warp "prontera",156,161;
    		if(!@duel) {
    			atcommand "@hide";
    			atcommand "@rmvperm disable_pvp";
    		}
    		set @duel,0;
    		pcblockskill getcharid(3),0;
    	}
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"map"; //put the map name where you want to Death Duel happens.
    	// Coordinates
    	set .duel_xy$, "x,y,"+  // x,y first player
    		       "x,y";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*60;
    	end;
    
    }
    
    //change the "map"s below to the same mape you've put on OnInit.
    
    map	mapflag	pvp
    map	mapflag	pvp_nocalcrank
    map	mapflag	noreturn
    map	mapflag	nowarp
    map	mapflag	nocommand	99
    map	mapflag	nowarpto
    map	mapflag	nosave	SavePoint
    map	malflag	nomemo
    map	mapflag	notrade
    map	mapflag	nodrop
    map	mapflag	nobranch
    map	mapflag	nochat
    map	mapflag	novending

    I think I adressed most of the things you said. I had a typo with using @duel instead of @wait_duelaid, I now also removed the pvp mapflag until it all starts. The message of the permission was because it was also trying to remove the permission from the participans. It'll now only remove it from spectators. The countdown has been changed to what you say. I added the close button. I fixed the warpings and added a mapwarp to send all the people to Prontera. Sorry for this mess... I made you test a lot.

    The @hide after relog should need more test, as far as I remember, using @hide lasts for the session. Might need an extra check like:

    Quote

    OnPCLoginEvent:

        if(checkoption(0x40) && getgmlevel() < 60)
            setoption 0x40,0;
        end;

     

  13. -	script	Duel_Death	-1,{
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You're already waiting for a confirmation. Relog to cancel.";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			set @wait_duelaid,.@aid;
    			set @wait_duelaid,.@cid;
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			dispbottom .@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end,
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes") == 2) {
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				attachrid @duel;
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("No.","Yes") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce "There'll be a Death Duel between "+strcharinfo(0)+" and "+rid2name(.@oid)+"!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,1;
    					close2;
    					set .@i,60;
    					set .@first_id,getcharid(3);
    					detachrid;
    					while(.@i > 0) {
    						if(!(.@i % 5) || .@i < 5)
    							announce .@i+" seconds for the duel between "+rid2name(.@first_id)+" and "+rid2name(.@oid)+"!",bc_all|bc_blue;
    						sleep 1000;
    						set .@i,.@i - 1;
    					}
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					attachrid .@first_id;
    					set @duel,.@oid;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					donpcevent "Duel_Death::OnStuck";
    				}
    			}
    			if(!@duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    				set .@aid,@wait_duelaid;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				attachrid .@aid;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strhcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			atcommand "@hide";
    			atcommand "@addperm disable_pvp";
    			pcblocskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel,0;
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    		awake "Death_Duel";
    		addrid 5,.duel_map$;
    		if(!@duel)
    			atcommand "@hide";
    		set @duel,0;
    		atcommand "@rmvperm disable_pvp";
    		pcblocskill getcharid(3),0;
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel) {
    		set .duel,0;
    		attachrid @duel;
    		set @duel,0;
    	}
    	end;
    
    OnStuck:
    
    	sleep .time*1000;
    	if(.duel)
    		set .duel,0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"map";
    	// Coordinates
    	set .duel_xy$, "x,y,"+  // x,y first player
    		       "x,y";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*60;
    	end;
    
    }
    
    map	mapflag	pvp
    map	mapflag	pvp_nocalcrank
    map	mapflag	noreturn
    map	mapflag	nowarp
    map	mapflag	nocommand 99
    map	mapflag	nowarpto
    map	mapflag	nosave SavePoint
    map	malflag	nomemo
    map	mapflag	notrade
    map	mapflag	nodrop
    map	mapflag	nobranch
    map	mapflag	nochat
    map	mapflag	novending

    Tell me what you think.

    • Upvote 1
  14. I did some of the things you listed. As I said, I can't test because I don't have a test server. I added some configs for a map with different locations, and a spectate command, to make it more epic. Change the mapflags to your desired map.

    I could do it as an atcommand in source, but that would require even more testing.

    -	script	Duel_Death	-1,{
    	end;
    
    OnCommand:
    
    	if(.duel) {
    		message strcharinfo(0),"There is a duel going on right now. Wait for it to finish.";
    	} else if(.duel_delay > gettimetick(2)) {
    		message strcharinfo(0),"There's a global delay between duels. You have to wait "+Time2Str(.duel_delay)+".";
    	} else {
    		set .@player$,strcharinfo(0);
    		set .@oid,getcharid(3);
    		set .@enemy$,implode(.@atcmd_parameters$," ");
    		set .@aid,getcharid(3,.@enemy$);
    		set .@cid,getcharid(0,.@enemy$);
    		if(!.@aid) {
    			message strcharinfo(0),"That character is not online.";
    		} else if(getvar(@duel,.@cid)) {
    			message strcharinfo(0),"That character is already in a duel.";
    		} else {
    			message strcharinfo(0),"Proposition sent. Wait for him/her to accept or reject.";
    			attachrid .@aid;
    			set @wait_duelaid,.@oid;
    			set @wait_duelcid,getcharid(0,.@player$);
    			dispbottom .@player$+" wants to have a Death Duel with you. Use @acceptdd to accept it or @rejectdd to reject it.";
    		}
    	}
    	end,
    
    OnAccept:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    			mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    			if(select("No.","Yes") == 2) {
    				message strcharinfo(0),"You accepted the duel. Prepare yourself.";
    				attachrid @duel;
    				mes "Are you really sure about this duel? ^ff0000Your character will be deleted^000000";
    				if(select("No.","Yes") == 2) {
    					message strcharinfo(0),rid2name(.@oid)+" has accepted the duel.";
    					announce "There'll be a Death Duel between "+strcharinfo(0)+" and "+rid2name(.@oid)+"!",bc_all|bc_blue;
    					announce "If you want to spectate use @spectatedd",bc_all|bc_blue;
    					set .duel,1;
    					close2;
    					sleep2 20000;
    					explode .@xy$,.duel_xy$,",";
    					set .@r,rand(2);
    					set @duel,.@oid;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					attachrid .@oid;
    					set @duel,@wait_duelaid;
    					set @wait_duelaid,0;
    					set @wait_duelcid,0;
    					set .@r,!.@r;
    					warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    					donpcevent "Duel_Death::OnStuck";
    				}
    			}
    			if(!@duel) {
    				message strcharinfo(0),"The duel has been cancelled.";
    				message strcharinfo(0,@wait_duelcid),"The duel has been cancelled.";
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    			}
    		} else {
    			message strcharinfo(0),"The character who challenged you is now offline.";
    			set @wait_duelaid,0;
    			set @wait_duelcid,0;
    		}
    	} else {
    		message strhcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@wait_duelaid) {
    		message strcharinfo(0),"You rejected the duel.";
    		message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    		set @wait_duelaid,0;
    		set @wait_duelcid,0;
    	} else {
    		message strcharinfo(0),"You haven't been challenged to a duel.";
    	}
    	end;
    
    OnSpectate:
    
    	if(.duel) {
    		if(strcharinfo(3) == .duel_map$) {
    			message strcharinfo(0),"You're already in the map.";
    		} else {
    			atcommand "@hide";
    			atcommand "@addperm disable_pvp";
    			pcblocskill getcharid(3),1;
    			warp .duel_map$,0,0;
    		}
    	} else {
    		message strcharinfo(0),"There isn't a duel right now.";
    	}
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel,0;
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .@oid,getcharid(3);
    		announce strcharinfo(0)+" has won a Death Duel against "+rid2name(@duel)+"!",bc_all|bc_blue;
    		attachrid @duel;
    		setarray .@char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    		set .@deadplayer,getcharid(0);
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .@char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    		attachrid .@oid;
    		awake "Death_Duel";
    		addrid 5,.duel_map$;
    		if(!@duel)
    			atcommand "@hide";
    		set @duel,0;
    		atcommand "@rmvperm disable_pvp";
    		pcblocskill getcharid(3),0;
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel) {
    		set .duel,0;
    		attachrid @duel;
    		set @duel,0;
    	}
    	end;
    
    OnStuck:
    
    	sleep .time*1000;
    	if(.duel)
    		set .duel,0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"map";
    	// Coordinates
    	set .duel_xy$, "x,y,"+  // x,y first player
    		       "x,y";   // x,y second player
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "acceptdd","Duel_Death::OnAccept";
    	bindatcmd "rejectdd","Duel_Death::OnReject";
    	bindatcmd "spectatedd","Duel_Death::OnSpectate";
    
    	// Max duration of a duel (seconds).
    	set .time,10*60;
    	end;
    
    }
    
    map	mapflag	pvp
    map	mapflag	pvp_nocalcrank
    map	mapflag	noreturn
    map	mapflag	nowarp
    map	mapflag	nocommand 99
    map	mapflag	nowarpto
    map	mapflag	nosave SavePoint
    map	malflag	nomemo
    map	mapflag	notrade
    map	mapflag	nodrop
    map	mapflag	nobranch
    map	mapflag	nochat
    map	mapflag	novending

     

  15. Maybe with the guardian command?

    *guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
    
    This command is roughly equivalent to 'monster', but is meant to be used with
    castle guardian monsters and will only work with them. It will set the guardian
    characteristics up according to the castle's investment values and otherwise
    set the things up that only castle guardians need.
    
    Since trunk r12524:
    Returns the id of the mob or 0 if an error occurred.
    When 'guardian index' isn't supplied it produces a temporary guardian.
    Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.

    Then you can have an event with the id of the guild in a variable.

    OnGuardianDead:
    
    	if(getcharid(2) == .guild_id) {
    		// penalty
    	}

    You can create a custom emperium but you'll need to edit the source if you want it to have all the things a normal emperium has like inmunity to most skills. Use a text editor like Notepad++ or Sublime Text with the "search in folder" option and look for all the instances of MOBID_EMPERIUM in the src/map folder. Then add

    Quote

    || status_get_class(bl) == MOBID_EMPERIUM2

    For example.

    Then you add it under

    Quote

        MOBID_EMPERIUM            = 1288,

    on mob.hpp

    Anyways you can base your event on: https://github.com/rathena/rathena/blob/master/npc/custom/battleground/bg_emp.txt

    or this: http://herc.ws/board/topic/4495-king-of-emperium-hill/

  16. This is the one which comes on rAthena modified:

    //===== rAthena Script =======================================
    //= Healer
    //===== By: ==================================================
    //= Euphy
    //===== Current Version: =====================================
    //= 1.1
    //===== Compatible With: =====================================
    //= rAthena Project
    //===== Description: =========================================
    //= Basic healer script.
    //===== Additional Comments: =================================
    //= 1.0 Initial script.
    //= 1.1 Aligned coordinates with @go.
    //============================================================
    
    -	script	Healer	-1,{
    
    OnTouch:
    
    	.@Price = 0;	// Zeny required for heal
    	.@Buffs = 1;	// Also buff players? (1: yes / 0: no)
    	.@Delay = 0;	// Heal delay, in seconds
    
    	if (@HD > gettimetick(2))
    		end;
    	if (.@Price) {
    		message strcharinfo(0), "Healing costs " + callfunc("F_InsertComma",.@Price) + " Zeny.";
    		if (Zeny < .@Price)
    			end;
    		if (select("^0055FFHeal^000000:^777777Cancel^000000") == 2)
    			end;
    		Zeny -= .@Price;
    	}
    	specialeffect2 EF_HEAL2;
    	percentheal 100,100;
    	if (.@Buffs) {
    		specialeffect2 EF_INCAGILITY;
    		sc_start SC_INCREASEAGI,240000,10;
    		specialeffect2 EF_BLESSING;
    		sc_start SC_BLESSING,240000,10;
    	}
    	if (.@Delay)
    		@HD = gettimetick(2) + .@Delay;
    	end;
    }
    
    
    // Duplicates
    //============================================================
    alberta,25,240,6	duplicate(Healer)	Healer#alb	909,13,13
    aldebaran,135,118,6	duplicate(Healer)	Healer#alde	909,13,13
    amatsu,200,79,4	duplicate(Healer)	Healer#ama	909,13,13
    ayothaya,207,169,6	duplicate(Healer)	Healer#ayo	909,13,13
    comodo,184,158,6	duplicate(Healer)	Healer#com	909,13,13
    einbech,57,36,6	duplicate(Healer)	Healer#einbe	909,13,13
    einbroch,57,202,6	duplicate(Healer)	Healer#einbr	909,13,13
    geffen,115,72,6	duplicate(Healer)	Healer#gef	909,13,13
    gonryun,156,122,6	duplicate(Healer)	Healer#gon	909,13,13
    hugel,89,150,6	duplicate(Healer)	Healer#hug	909,13,13
    izlude,121,150,6	duplicate(Healer)	Healer#izl	909,13,13	//Pre-RE: (125,118)
    jawaii,250,139,4	duplicate(Healer)	Healer#jaw	909,13,13
    lighthalzen,152,100,6	duplicate(Healer)	Healer#lhz	909,13,13
    louyang,226,103,4	duplicate(Healer)	Healer#lou	909,13,13
    manuk,272,144,6	duplicate(Healer)	Healer#man	909,13,13
    mid_camp,203,289,6	duplicate(Healer)	Healer#mid	909,13,13
    moc_ruins,72,164,4	duplicate(Healer)	Healer#moc	909,13,13
    morocc,153,97,6	duplicate(Healer)	Healer#mor	909,13,13
    moscovia,220,191,4	duplicate(Healer)	Healer#mos	909,13,13
    niflheim,212,182,5	duplicate(Healer)	Healer#nif	909,13,13
    payon,179,106,4	duplicate(Healer)	Healer#pay	909,13,13
    prontera,162,193,4	duplicate(Healer)	Healer#prt	909,13,13
    rachel,125,116,6	duplicate(Healer)	Healer#rac	909,13,13
    splendide,201,153,4	duplicate(Healer)	Healer#spl	909,13,13
    thor_camp,249,74,4	duplicate(Healer)	Healer#thor	909,13,13
    umbala,105,148,3	duplicate(Healer)	Healer#umb	909,13,13
    veins,217,121,4	duplicate(Healer)	Healer#ve	909,13,13
    xmas,143,136,4	duplicate(Healer)	Healer#xmas	909,13,13
    yuno,164,45,4	duplicate(Healer)	Healer#yuno	909,13,13
    
    // Duplicates (Renewal)
    //============================================================
    brasilis,194,221,6	duplicate(Healer)	Healer#bra	909,13,13
    dewata,195,187,4	duplicate(Healer)	Healer#dew	909,13,13
    dicastes01,201,194,4	duplicate(Healer)	Healer#dic	909,13,13
    ecl_in01,45,60,4	duplicate(Healer)	Healer#ecl	909,13,13
    malangdo,132,114,6	duplicate(Healer)	Healer#mal	909,13,13
    malaya,227,204,6	duplicate(Healer)	Healer#ma	909,13,13
    mora,55,152,4	duplicate(Healer)	Healer#mora	909,13,13

     

  17. You could test this. Be aware, it's a prototype and there're some additional checks you might want to make (like charid in isloggedin).

    
    -	script	Duel_Death	-1,{
    	end;
    
    OnCommand:
    
    	set .@player$,strcharinfo(0);
    	set .@oid,getcharid(3);
    	set .@enemy$,implode(.@atcmd_parameters$," ");
    	set .@id,getcharid(3,.@enemy$);
    	if(!.@id) {
    		dispbottom "Character offline.";
    		end;
    	} else {
    		attachrid .@id;
    		set @wait_duel,.@oid;
    		dispbottom .@player$+" wants to duel. Use @accept to duel.";
    	}
    	end,
    
    OnAccept:
    
    	if(@wait_duel) {
    		set .@oid,getcharid(3);
    		if(isloggedin(@wait_duel)) {
    			set @duel,@wait_duel;
    			set @wait_duel,0;
    			dispbottom "You accepted the duel.";
    			attachrid @duel;
    			dispbottom "You're now in a duel with "+rid2name(.@oid)+.".";
    			set @duel,.@oid;
    		} else {
    			dispbottom "Other guy is offline";
    			set @wait_duel,0;
    		}
    	}
    	end;
    
    OnPCDieEvent:
    	if(@duel && killerrid == @duel) {
    		set .@deadplayer,getcharid(0);
    		message strcharinfo(0),"Game Over";
    		atcommand "@kick "+strcharinfo(0);
    		set .@j, getarraysize( .char_delete$ );
    		for (.@i = 0; .@i < .@j; .@i++) {
    			query_sql("DELETE FROM `"+ .char_delete$[.@i] +"` WHERE `char_id` = '"+ .@deadplayer +"'");
    		}
    		query_sql "DELETE FROM `party` WHERE `leader_char` = '"+.@deadplayer+"'";
    	}
    	end;
        
    OnInit:
    	setarray .char_delete$[0],"bonus_script","char","cart_inventory","elemental","friends","global_reg_value","guild","guild_member","homunculus","hotkey","inventory","memo","mercenary","mercenary_owner","pet","quest","sc_data","skill","skillcooldown";
    	bindatcmd "deathduel","Duel_Death::OnCommand";
    	bindatcmd "accept","Duel_Death::OnAccept";
    	end;
        
    }

     

×
×
  • Create New...