Jump to content

LucianoCP

Members
  • Posts

    50
  • Joined

  • Last visited

Posts posted by LucianoCP

  1. Hi guys, i'm using navigateto command and i'm stuck in a error. I want to navigate from CustomMapA through CustomMapB to ayo_in01, but i got the message that navi system was unable to find a path. If i try to navi from CustomMapA to CustomMapB, it works. If i try to navi from CustomMapB to ayo_in01, it also works. So, i need a help to know why it doesn't work when i have to get through another map.

    This is my navi_map_krpri.lub:

    { "CustomMapA", "Custom Map A", 5003, 60, 60 },
    { "CustomMapB", "Custom Map B", 5003, 400, 400 },

    (by the way, what this "5003" parameter should mean?

     

    This is my navi_link_krpri.lub:

    { "CustomMapA", 13506, 200, 99999, "CustomMapA_CustomMapB", "", 31, 2, "CustomMapB", 194, 230 },
    { "CustomMapB", 13506, 200, 99999, "CustomMapB_CustomMapA", "", 194, 234, "CustomMapA", 31, 6 },
    { "ayo_in01", 11932, 200, 99999, "Room_CustomMapB", "", 72, 173, "CustomMapB", 280, 159 },
    { "CustomMapB", 11917, 200, 99999, "CustomMapB_Room", "", 280, 163, "ayo_in01", 76, 173 },

    (need help to understand these parameters too)

     

    Is there another file i have to edit?

    • Upvote 1
  2. On 12/15/2018 at 9:29 PM, Rizta said:

    im not sure but i think youll need lots of client and source edits xD

    By client edits you mean sprites? I'll check later, but i think that all archers classes, except ranger, doesn't have any "worg part" in their sprites. So i guess it needs only source edits. It's weird because the worg is functional, it just stay hidden.

     

    I changed ranger's sprite and warg mastery worked, so i guess it's just a source issue. Does anybody knows how to solve it?

    image.png.34d08f9e7c86688d78d7f1a518ea71d8.png

  3. Hey, guys. What's up? So, i want to put worg skills in one equip that could be used by every class. When i do this, only in archer classes (archer, hunter, sniper, ranger) the worg appears. You see, in other classes it works, but it stays hidden. If i use skill RA_WUGMASTERY (2240) on every job except archer classes, the skill works but the worg stays hidden and i can tell he stays hidden because i can use worg skills like RA_WUGSTRIKE (2243) and it works, but the attack looks like coming from nowhere hahahahaha
    So, how can i turn the worg visible to all classes?

  4. 19 minutes ago, n0tttt said:

    Sorry. I don't know why I put the divisor first.

    
    	set .@exp_gained,.@exp_gained/100;
    	function get_decimal;
    	if(.FishingLvl[FishingLvl] > 1) {
    		dispbottom "Gained "+F_InsertComma(.@exp_gained+)" mastery points ("+get_decimal(.@exp_gained*100,.FishingLvl[FishingLvl])+"%).";
    		FishingExp+= .@exp_gained;
    		dispbottom "Total: "+F_InsertComma(FishingExp)+"/"+F_InsertComma(.FishingLvl[FishingLvl])+" ("+get_decimal(min(FishingExp,.FishingLvl[FishingLvl])*100,.FishingLvl[FishingLvl])+"%).";
    	}
    	if(.FishingLvl[FishingLvl] <= FishingExp){
    		set FishingLvl, FishingLvl + 1;
    		dispbottom "[Level Up] Congrats! Your Fishing level is now: "+FishingLvl;
    		set FishingExp,0;
    		if(FishingLvl == .MaxFishingLvl) {
    			dispbottom "Your Fishing Mastery is at maximum level.";
    		}
    	}
    	end;

    And yeah, you'll get natural numbers. In fact the function returns a string.

    Thanks, mate! Running correctly now.

    Here's the final code:

    -	script	Fishing_Exp	-1,{
    	
    	OnInit:
    
    	setArray .FishingLvl[0],
    1, 3800, 6200, 10400, 15200, 22900, 27100, 30000, 32500, 35700,
    41300, 45000, 45800, 47600, 50300, 58700, 63900, 67100, 70300, 73500,
    90600, 96200, 102700, 110200, 121400, 144700, 152900, 163100, 173300, 183500,
    213500, 224700, 236000, 247200, 260700, 299800, 324800, 343600, 362300, 374800,
    474400, 497000, 512100, 542200, 564800, 644300, 678200, 712100, 754500, 796900,
    873100, 911900, 950600, 989400, 1028100, 1143300, 1199900, 1233800, 1279100, 1324300,
    1486900, 1515900, 1603000, 1719200, 1806300, 2040300, 2244300, 2415900, 2746000, 2746000,
    2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000;
    
    	set .MaxFishingLvl, getarraysize(.FishingLvl);
    
    end;
    
    OnNPCKillEvent:
    
    	if(fishing != 1 || FishingLvl >= .MaxFishingLvl) {end;} //the (fishing != 1) check let only fisher players to lvl up their fishing mastery. Need to put "set fishing,1" in your Fishing Teacher NPC.
    
    	.@mob_jexp = strmobinfo(7,killedrid);
    	.@exp_gained = .@mob_jexp;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if (.@lvl_dif >= 16) {set .@exp_gained, .@exp_gained*40;}
    	if (.@lvl_dif == 15 || .@lvl_dif == 5) {set .@exp_gained, .@exp_gained*115;}
    	if (.@lvl_dif == 14 || .@lvl_dif == 6) {set .@exp_gained, .@exp_gained*120;}
    	if (.@lvl_dif == 13 || .@lvl_dif == 7) {set .@exp_gained, .@exp_gained*125;}
    	if (.@lvl_dif == 12 || .@lvl_dif == 8) {set .@exp_gained, .@exp_gained*130;}
    	if (.@lvl_dif == 11 || .@lvl_dif == 9) {set .@exp_gained, .@exp_gained*135;}
    	if (.@lvl_dif == 10) {set .@exp_gained, .@exp_gained*140;}
    	if (.@lvl_dif == 4) {set .@exp_gained, .@exp_gained*110;}
    	if (.@lvl_dif == 3) {set .@exp_gained, .@exp_gained*105;}
    	if (.@lvl_dif <= 2 && .@lvl_dif >= -5) {set .@exp_gained, .@exp_gained*100;}
    	if (.@lvl_dif <= -6 && .@lvl_dif >= -10) {set .@exp_gained, .@exp_gained*95;}
    	if (.@lvl_dif <= -11 && .@lvl_dif >= -15) {set .@exp_gained, .@exp_gained*90;}
    	if (.@lvl_dif <= -16 && .@lvl_dif >= -20) {set .@exp_gained, .@exp_gained*85;}
    	if (.@lvl_dif <= -21 && .@lvl_dif >= -25) {set .@exp_gained, .@exp_gained*60;}
    	if (.@lvl_dif <= -26 && .@lvl_dif >= -30) {set .@exp_gained, .@exp_gained*35;}
    	if (.@lvl_dif <= -31) {set .@exp_gained, .@exp_gained*10;}
    
    	set .@exp_gained,.@exp_gained/100;
    	set FishingExp, FishingExp + .@exp_gained + 1;
    	if(.FishingLvl[FishingLvl] <= FishingExp){
    		set FishingLvl, FishingLvl + 1;
    		dispbottom "[Level Up] Congrats! Your Fishing level is now: "+FishingLvl;
    		set FishingExp,0;
    	}
    	if(showmasteryexp) {dispbottom "Gained "+.@exp_gained+" ("+callfunc("get_decimal", .@exp_gained*100,.FishingLvl[FishingLvl])+"%) mastery points.";}
    	end;
    }
    
    function	script	get_decimal	{
    	.@x = getarg(0);
    	.@y = getarg(1);
    
    	.@precision = getarg(2,2); // The amount of digits to keep after the dot
    	.@mod = pow(10, .@precision);
    	.@left = .@x / .@y;
    	.@right = (.@x * .@mod / .@y) % .@mod;
    	.@result$ = "" + .@left;
    
    	if (!.@right)
    		return .@result$;
    
    	// Removes trailing zeroes, for example:
    	// With .@zeroes set to 0, 5 / 2 will output 2.5
    	// With .@zeroes set to 1, 5 / 2 will output 2.50
    	.@zeroes = 1;
    
    	for (.@i = 0; .@i < .@precision; .@i++) {
    		.@digit = .@right % 10;
    		.@right = .@right / 10;
    
    		if (!.@zeroes) {
    			if (.@digit == 0)
    				continue;
    
    			.@output$ = insertchar(.@output$, .@digit + "", 0);
    			.@zeroes = 1;
    		}
    		else {
    			.@output$ = insertchar(.@output$, .@digit + "", 0);
    		}
    	}
    
    	return .@result$ + "." + .@output$;
    }

    Here's an atcommand to set the dispbottom exp. Like @showexp, use @showmasteryexp to enable/disable it.

    -	script	showmasteryexp	-1,{
        OnInit:
            bindatcmd("showmasteryexp", "showmasteryexp::OnAtCmd");
    
            end;
            
        OnAtCmd:
    		if (showmasteryexp) {
    			message strcharinfo(0),"Gained Mastery EXP will not be shown.";
    			set showmasteryexp,0;
    		} else {
    			message strcharinfo(0),"Gained Mastery EXP is now shown.";
    			set showmasteryexp,1;
    		}
            end;
    }

     

  5. 36 minutes ago, n0tttt said:

    The function has to load before the script.

    Otherwise...

    
    	function get_decimal;	
    	dispbottom "Gained "+F_InsertComma(.@exp_gained+)" mastery points ("+get_decimal(.FishingLvl[FishingLvl]*100,.@exp_gained)+"%).";

     

    ok, the function is working, but i think the math is wrong.

    i have .@exp_gained telling me the exp gained and i need to know what % this represents compared to the max (100%) exp at the .FishingLvl[FishingLvl] (let's call it X), so:

    .FishingLvl[FishingLvl] = 100
    
    .@exp_gained = X
    
    .@exp_gained*100 = .FishingLvl[FishingLvl]*X
    
    X = (.@exp_gained*100)/.FishingLvl[FishingLvl]

    Now, i think i need to run this math in the function... Because if i run at the callfunction, it goes to natural numbers?

  6. 35 minutes ago, n0tttt said:

    I have this function by Tokeiburu.

    
    function	script	get_decimal	{
    	.@x = getarg(0);
    	.@y = getarg(1);
    
    	.@precision = getarg(2,2); // The amount of digits to keep after the dot
    	.@mod = pow(10, .@precision);
    	.@left = .@x / .@y;
    	.@right = (.@x * .@mod / .@y) % .@mod;
    	.@result$ = "" + .@left;
    
    	if (!.@right)
    		return .@result$;
    
    	// Removes trailing zeroes, for example:
    	// With .@zeroes set to 0, 5 / 2 will output 2.5
    	// With .@zeroes set to 1, 5 / 2 will output 2.50
    	.@zeroes = 0;
    
    	for (.@i = 0; .@i < .@precision; .@i++) {
    		.@digit = .@right % 10;
    		.@right = .@right / 10;
    
    		if (!.@zeroes) {
    			if (.@digit == 0)
    				continue;
    
    			.@output$ = insertchar(.@output$, .@digit + "", 0);
    			.@zeroes = 1;
    		}
    		else {
    			.@output$ = insertchar(.@output$, .@digit + "", 0);
    		}
    	}
    
    	return .@result$ + "," + .@output$;
    }

     

    
    	dispbottom "Gained "+.@exp_gained+" mastery points ("+get_decimal(.FishingLvl[FishingLvl]*100,.@exp_gained)+")%.";

     

    expected ";"?

    image.png.fecb703eb1b08d520639f9314b6a52ee.png

  7. 5 hours ago, Rizta said:

    Try to use this function

    
    function	script	porcentagem	{
    	return (getarg(0) / 100)+"."+(((getarg(0) % 100) <= 9) ? "0" : "")+""+(getarg(0) % 100)+"%";
    }

     calling with your array like this

    
    "+callfunc("porcentagem", YourArrayHere+").",0;

     

    Thanks, mate. It worked, but the showed value is wrong. This is what i've made:

    dispbottom "Gained "+.@exp_gained+"("+callfunc("porcentagem", (.@exp_gained*100)/.FishingLvl[FishingLvl])+") mastery points.",0;
    
    function	script	porcentagem	{
    	return (getarg(0) / 100)+"."+(((getarg(0) % 100) <= 9) ? "0" : "")+""+(getarg(0) % 100)+"%";
    }

    I killed a mob who gives me 3% exp based on this code:

    dispbottom "Gained "+.@exp_gained+" ("+(.@exp_gained*100)/.FishingLvl[FishingLvl]+"%) mastery points.";

    I set the FishingLvl and JobLvl to 12 and this happens:

    image.png.a00a218ac195656b17877179ffea82d8.png

  8. 1 hour ago, n0tttt said:
    
    	.@exp_gained = strmobinfo(7,killedrid)/100;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if(.@lvl_dif != 0) {		
    		if(.@lvl_dif < 0)
    			.@lvl_dif = MAX_LEVEL + (~(.@lvl_dif) + 1);
    		for(;.@i < .penalty_size;.@i+=2) {
    			if(.@lvl_dif >= .penalty[.@i])
    				break;
    		}
    		if(.@i != .penalty_size)
    			.@exp_gained*= .penalty[.@i + 1]/100;
    	}

    And manual values:

    
    -	script	Fishing_Exp	-1,{
    
    OnInit:
    
    	setarray .FishingLvl[0],
    	1, 3800, 6200, 10400, 15200, 22900, 27100, 30000, 32500, 35700,
    	41300, 45000, 45800, 47600, 50300, 58700, 63900, 67100, 70300, 73500,
    	90600, 96200, 102700, 110200, 121400, 144700, 152900, 163100, 173300, 183500,
    	213500, 224700, 236000, 247200, 260700, 299800, 324800, 343600, 362300, 374800,
    	474400, 497000, 512100, 542200, 564800, 644300, 678200, 712100, 754500, 796900,
    	873100, 911900, 950600, 989400, 1028100, 1143300, 1199900, 1233800, 1279100, 1324300,
    	1486900, 1515900, 1603000, 1719200, 1806300, 2040300, 2244300, 2415900, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000;
    
    	set .MaxFishingLvl, getarraysize(.FishingLvl);
    
    	end;
    
    OnNPCKillEvent:
    
    	if (fishing !=1 || FishingvLvl >= .MaxFishingLvl) {end;} //this will check if he made a quest to learn the mastery
    
    	.@mob_jexp = strmobinfo(7,killedrid);
    	.@exp_gained = .@mob_jexp;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if(.@lvl_dif != 0) {		
    		if(.@lvl_dif <= -31)
    			.@exp_gained*= 10;
    		else if(.@lvl_dif <= -26)
    			.@exp_gained*= 35;
    		else if(.@lvl_dif <= -21)
    			.@exp_gained*= 60;
    		else if(.@lvl_dif <= -16)
    			.@exp_gained*= 85;
    		else if(.@lvl_dif <= -11)
    			.@exp_gained *= 90;
    		else if(.@lvl_dif <= -6)
    			.@exp_gained*= 95;
    		else if(.@lvl_dif <= -1)
    			.@exp_gained*= 100;
    		else if(.@lvl_dif <= 3)
    			.@exp_gained*= 105;
    		else if(.@lvl_dif <= 4)
    			.@exp_gained*= 110;
    		else if(.@lvl_dif <= 5)
    			.@exp_gained*= 115;
    		else if(.@lvl_dif <= 6)
    			.@exp_gained*= 120;
    		else if(.@lvl_dif <= 7)
    			.@exp_gained*= 125;
    		else if(.@lvl_dif <= 8)
    			.@exp_gained*= 130;
    		else if(.@lvl_dif <= 9)
    			.@exp_gained*= 135;
    		else if(.@lvl_dif <= 10)
    			.@exp_gained*= 140;
    		else if(.@lvl_dif <= 11)
    			.@exp_gained*= 135;
    		else if(.@lvl_dif <= 12)
    			.@exp_gained*= 130;
    		else if(.@lvl_dif <= 13)
    			.@exp_gained*= 125;
    		else if(.@lvl_dif <= 14)
    			.@exp_gained*= 120;
    		else if(.@lvl_dif <= 15)
    			.@exp_gained*= 115;
    		else
    			.@exp_gained*= 40;
    		.@exp_gained/= 100;
    	}
    	dispbottom "You gained "+F_InsertComma(.@exp_gained)+" job exp.";
    	set FishingExp, FishingExp + .@exp_gained;
    	if(.FishingLvl[FishingLvl] <= FishingExp){
    		set FishingLvl, FishingLvl + 1;
    		dispbottom "[Level Up] Congrats! Your Fishing level is now: "+FishingLvl;
    		set FishingExp,0;
    		if(FishingLvl == .MaxFishingLvl) {
    			dispbottom "Your Fishing Mastery is at maximum level.";
    		}
    	}
    	end;
    }

      

    Wow, just saw it now. I've made manual "if"s too. So, here's my code:

    -	script	Fishing_Exp	-1,{
    
    OnInit:
    
    	setarray .FishingLvl[0],
    	1, 3800, 6200, 10400, 15200, 22900, 27100, 30000, 32500, 35700,
    	41300, 45000, 45800, 47600, 50300, 58700, 63900, 67100, 70300, 73500,
    	90600, 96200, 102700, 110200, 121400, 144700, 152900, 163100, 173300, 183500,
    	213500, 224700, 236000, 247200, 260700, 299800, 324800, 343600, 362300, 374800,
    	474400, 497000, 512100, 542200, 564800, 644300, 678200, 712100, 754500, 796900,
    	873100, 911900, 950600, 989400, 1028100, 1143300, 1199900, 1233800, 1279100, 1324300,
    	1486900, 1515900, 1603000, 1719200, 1806300, 2040300, 2244300, 2415900, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000;
    
    	set .MaxFishingLvl, getarraysize(.FishingLvl);
    
    	end;
    
    OnNPCKillEvent:
    
    	if (fishing !=1 || FishingvLvl >= .MaxFishingLvl) {end;} //this will check if he made a quest to learn the mastery
    
    .@mob_jexp = strmobinfo(7,killedrid);
    	.@exp_gained = .@mob_jexp;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if (.@lvl_dif >= 16) {set .@exp_gained, .@exp_gained*40;}
    	if (.@lvl_dif == 15 || .@lvl_dif == 5) {set .@exp_gained, .@exp_gained*115;}
    	if (.@lvl_dif == 14 || .@lvl_dif == 6) {set .@exp_gained, .@exp_gained*120;}
    	if (.@lvl_dif == 13 || .@lvl_dif == 7) {set .@exp_gained, .@exp_gained*125;}
    	if (.@lvl_dif == 12 || .@lvl_dif == 8) {set .@exp_gained, .@exp_gained*130;}
    	if (.@lvl_dif == 11 || .@lvl_dif == 9) {set .@exp_gained, .@exp_gained*135;}
    	if (.@lvl_dif == 10) {set .@exp_gained, .@exp_gained*140;}
    	if (.@lvl_dif == 4) {set .@exp_gained, .@exp_gained*110;}
    	if (.@lvl_dif == 3) {set .@exp_gained, .@exp_gained*105;}
    	if (.@lvl_dif <= 2 && .@lvl_dif >= -5) {set .@exp_gained, .@exp_gained*100;}
    	if (.@lvl_dif <= -6 && .@lvl_dif >= -10) {set .@exp_gained, .@exp_gained*95;}
    	if (.@lvl_dif <= -11 && .@lvl_dif >= -15) {set .@exp_gained, .@exp_gained*90;}
    	if (.@lvl_dif <= -16 && .@lvl_dif >= -20) {set .@exp_gained, .@exp_gained*85;}
    	if (.@lvl_dif <= -21 && .@lvl_dif >= -25) {set .@exp_gained, .@exp_gained*60;}
    	if (.@lvl_dif <= -26 && .@lvl_dif >= -30) {set .@exp_gained, .@exp_gained*35;}
    	if (.@lvl_dif <= -31) {set .@exp_gained, .@exp_gained*10;}
    set .@exp_gained,.@exp_gained/100;
    dispbottom "Experience Gained Mastery: "+.@exp_gained+" ("+(.@exp_gained*100)/.FishingLvl[FishingLvl]+"%)";
    	if(.FishingLvl[FishingLvl] <= FishingExp){
    		set FishingLvl, FishingLvl + 1;
    		dispbottom "[Level Up] Congrats! Your Fishing level is now: "+FishingLvl;
    		set FishingExp,0;
    		if(FishingLvl == .MaxFishingLvl) {
    			dispbottom "Your Fishing Mastery is at maximum level.";
    		}
    	}
    	end;
    }

    I made a dispbottom similar to @showexp, but if the gained experience is below 1% to lvl up the fishing, it says "0%".

    Look:

    dispbottom "Experience Gained Mastery: "+.@exp_gained+" ("+(.@exp_gained*100)/.FishingLvl[FishingLvl]+"%)";

    What can i do for it to show something like "Experience Gained Mastery: 318 (0.25%)" instead of "Experience Gained Mastery: 318 (0%)"?

  9. 20 minutes ago, n0tttt said:

    And like this?

    
    	.@exp_gained = strmobinfo(7,killedrid)/100;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if(.@lvl_dif != 0) {		
    		if(.@lvl_dif < 0)
    			.@lvl_dif = MAX_LEVEL + (~(.@lvl_dif) + 1);
    		for(;.@i < .penalty_size;.@i+=2) {
    			if(.@lvl_dif >= .penalty[.@i])
    				break;
    		}
    		if(.@i != .penalty_size)
    			.@exp_gained*= .penalty[.@i + 1];
    	}

     

    still wrong ?

    By .@exp_gained = strmobinfo(7,killedrid) i get exactly "mob_job_exp" from mob.db * job_rate. From that, we need to improve the "renewal leveling" thing. I could do a bunch of "if"s, but i don't know if this is the best way. something like:

    .@exp_gained = strmobinfo(7,killedrid)
    .@mob_lvl = strmobinfo(3,killedrid)
    .@lvl_dif = .@mob_lvl - BaseLevel
      
    if (.@lvl_dif == 10) { //if the mob has 10 lvls more than you, exp gets buffed by 40%
    	set .@exp_gained, .@expgained*1.4
    }

    I don't know how to work on arrays (neither basic script haha). Hope this provides a north for you.

  10. 4 minutes ago, n0tttt said:

    Nice find man.

    Anyways I had a typo.

    
    .@exp_gained*= .penalty[.@mi + 1];

    has to be

    
    .@exp_gained*= .penalty[.@i + 1];

    Ok, it's not 100% right.

    I'm using this code:

    .@exp_gained = strmobinfo(7,killedrid)/100;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if(.@lvl_dif != 0) {	
    		if(.@lvl_dif < 0)
    			.@lvl_dif = MAX_LEVEL + (~(.@lvl_dif) + 1);
    		.@mod = inarray(.penalty,.@lvl_dif);
    		if(.@mod != -1 && .@mod%2 == 0)
    			.@exp_gained*= .penalty[.@mod + 1];
    	}

    I'm killing a 29 lvl mob. If my lvl is higher than 26, this happens:

    image.png.e784c58af6a9912f20663079147d1f82.png

    if my lvl is equal or below 26, this:

    image.png.d1c0d1d3ffdc66ad5c71f07d9979fa53.png

  11. 8 hours ago, n0tttt said:

    What about this?

    
    -	script	Fishing_Exp	-1,{
    
    OnInit:
    	
    	setarray .penalty[0],	16,40,
    				15,115,
    				14,120,
    				13,125,
    				12,130,
    				11,135,
    				10,140,
    				9,135,
    				8,130,
    				7,125,
    				6,120,
    				5,115,
    				4,110,
    				3,105,
    				-1,100,
    				-6,95,
    				-11,90,
    				-16,85,
    				-21,60,
    				-26,35,
    				-31,10;
    
    	for(.penalty_size = getarraysize(.penalty);.@i < .penalty_size;.@i+=2) {
    		.@diff = .penalty[.@i];
    		if(.@diff < 0) 
    			.penalty[.@i] = min(MAX_LEVEL + (~(.@diff) + 1),MAX_LEVEL*2);
    	}
    
    	setarray .FishingLvl[0],
    	1, 3800, 6200, 10400, 15200, 22900, 27100, 30000, 32500, 35700,
    	41300, 45000, 45800, 47600, 50300, 58700, 63900, 67100, 70300, 73500,
    	90600, 96200, 102700, 110200, 121400, 144700, 152900, 163100, 173300, 183500,
    	213500, 224700, 236000, 247200, 260700, 299800, 324800, 343600, 362300, 374800,
    	474400, 497000, 512100, 542200, 564800, 644300, 678200, 712100, 754500, 796900,
    	873100, 911900, 950600, 989400, 1028100, 1143300, 1199900, 1233800, 1279100, 1324300,
    	1486900, 1515900, 1603000, 1719200, 1806300, 2040300, 2244300, 2415900, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000;
    
    	set .MaxFishingLvl, getarraysize(.FishingLvl);
    
    	end;
    
    OnNPCKillEvent:
    
    	if (fishing !=1 || FishingvLvl >= .MaxFishingLvl) {end;} //this will check if he made a quest to learn the mastery
    
    	.@mob_jexp = strmobinfo(7,killedrid);
    	.@rates = getbattleflag("job_exp_rate");
    	.@exp_gained = .@mob_jexp*.@rates/100;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if(.@lvl_dif != 0) {		
    		if(.@lvl_dif < 0)
    			.@lvl_dif = MAX_LEVEL + (~(.@lvl_dif) + 1);
    		for(;.@i < .penalty_size;.@i+=2) {
    			if(.@lvl_dif >= .penalty[.@i])
    				break;
    		}
    		if(.@i != .penalty_size)
    			.@exp_gained*= .penalty[.@mi + 1];
    	}
    	set FishingExp, FishingExp + .@exp_gained;
    	if(.FishingLvl[FishingLvl] <= FishingExp){
    		set FishingLvl, FishingLvl + 1;
    		dispbottom "[Level Up] Congrats! Your Fishing level is now: "+FishingLvl;
    		set FishingExp,0;
    		if(FishingLvl == .MaxFishingLvl) {
    			dispbottom "Your Fishing Mastery is at maximum level.";
    		}
    	}
    	end;
    }

    If not, I can think of a "hacky" way by using JobExp.

    
    -	script	Fishing_Exp	-1,{
    
    OnInit:
    
    	setarray .FishingLvl[0],
    	1, 3800, 6200, 10400, 15200, 22900, 27100, 30000, 32500, 35700,
    	41300, 45000, 45800, 47600, 50300, 58700, 63900, 67100, 70300, 73500,
    	90600, 96200, 102700, 110200, 121400, 144700, 152900, 163100, 173300, 183500,
    	213500, 224700, 236000, 247200, 260700, 299800, 324800, 343600, 362300, 374800,
    	474400, 497000, 512100, 542200, 564800, 644300, 678200, 712100, 754500, 796900,
    	873100, 911900, 950600, 989400, 1028100, 1143300, 1199900, 1233800, 1279100, 1324300,
    	1486900, 1515900, 1603000, 1719200, 1806300, 2040300, 2244300, 2415900, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000;
    
    	set .MaxFishingLvl, getarraysize(.FishingLvl);
    
    	end;
    
    OnPCLoginEvent:
    
    	if(fishing)
    		@jobexp = JobExp;
    	end;
    
    OnNPCKillEvent:
    
    	if (fishing !=1 || FishingvLvl >= .MaxFishingLvl) {end;} //this will check if he made a quest to learn the mastery
    	.@exp_gained = JobExp - @jobexp;
    	@jobexp = JobExp;
    	dispbottom "You gained "+F_InsertComma(.@exp_gained)+" job exp.";
    	set FishingExp, FishingExp + .@exp_gained;
    	if(.FishingLvl[FishingLvl] <= FishingExp){
    		set FishingLvl, FishingLvl + 1;
    		dispbottom "[Level Up] Congrats! Your Fishing level is now: "+FishingLvl;
    		set FishingExp,0;
    		if(FishingLvl == .MaxFishingLvl) {
    			dispbottom "Your Fishing Mastery is at maximum level.";
    		}
    	}
    	end;
    }

    but you might need to add:

    
    @jobexp = JobExp;

    in your fishing script after set fishing,1;

     

    Mate, i've found the error. It doesn't need to set the .@rates as multiplier, because when the scripts gets the strmobinfo(7,killerid), the rates are already applied. Look, my rates are 500x. So, 854,750/500 = 1.709,5. The screenshot display jobexp = 1709. (;

  12. 19 minutes ago, n0tttt said:

    And like this?

    
    -	script	Fishing_Exp	-1,{
    
    OnInit:
    	
    	setarray .penalty[0],	16,40,
    				15,115,
    				14,120,
    				13,125,
    				12,130,
    				11,135,
    				10,140,
    				9,135,
    				8,130,
    				7,125,
    				6,120,
    				5,115,
    				4,110,
    				3,105,
    				-1,100,
    				-6,95,
    				-11,90,
    				-16,85,
    				-21,60,
    				-26,35,
    				-31,10;
    
    	for(.@size = getarraysize(.penalty);.@i < .@size;.@i+=2) {
    		.@diff = .penalty[.@i];
    		if(.@diff < 0) 
    			.penalty[.@i] = min(MAX_LEVEL + (~(.@diff) + 1),MAX_LEVEL*2);
    	}
    
    	setarray .FishingLvl[0],
    	1, 3800, 6200, 10400, 15200, 22900, 27100, 30000, 32500, 35700,
    	41300, 45000, 45800, 47600, 50300, 58700, 63900, 67100, 70300, 73500,
    	90600, 96200, 102700, 110200, 121400, 144700, 152900, 163100, 173300, 183500,
    	213500, 224700, 236000, 247200, 260700, 299800, 324800, 343600, 362300, 374800,
    	474400, 497000, 512100, 542200, 564800, 644300, 678200, 712100, 754500, 796900,
    	873100, 911900, 950600, 989400, 1028100, 1143300, 1199900, 1233800, 1279100, 1324300,
    	1486900, 1515900, 1603000, 1719200, 1806300, 2040300, 2244300, 2415900, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    	2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000;
    
    	set .MaxFishingLvl, getarraysize(.FishingLvl);
    
    	end;
    
    OnNPCKillEvent:
    
    	if (fishing !=1 || FishingvLvl >= .MaxFishingLvl) {end;} //this will check if he made a quest to learn the mastery
    
    	.@mob_jexp = strmobinfo(7,killedrid);
    	.@rates = getbattleflag("job_exp_rate");
    	.@exp_gained = .@mob_jexp*.@rates/100;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if(.@lvl_dif != 0) {		
    		if(.@lvl_dif < 0)
    			.@lvl_dif = MAX_LEVEL + (~(.@lvl_dif) + 1);
    		.@mod = inarray(.penalty,.@lvl_dif);
    		if(.@mod != -1 && .@mod%2 == 0)
    			.@exp_gained*= .penalty[.@mod + 1];
    	}
    	set FishingExp, FishingExp + .@exp_gained;
    	if(.FishingLvl[FishingLvl] <= FishingExp){
    		set FishingLvl, FishingLvl + 1;
    		dispbottom "[Level Up] Congrats! Your Fishing level is now: "+FishingLvl;
    		set FishingExp,0;
    		if(FishingLvl == .MaxFishingLvl) {
    			dispbottom "Your Fishing Mastery is at maximum level.";
    		}
    	}
    	end;
    }

     

    I think it's working, but i've got this problem:

    image.png.ac3c887caefcaddff8184b74a31bfffe.png

    Script gives me 854,750 exp while i receive only 1709 job exp.

    dispbottom is @showexp and:

    dispbottom "You gained "+F_InsertComma(.@exp_gained)+" Fishing exp.";

     

  13. 20 minutes ago, n0tttt said:

    Change every instance of

    
    checkre(RENEWAL_EXP)

     with checkre(3) then. I thought it used consts.

    Mate, still get the same error. This "if" is checking if i'm using renewal_exp or not? Cause if it this, i think it's unnecessary.

    This code will help me with "mastery" leveling. Instead of typing each monster X_POINTS, code will get their job_exp. I've already set how much experience each level will require to lvl up, just like db\re\job_exp.txt.

    Here's my code:

    -	script	Fishing_Exp	-1,{
    	
    	OnInit:
    	
    	if(checkre(3)) {
    		setarray .penalty[0],	16,40,
    					15,115,
    					14,120,
    					13,125,
    					12,130,
    					11,135,
    					10,140,
    					9,135,
    					8,130,
    					7,125,
    					6,120,
    					5,115,
    					4,110,
    					3,105,
    					-1,100,
    					-6,95,
    					-11,90,
    					-16,85,
    					-21,60,
    					-26,35,
    					-31,10;
    
    		for(.@size = getarraysize(.penalty);.@i < .@size;.@i+=2) {
    			.@diff = .penalty[.@i*2];
    			if(.@diff < 0) 
    				.penalty[.@i*2] = min(MAX_LEVEL + (~(.@diff) + 1),MAX_LEVEL*2);
    		}
    	}
    
    setArray .FishingLvl[0],
    1, 3800, 6200, 10400, 15200, 22900, 27100, 30000, 32500, 35700,
    41300, 45000, 45800, 47600, 50300, 58700, 63900, 67100, 70300, 73500,
    90600, 96200, 102700, 110200, 121400, 144700, 152900, 163100, 173300, 183500,
    213500, 224700, 236000, 247200, 260700, 299800, 324800, 343600, 362300, 374800,
    474400, 497000, 512100, 542200, 564800, 644300, 678200, 712100, 754500, 796900,
    873100, 911900, 950600, 989400, 1028100, 1143300, 1199900, 1233800, 1279100, 1324300,
    1486900, 1515900, 1603000, 1719200, 1806300, 2040300, 2244300, 2415900, 2746000, 2746000,
    2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000,
    2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000, 2746000;
    
    set .MaxFishingLvl, getarraysize(.FishingLvl);
    
    end;
    
    OnNPCKillEvent:
    
    if (fishing !=1) {end;} //this will check if he made a quest to learn the mastery
    
    	.@mob_jexp = strmobinfo(7,killedrid);
    	.@rates = getbattleflag("job_exp_rate");
    	.@exp_gained = .@mob_jexp*.@rates/100;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if(checkre(3) && .@lvl_dif != 0) {		
    		if(.@lvl_dif < 0)
    			.@lvl_dif = MAX_LEVEL + (~(.@lvl_dif) + 1);
    		.@mod = inarray(.penalty,.@lvl_dif);
    		if(.@mod != -1 && .@mod%2 == 0)
    			.@exp_gained*= .penalty[.@mod + 1];
    			set FishingExp, FishingExp + .@exp_gained;
    	}
    set FishingExp, FishingExp + 1;
    if(.FishingLvl[FishingLvl] <= FishingExp && FishingLvl < .MaxFishingLvl){
    	set FishingLvl, FishingLvl + 1;
    	dispbottom "[Level Up] Congrats! Your Fishing level is now: "+FishingLvl;
    	set FishingExp,0;
    	if(FishingLvl == .MaxFishingLvl) {
    		dispbottom "Your Fishing Mastery is at maximum level.";
    }
    }
    
    end;
    }

     

  14. 40 minutes ago, n0tttt said:

    I don't know if this can work.

    
    -	script	Mob_Exp	-1,{
    
    OnInit:
    
    	if(checkre(RENEWAL_EXP)) {
    		setarray .penalty[0],	16,40,
    					15,115,
    					14,120,
    					13,125,
    					12,130,
    					11,135,
    					10,140,
    					9,135,
    					8,130,
    					7,125,
    					6,120,
    					5,115,
    					4,110,
    					3,105,
    					-1,100,
    					-6,95,
    					-11,90,
    					-16,85,
    					-21,60,
    					-26,35,
    					-31,10;
    
    		for(.@size = getarraysize(.penalty);.@i < .@size;.@i+=2) {
    			.@diff = .penalty[.@i*2];
    			if(.@diff < 0) 
    				.penalty[.@i*2] = min(MAX_LEVEL + (~(.@diff) + 1),MAX_LEVEL*2);
    		}
    	}
    	end;
    
    OnNPCKillEvent.
    
    	.@mob_jexp = strmobinfo(7,killedrid);
    	.@rates = getbattleflag("job_exp_rate");
    	.@exp_gained = .@mob_jexp*.@rates/100;
    	.@mob_lvl = strmobinfo(3,killedrid);
    	.@lvl_dif = .@mob_lvl - BaseLevel;
    	if(checkre(RENEWAL_EXP) && .@lvl_dif != 0) {		
    		if(.@lvl_dif < 0)
    			.@lvl_dif = MAX_LEVEL + (~(.@lvl_dif) + 1);
    		.@mod = inarray(.penalty,.@lvl_dif);
    		if(.@mod != -1 && .@mod%2 == 0)
    			.@exp_gained*= .penalty[.@mod + 1];
    	}
    	dispbottom "You gained "+F_InsertComma(.@exp_gained)+" job exp.";
    	end;
    
    }

     

    I'm getting an error with this:

    image.png.eff8399611867e12f753a3f9bd2e26e5.png

  15. Hey, guys. 

    I want to know if it's possible to set the job experience gained from a killed mob to a variable. Look, the default script is something like this:

    OnNPCKillEvent:
    
    if(killedrid == ID_MOB) {set variable, variable + X_POINTS;}

    By this way, i have to set the ID_MOB wich will give the X_POINTS, and how many points it will give. I was wonderwing if it's possible to do something like this:

    OnNPCKillEvent:
    
    set variable, variable + X_POINTS;

    I want to get the X_POINTS exactly the same as shown at @showexp command. It's too much work setting mob by mob and it's X_POINTS. Another problem is the job_exp_rate and the renewal levelling. 

  16. 38 minutes ago, n0tttt said:

    Does your mapserver tells you it loaded x entries from import/skill_nocast_db?

    
    -	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 if(.@oid == .@aid) {
    			message strcharinfo(0),"You can't duel yourself.";
    		} else {
    			set @duel_creator,1;
    			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(@duel_creator) {
    		message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer.";
    	} 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(prompt("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(prompt("Não","Sim") == 2) {
    					if(isloggedin(.@oid,.@cid)) {
    						if(!.duel) {
    							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;
    							set .cancel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							setmapflag .duel_map$,mf_restricted,9;
    							set .@first_id,getcharid(3);
    							explode .@xy$,.duel_xy$,",";
    							set .@r,rand(2);
    							set @duel,.@oid;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@first_id,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							attachrid .@oid;
    							set @duel,.@first_id;
    							set .@r,!.@r;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@oid,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							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;
    							}
    							pcblockmove .@first_id,0;
    							pcblockmove .@oid,0;
    							removemapflag .duel_map$,mf_restricted,9;
    							if(.@i || .cancel) {
    								announce "The Death Duel has been cancelled!",bc_all|bc_blue;
                       					} else {
    								announce "The Death Duel has just started!",bc_all|bc_blue;
    								setmapflag .duel_map$,mf_pvp;
    								setmapflag .duel_map$,mf_pvp_nocalcrank;
    								set .@i,0;
    								while(.@i < .time && !.cancel && .duel) {
    									sleep 5000;
    									set .@i,.@i + 5;
    								}
    								if(.@i >= .time)
    									announce "Death Duel time is over. There was no winner.",bc_all|bc_blue;
                        					}
    							sleep 1000;
    							if(.logout && .duel) {
    								announce "One of the participants logged out.",bc_all|bc_blue;
    								set .logout,false;
    							}
    							if(.cancel)
    								set .cancel,false;
    							set .duel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							addrid 5,0,.duel_map$;
    							setoption 0x40,0;
    							if(!@duel) {
    								atcommand "@rmvperm disable_pvp";
    							} else {
    								set @duel,0;
    								set @duel_creator,0;
    								set @wait_duelaid,0;
    								set @wait_duelcid,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;
    						} else {
    							message strcharinfo(0),"I'm sorry but a duel started a few moments ago.";
    							message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago.";
    							end;
    						}
    					} else {
    						message strcharinfo(0),"The other player disconnected.";
    					}
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			} else {
    				message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    			}
    			set .duel,false;
    			set .cancel,false;
    			if(playerattached()) {
    				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 @duel_creator,0,@wait_duelcid;
    					set @wait_duelaid,0,@wait_duelcid;
    					set @wait_duelcid,0,@wait_duelcid;
    					set @duel,0,@wait_duelcid;
    				}
    				set @duel_creator,0;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				set @duel,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),"There is no death duel invite for you right now.";
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@duel_creator) {
    		message strcharinfo(0),"You have to wait for your opponent to choose.";
    	} 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;
    		awake "Duel_Death";
    	} 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;
    
    OnFixDuel:
    
    	set .duel,false;
    	set .cancel,false;
    	set .logout,false;
    	set .duel_delay,false;
    	message strcharinfo(0),"Every variable has been cleared successfully.";
    	addrid 0;
    	set @duel,0;
    	set @wait_duelaid,0;
    	set @wait_duelcid,0;
    	set @duel_creator,0;
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .duel,false;
    		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+"'";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@wait_duelaid) {
    		message strcharinfo(0,@wait_duelcid),"The other player disconnected.";
    		set @wait_duelaid,0,@wait_duelcid;
    		set @creator_duel,0,@wait_duelcid;
    		set @wait_duelcid,0,@wait_duelcid;
    	}
    	if(@duel) {
    		set .cancel,true;
    		set .logout,true;
    		awake "Duel_Death";
    	}
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,0;
    	end;
        
    OnInit:
    
    	// Map
    	set .duel_map$,"deathduel";
    	// 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";
    	bindatcmd "fixduel","Duel_Death::OnFix",60;
    
    	// Max duration of a duel (seconds).
    	set .time,20;
    	end;
    
    }
    
    deathduel	mapflag	pvp
    deathduel	mapflag	pvp_nocalcrank
    deathduel	mapflag	noreturn
    deathduel	mapflag	nowarp
    deathduel	mapflag	nocommand	99
    deathduel	mapflag	nowarpto
    deathduel	mapflag	nosave	SavePoint
    deathduel	mapflag	nomemo
    deathduel	mapflag	notrade
    deathduel	mapflag	nodrop
    deathduel	mapflag	nobranch
    deathduel	mapflag	nochat
    deathduel	mapflag	novending
    deathduel	mapflag	restricted	9

     

    it does:

    image.png.83ca2f39329bd46ba3515f6a73f63e4c.png

    i'll test this last code and update this post soon.

    @edit:

    i'm still able to use backsliding

    @edit2:

    it's the group_id. tried to use with a normal account and it worked, i was unnable to use backsliding. So... Thank you!!!!

    I'll fix your code at the first post. If any bug appears, i'll contact you (;

    • Love 2
  17. 20 minutes ago, n0tttt said:

    db/import/skill_nocast_db.txt

    Add:

    
    //----------------------------------------------------------------------------
    // Zone 9 - Death Duel
    //----------------------------------------------------------------------------
    150,8192	//TF_BACKSLIDING
    426,8192	//TK_HIGHJUMP

     

    And the script:

    
    -	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 if(.@oid == .@aid) {
    			message strcharinfo(0),"You can't duel yourself.";
    		} else {
    			set @duel_creator,1;
    			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(@duel_creator) {
    		message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer.";
    	} 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(prompt("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(prompt("Não","Sim") == 2) {
    					if(isloggedin(.@oid,.@cid)) {
    						if(!.duel) {
    							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;
    							set .cancel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							setmapflag .duel_map$,mf_restricted,9;
    							set .@first_id,getcharid(3);
    							explode .@xy$,.duel_xy$,",";
    							set .@r,rand(2);
    							set @duel,.@oid;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@first_id,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							attachrid .@oid;
    							set @duel,.@first_id;
    							set .@r,!.@r;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@oid,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							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;
    							}
    							pcblockmove .@first_id,0;
    							pcblockmove .@oid,0;
    							removemapflag .duel_map$,mf_restricted,9;
    							if(.@i || .cancel) {
    								announce "The Death Duel has been cancelled!",bc_all|bc_blue;
                       					} else {
    								announce "The Death Duel has just started!",bc_all|bc_blue;
    								setmapflag .duel_map$,mf_pvp;
    								setmapflag .duel_map$,mf_pvp_nocalcrank;
    								set .@i,0;
    								while(.@i < .time && !.cancel && .duel) {
    									sleep 5000;
    									set .@i,.@i + 5;
    								}
    								if(.@i >= .time)
    									announce "Death Duel time is over. There was no winner.",bc_all|bc_blue;
                        					}
    							sleep 1000;
    							if(.logout && .duel) {
    								announce "One of the participants logged out.",bc_all|bc_blue;
    								set .logout,false;
    							}
    							if(.cancel)
    								set .cancel,false;
    							set .duel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							addrid 5,0,.duel_map$;
    							setoption 0x40,0;
    							if(!@duel) {
    								atcommand "@rmvperm disable_pvp";
    							} else {
    								set @duel,0;
    								set @duel_creator,0;
    								set @wait_duelaid,0;
    								set @wait_duelcid,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;
    						} else {
    							message strcharinfo(0),"I'm sorry but a duel started a few moments ago.";
    							message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago.";
    							end;
    						}
    					} else {
    						message strcharinfo(0),"The other player disconnected.";
    					}
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			} else {
    				message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    			}
    			set .duel,false;
    			set .cancel,false;
    			if(playerattached()) {
    				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 @duel_creator,0,@wait_duelcid;
    					set @wait_duelaid,0,@wait_duelcid;
    					set @wait_duelcid,0,@wait_duelcid;
    					set @duel,0,@wait_duelcid;
    				}
    				set @duel_creator,0;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				set @duel,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),"There is no death duel invite for you right now.";
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@duel_creator) {
    		message strcharinfo(0),"You have to wait for your opponent to choose.";
    	} 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;
    		awake "Duel_Death";
    	} 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;
    
    OnFixDuel:
    
    	set .duel,false;
    	set .cancel,false;
    	set .logout,false;
    	set .duel_delay,false;
    	message strcharinfo(0),"Every variable has been cleared successfully.";
    	addrid 0;
    	set @duel,0;
    	set @wait_duelaid,0;
    	set @wait_duelcid,0;
    	set @duel_creator,0;
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .duel,false;
    		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+"'";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@wait_duelaid) {
    		message strcharinfo(0,@wait_duelcid),"The other player disconnected.";
    		set @wait_duelaid,0,@wait_duelcid;
    		set @creator_duel,0,@wait_duelcid;
    		set @wait_duelcid,0,@wait_duelcid;
    	}
    	if(@duel) {
    		set .cancel,true;
    		set .logout,true;
    		awake "Duel_Death";
    	}
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,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";
    	bindatcmd "fixduel","Duel_Death::OnFix",60;
    
    	// Max duration of a duel (seconds).
    	set .time,20;
    	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

     

    image.png.1c2698154373646becb2820c17c891fd.png

    the account group id is 99, does it allows me to use forbidden skills during the countdown or something is wrong?

  18. 24 minutes ago, n0tttt said:
    
    -	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 if(.@oid == .@aid) {
    			message strcharinfo(0),"You can't duel yourself.";
    		} else {
    			set @duel_creator,1;
    			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(@duel_creator) {
    		message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer.";
    	} 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(prompt("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(prompt("Não","Sim") == 2) {
    					if(isloggedin(.@oid,.@cid)) {
    						if(!.duel) {
    							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;
    							set .cancel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							set .@first_id,getcharid(3);
    							explode .@xy$,.duel_xy$,",";
    							set .@r,rand(2);
    							set @duel,.@oid;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@first_id,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							attachrid .@oid;
    							set @duel,.@first_id;
    							set .@r,!.@r;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@oid,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							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;
    							}
    							pcblockmove .@first_id,0;
    							pcblockmove .@oid,0;
    							if(.@i || .cancel) {
    								announce "The Death Duel has been cancelled!",bc_all|bc_blue;
                       					} else {
    								announce "The Death Duel has just started!",bc_all|bc_blue;
    								setmapflag .duel_map$,mf_pvp;
    								setmapflag .duel_map$,mf_pvp_nocalcrank;
    								set .@i,0;
    								while(.@i < .time && !.cancel && .duel) {
    									sleep 5000;
    									set .@i,.@i + 5;
    								}
    								if(.@i >= .time)
    									announce "Death Duel time is over. There was no winner.",bc_all|bc_blue;
                        					}
    							sleep 1000;
    							if(.logout && .duel) {
    								announce "One of the participants logged out.",bc_all|bc_blue;
    								set .logout,false;
    							}
    							if(.cancel)
    								set .cancel,false;
    							set .duel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							addrid 5,0,.duel_map$;
    							setoption 0x40,0;
    							if(!@duel) {
    								atcommand "@rmvperm disable_pvp";
    							} else {
    								set @duel,0;
    								set @duel_creator,0;
    								set @wait_duelaid,0;
    								set @wait_duelcid,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;
    						} else {
    							message strcharinfo(0),"I'm sorry but a duel started a few moments ago.";
    							message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago.";
    							end;
    						}
    					} else {
    						message strcharinfo(0),"The other player disconnected.";
    					}
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			} else {
    				message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    			}
    			set .duel,false;
    			set .cancel,false;
    			if(playerattached()) {
    				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 @duel_creator,0,@wait_duelcid;
    					set @wait_duelaid,0,@wait_duelcid;
    					set @wait_duelcid,0,@wait_duelcid;
    					set @duel,0,@wait_duelcid;
    				}
    				set @duel_creator,0;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				set @duel,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),"There is no death duel invite for you right now.";
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@duel_creator) {
    		message strcharinfo(0),"You have to wait for your opponent to choose.";
    	} 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;
    		awake "Duel_Death";
    	} 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;
    
    OnFixDuel:
    
    	set .duel,false;
    	set .cancel,false;
    	set .logout,false;
    	set .duel_delay,false;
    	message strcharinfo(0),"Every variable has been cleared successfully.";
    	addrid 0;
    	set @duel,0;
    	set @wait_duelaid,0;
    	set @wait_duelcid,0;
    	set @duel_creator,0;
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .duel,false;
    		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+"'";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@wait_duelaid) {
    		message strcharinfo(0,@wait_duelcid),"The other player disconnected.";
    		set @wait_duelaid,0,@wait_duelcid;
    		set @creator_duel,0,@wait_duelcid;
    		set @wait_duelcid,0,@wait_duelcid;
    	}
    	if(@duel) {
    		set .cancel,true;
    		set .logout,true;
    		awake "Duel_Death";
    	}
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,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";
    	bindatcmd "fixduel","Duel_Death::OnFix",60;
    
    	// Max duration of a duel (seconds).
    	set .time,20;
    	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

     

    can you forbid the use of certain skills like backsliding, high jump until the countdown ends? just like the movement permission.

  19. 20 minutes ago, n0tttt said:

    Second error is really weird, since I don't think I changed much, just added the checking of offline characters. Maybe is connected to the other one? Anyways I changed the message. Anyways I added a new command: @fixduel, only usable by GMs. It should help testing and also when the duel gets stuck in a "ghost duel" (it shouldn't happen anyways, but this should help).

    
    -	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 if(.@oid == .@aid) {
    			message strcharinfo(0),"You can't duel yourself.";
    		} else {
    			set @duel_creator,1;
    			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(@duel_creator) {
    		message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer.";
    	} 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(prompt("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(prompt("Não","Sim") == 2) {
    					if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    						if(!.duel) {
    							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;
    							set .cancel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							set .@first_id,getcharid(3);
    							explode .@xy$,.duel_xy$,",";
    							set .@r,rand(2);
    							set @duel,.@oid;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@first_id,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							attachrid .@oid;
    							set @duel,.@first_id;
    							set .@r,!.@r;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@oid,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							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;
    							}
    							pcblockmove .@first_id,0;
    							pcblockmove .@oid,0;
    							if(.@i || .cancel) {
    								announce "The Death Duel has been cancelled!",bc_all|bc_blue;
                       					} else {
    								announce "The Death Duel has just started!",bc_all|bc_blue;
    								setmapflag .duel_map$,mf_pvp;
    								setmapflag .duel_map$,mf_pvp_nocalcrank;
    								set .@i,0;
    								while(.@i < .time && !.cancel && .duel) {
    									sleep 5000;
    									set .@i,.@i + 5;
    								}
    								if(.@i >= .time)
    									announce "Death Duel time is over. There was no winner.",bc_all|bc_blue;
                        					}
    							sleep 1000;
    							if(.logout && .duel) {
    								announce "One of the participants logged out.",bc_all|bc_blue;
    								set .logout,false;
    							}
    							if(.cancel)
    								set .cancel,false;
    							set .duel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							addrid 5,0,.duel_map$;
    							setoption 0x40,0;
    							if(!@duel) {
    								atcommand "@rmvperm disable_pvp";
    							} else {
    								set @duel,0;
    								set @duel_creator,0;
    								set @wait_duelaid,0;
    								set @wait_duelcid,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;
    						} else {
    							message strcharinfo(0),"I'm sorry but a duel started a few moments ago.";
    							message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago.";
    							end;
    						}
    					} else {
    						message strcharinfo(0),"The other player disconnected.";
    					}
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			} else {
    				message strcharinfo(0,@wait_duelcid),strcharinfo(0)+" has rejected the duel.";
    			}
    			set .duel,false;
    			set .cancel,false;
    			if(playerattached()) {
    				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 @duel_creator,0,@wait_duelcid;
    					set @wait_duelaid,0,@wait_duelcid;
    					set @wait_duelcid,0,@wait_duelcid;
    					set @duel,0,@wait_duelcid;
    				}
    				set @duel_creator,0;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				set @duel,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),"There is no death duel invite for you right now.";
    	}
    	end;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@duel_creator) {
    		message strcharinfo(0),"You have to wait for your opponent to choose.";
    	} 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;
    		awake "Duel_Death";
    	} 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;
    
    OnFixDuel:
    
    	set .duel,false;
    	set .cancel,false;
    	set .logout,false;
    	set .duel_delay,false;
    	message strcharinfo(0),"Every variable has been cleared successfully.";
    	addrid 0;
    	set @duel,0;
    	set @wait_duelaid,0;
    	set @wait_duelcid,0;
    	set @duel_creator,0;
    	end;
    
    OnPCKillEvent:
    	if(@duel && killedrid == @duel) {
    		set .duel_delay,gettimetick(2) + 5*60;
    		set .duel,false;
    		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+"'";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@wait_duelaid) {
    		message strcharinfo(0,@wait_duelcid),"The other player disconnected.";
    		set @wait_duelaid,0,@wait_duelcid;
    		set @creator_duel,0,@wait_duelcid;
    		set @wait_duelcid,0,@wait_duelcid;
    	}
    	if(@duel) {
    		set .cancel,true;
    		set .logout,true;
    		awake "Duel_Death";
    	}
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,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";
    	bindatcmd "fixduel","Duel_Death::OnFixDuel",60;
    
    	// Max duration of a duel (seconds).
    	set .time,20;
    	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

     

    look: when i choose yes on both characters, at dialogue menu, this happens:

    image.png.b450b10d9f0c1d3dea1f9011c1cea15f.png

  20. 34 minutes ago, n0tttt said:

    Done. I hope it turns out right.

    
    -	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 if(.@oid == .@aid) {
    			message strcharinfo(0),"You can't duel yourself.";
    		} else {
    			set @duel_creator,1;
    			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(@duel_creator) {
    		message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer.";
    	} 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(prompt("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(prompt("Não","Sim") == 2) {
    					if(isloggedin(@wait_duelaid,@wait_duelcid)) {
    						if(!.duel) {
    							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;
    							set .cancel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							set .@first_id,getcharid(3);
    							explode .@xy$,.duel_xy$,",";
    							set .@r,rand(2);
    							set @duel,.@oid;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@first_id,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							attachrid .@oid;
    							set @duel,.@first_id;
    							set .@r,!.@r;
    							warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    							setoption 0x40,0;
    							pcblockmove .@oid,1;
    							message strcharinfo(0),"You will not be able to move until the duel starts.";
    							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;
                       					} else {
    								announce "The Death Duel has just started!",bc_all|bc_blue;
    								setmapflag .duel_map$,mf_pvp;
    								setmapflag .duel_map$,mf_pvp_nocalcrank;
    								pcblockmove .@first_id,0;
    								pcblockmove .@oid,0;
    								set .@i,0;
    								while(.@i < .time && !.cancel && .duel) {
    									sleep 5000;
    									set .@i,.@i + 5;
    								}
    								if(.@i >= .time)
    									announce "Death Duel time is over. There was no winner.",bc_all|bc_blue;
                        					}
    							sleep 1000;
    							if(.logout && .duel) {
    								announce "One of the participants logged out.",bc_all|bc_blue;
    								set .logout,false;
    							}
    							if(.cancel)
    								set .cancel,false;
    							set .duel,false;
    							removemapflag .duel_map$,mf_pvp;
    							removemapflag .duel_map$,mf_pvp_nocalcrank;
    							addrid 5,0,.duel_map$;
    							setoption 0x40,0;
    							if(!@duel) {
    								atcommand "@rmvperm disable_pvp";
    							} else {
    								set @duel,0;
    								set @duel_creator,0;
    								set @wait_duelaid,0;
    								set @wait_duelcid,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;
    						} else {
    							message strcharinfo(0),"I'm sorry but a duel started a few moments ago.";
    							message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago.";
    							end;
    						}
    					} else {
    						message strcharinfo(0),"The other player disconnected.";
    					}
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			} else {
    				message strcharinfo(0,@wait_duelcid),"The challenger changed his mind. The Death Duel is cancelled.";
    			}
    			set .duel,false;
    			set .cancel,false;
    			if(playerattached()) {
    				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 @duel_creator,0,@wait_duelcid;
    					set @wait_duelaid,0,@wait_duelcid;
    					set @wait_duelcid,0,@wait_duelcid;
    					set @duel,0,@wait_duelcid;
    				}
    				set @duel_creator,0;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				set @duel,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),"There is no death duel invite for you right now.";
    	}
    	close;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@duel_creator) {
    		message strcharinfo(0),"You have to wait for your opponent to choose.";
    	} 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;
    		awake "Duel_Death";
    	} 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 .duel,false;
    		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+"'";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@wait_duelaid) {
    		message strcharinfo(0,@wait_duelcid),"The other player disconnected.";
    		set @wait_duelaid,0,@wait_duelcid;
    		set @creator_duel,0,@wait_duelcid;
    		set @wait_duelcid,0,@wait_duelcid;
    	}
    	if(@duel) {
    		set .cancel,true;
    		set .logout,true;
    		awake "Duel_Death";
    	}
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,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,20;
    	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

     

    When player B types @acceptdd and changes his mind after it, selecting "No" in dialogue menu, player A receives "challenger changed his mind", but player A is the challenger.

    When i say "Yes" on both char's dialogue menu, the duel is cancelled.

    Some part of the code is causing this: (don't know where exactly, sorry...)

    image.png.8fcba967cf614a3515a879a26c0f82e6.png

  21. 8 minutes ago, n0tttt said:
    
    -	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 if(.@oid == .@aid) {
    			message strcharinfo(0),"You can't duel yourself.";
    		} else {
    			set @duel_creator,1;
    			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(@duel_creator) {
    		message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer.";
    	} 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(prompt("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(prompt("Não","Sim") == 2) {
    					if(!.duel) {
    						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;
    						set .cancel,false;
    						removemapflag .duel_map$,mf_pvp;
    						removemapflag .duel_map$,mf_pvp_nocalcrank;
    						set .@first_id,getcharid(3);
    						explode .@xy$,.duel_xy$,",";
    						set .@r,rand(2);
    						set @duel,.@oid;
    						warp .duel_map$,atoi(.@xy$[2*.@r]),atoi(.@xy$[2*.@r + 1]);
    						setoption 0x40,0;
    						attachrid .@oid;
    						set @duel,.@first_id;
    						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;
                       				} else {
    							setmapflag .duel_map$,mf_pvp;
    							setmapflag .duel_map$,mf_pvp_nocalcrank;
    							set .@i,0;
    							while(.@i < .time && !.cancel && .duel) {
    								sleep 5000;
    								set .@i,.@i + 5;
    							}
    							if(.@i >= .time)
    								announce "Death Duel time is over. There was no winner.",bc_all|bc_blue;
                        				}
    						sleep 1000;
    						if(.logout && .duel) {
    							announce "One of the participants logged out.",bc_all|bc_blue;
    							set .logout,false;
    						}
    						if(.cancel)
    							set .cancel,false;
    						set .duel,false;
    						removemapflag .duel_map$,mf_pvp;
    						removemapflag .duel_map$,mf_pvp_nocalcrank;
    						addrid 5,0,.duel_map$;
    						setoption 0x40,0;
    						if(!@duel) {
    							atcommand "@rmvperm disable_pvp";
    						} else {
    							set @duel,0;
    							set @duel_creator,0;
    							set @wait_duelaid,0;
    							set @wait_duelcid,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;
    					} else {
    						message strcharinfo(0),"I'm sorry but a duel started a few moments ago.";
    						message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago.";
    						end;
    					}
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			}
    			set .duel,false;
    			set .cancel,false;
    			if(playerattached()) {
    				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 @duel_creator,0,@wait_duelcid;
    					set @wait_duelaid,0,@wait_duelcid;
    					set @wait_duelcid,0,@wait_duelcid;
    					set @duel,0,@wait_duelcid;
    				}
    				set @duel_creator,0;
    				set @wait_duelaid,0;
    				set @wait_duelcid,0;
    				set @duel,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),"There is no death duel invite for you right now.";
    	}
    	close;
    
    OnReject:
    
    	if(@duel) {
    		message strcharinfo(0),"You're already in a duel.";
    	} else if(@duel_creator) {
    		message strcharinfo(0),"You have to wait for your opponent to choose.";
    	} 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;
    		awake "Duel_Death";
    	} 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 .duel,false;
    		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+"'";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel) {
    		set .cancel,true;
    		set .logout,true;
    		awake "Duel_Death";
    	}
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,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,20;
    	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

    Done. The @reject thing I did intentionally if the one who made the duel changed his mind, but now that you point out, it really makes no sense, because there's already a confirmation when the other player accepts. So that part gets executed.

    If player B reloggs after receiveng an invite, the duel isn't cancelled. Player A doesn't receive any message. Eventually he is forced to rellog to create a new @deathduel. And if player A reloggs after sending the @deathduel, player b doesn't receive any warning about it.

    If player B select "Yes" on the dialogue menu and logs out after it, the dialogue menu appears to player A. I think that's not an issue, but the script keeps rolling as if player B hasn't logged out. I think should be a check before the announcements "there will be a death duel between A vs (null, because there is no player B)" to cancel it. Look:

    image.png.e467ac8b0a7c3d1f98314febb0bfe7e5.png

    If player B select "No" in the dialogue menu, both players receive a "the duel has been cancelled", but none explication for it. You see, when player A selects "No" on the dialogue menu, player B is warned that the player A has changed his mind.

    Also, what do you think about this: after duelers get recalled, can they be unable to move until the countdown ends? This will avoid they to hide themselves, something like this, you know? Would be nice to block moving skills likes backsliding/high jump.

  22. 6 hours ago, n0tttt said:

    Yeah, but now I added some debug announces:

    
    -	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 if(.@oid == .@aid) {
    			message strcharinfo(0),"You can't duel yourself.";
    		} else {
    			set @duel_creator,1;
    			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(@duel_creator) {
    		message strcharinfo(0),"You are the creater of the duel. Wait for the other player's answer.";
    	} 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(prompt("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(prompt("Não","Sim") == 2) {
    					if(!.duel) {
    						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;
    						set .cancel,false;
    						removemapflag .duel_map$,mf_pvp;
    						removemapflag .duel_map$,mf_pvp_nocalcrank;
    						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;
                       				} else {
    							setmapflag .duel_map$,mf_pvp;
    							setmapflag .duel_map$,mf_pvp_nocalcrank;
    							set .@i,0;
    							while(.@i < .time && !.cancel && .duel) {
    								sleep 5000;
    								set .@i,.@i + 5;
    							}
    							if(.@i >= .time)
    								announce "Death Duel time is over. There was no winner.",bc_all|bc_blue;
                        				}
    						sleep 1000;
    						if(.logout && .duel) {
    							announce "One of the participants logged out.",bc_all|bc_blue;
    							set .logout,false;
    						}
    						if(.cancel)
    							set .cancel,false;
    						set .duel,false;
    						removemapflag .duel_map$,mf_pvp;
    						removemapflag .duel_map$,mf_pvp_nocalcrank;
    						addrid 5,0,.duel_map$;
    						setoption 0x40,0;
    						if(!@duel) {
    							atcommand "@rmvperm disable_pvp";
    						} else {
    							set @duel,0;
    							set @duel_creator,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;
    					} else {
    						message strcharinfo(0),"I'm sorry but a duel started a few moments ago.";
    						message strcharinfo(0,.@cid),"I'm sorry but a duel started a few moments ago.";
    						end;
    					}
    				} else {
    					message strcharinfo(0,.@cid),"The challenger changed his mind. The Death Duel is cancelled.";
    				}
    			}
    			set .duel,false;
    			set .cancel,false;
    			announce "DEBUG 1: this part should be executed when one of the players choose no.",bc_all;
    			if(playerattached()) {
    				announce "DEBUG 2: this part should be executed when one of the players choose no and there's one attached.",bc_all;
    				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 @duel_creator,0,@wait_duelcid;
    					set @wait_duelaid,0,@wait_duelcid;
    					set @wait_duelcid,0,@wait_duelcid;
    				}
    				set @duel_creator,0;
    				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),"There is no death duel invite for you right now.";
    	}
    	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;
    		awake "Duel_Death";
    	} 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 .duel,false;
    		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+"'";
    	}
    	end;
    
    OnPCLogoutEvent:
    
    	if(@duel) {
    		set .cancel,true;
    		set .logout,true;
    		awake "Duel_Death";
    	}
    	end;
    
    OnPCLoginEvent:
    
    	if(checkoption(0x40) && getgmlevel() < 60)
    		setoption 0x40,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,20;
    	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

     

    First, i'll stablish a simple thing here:

    Player A: who creates the duel

    Player B: who accepts/rejects the duel

    --------------------------------

    - If player A creates the duel, he can type @reject. It's not a BUG, because player B can't accept after it, but player A receive a "You reject the duel". I think it's not the best message in this ocasion. I think he would be unnable to use it (like @accept) and wait for the dialogue menu appears to change his mind.

    - When player B select "No" after @accept, this happens:

    image.png.1a59c4868b98694a92d938fb8276647b.png

    If player B reloggs after receiveng an invite, the duel isn't cancelled. Player A doesn't receive any message. Eventually he is forced to rellog to create a new @deathduel

×
×
  • Create New...