Jump to content
  • 0

Deathmatch PvP


dubstep

Question


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.01
  • Content Count:  35
  • Reputation:   2
  • Joined:  07/25/15
  • Last Seen:  

Hi All, anyone knows why this script not showing and not getting the reward if you're the only 1 in the map? There is no announcement too that you're the winner.

In this screenshot, I already killed my 2nd account and I am the only one in the map:

unknown.png

-	script	event_start	-1,{
OnMinute00:
	announce "Death Match Event starts in a few minutes!",0;
	sleep 5000;
	announce "Register at the NPC 'Death Match'. You have 2 minutes to sign up!",0;
	pvpoff "guild_vs2";
	enablenpc "Death Match";
	donpcevent "agasper_dm::OnDM";
	end;
}

prontera,150,170,5	script	Death Match	811,{
	mes "[ Death Match ]";
	mes "Hi, "+strcharinfo(0)+"!";
	mes "Cost of registration: ^ff0000"+.reg_price+"^000000 Zeny!";
	if (select("I agree:Exit") == 2)
		close;
	if (BaseClass == Job_Novice) {
		next;
		mes "[ Death Match ]";
		mes "Beginners can not participate in the event!";
		close;
	}
	if (Zeny < .reg_price){
		next;
		mes "[ Death Match ]";
		mes "Where's the money?";
		close;
	}
	set Zeny, Zeny - .reg_price;
	set .@index, getarraysize(.player_list);
	if (.@index == 0)
		set .@index, 1;
	set .player_list[.@index], getcharid(3);
	set deathmatch_index, .@index;
	warp "guild_vs2", 50, 50;
	close;

OnInit:
	set .reg_price, 500000;
	disablenpc "Death Match";
	end;
}
-	script	agasper_dm	-1,{
OnClear:
	deletearray getvariableofnpc(.player_list[0], "Death Match"), getarraysize(getvariableofnpc(.player_list, "Death Match"));
	return;

OnDM:
	sleep 120000;
	disablenpc "Death Match";
	if(getmapusers("guild_vs2") < 2){
		announce "In the Event gathered less than 2-man! Event is canceled!",0;
		callsub(OnClear);
		mapwarp "guild_vs2", "prontera", 150, 170;
		end;
	}
	announce "Event 'Death Match' is start!",0;
	pvpon "guild_vs2";
	initnpctimer;
	end;

OnPCDieEvent:
	set .@dead, 1;
OnPCLogoutEvent:
	if (strcharinfo(3) != "guild_vs2")
		end;
	if (deathmatch_index < 1)
		end;

	set getvariableofnpc(.player_list[deathmatch_index], "Death Match"), -1;

	if (.@dead == 1) {
		warp "SavePoint", 0, 0;
		atcommand "@alive"+strcharinfo(0);
		dispbottom "[Death Match]: You lose =(";
	}
	end;

OnTimer5000:
	switch(getmapusers("guild_vs2")) {
		case 0:
			announce "Event 'Death Match' end as the players in the event is not!", 0;
			stopnpctimer;
			callsub(OnClear);
			break;
		case 1:
			callsub(OnWin);
			break;
		default:
			mapannounce "guild_vs2", getmapusers("guild_vs2")+" Player(s) are still in the event!", 0;
			initnpctimer;
		break;
	}
	end;

OnWin:
	for(set .@i, 0; .@i < getarraysize(getvariableofnpc(.player_list, "Death Match")); set .@i, .@i + 1) {
		if (getvariableofnpc(.player_list[.@i], "Death Match") != -1) {
			set .@account_id, .player_list[.@i];
			break;
		}
	}
	if (attachrid(.@account_id)) {
		callsub(OnPCKillEvent);
	}
	end;

OnPCKillEvent:
	.@players = getarraysize(getvariableofnpc(.player_list, "Death Match"));
	if(strcharinfo(3) == "guild_vs2" && getmapusers("guild_vs2") < 2) {
		stopnpctimer;
		announce "Player "+strcharinfo(0)+" won the event 'Death Match' and get "+ .reg_price * .@players +" Zeny!",0;
		set Zeny, Zeny + .reg_price * .@players;
		message strcharinfo(0),"You get "+ .reg_price*.@players +" Zeny!";
		warp "SavePoint",0,0;
		callsub(OnClear);
	}
	end;

}

guild_vs2	mapflag	noteleport
guild_vs2	mapflag	nowarp
guild_vs2	mapflag	nowarpto
guild_vs2	mapflag	nobranch
guild_vs2	mapflag	noicewall
guild_vs2	mapflag	pvp_noguild
guild_vs2	mapflag	pvp_noparty
guild_vs2	mapflag	nomemo
guild_vs2	mapflag	nodrop

 

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  740
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

1 hour ago, dubstep said:

Hi All, anyone knows why this script not showing and not getting the reward if you're the only 1 in the map? There is no announcement too that you're the winner.

In this screenshot, I already killed my 2nd account and I am the only one in the map:

unknown.png


-	script	event_start	-1,{
OnMinute00:
	announce "Death Match Event starts in a few minutes!",0;
	sleep 5000;
	announce "Register at the NPC 'Death Match'. You have 2 minutes to sign up!",0;
	pvpoff "guild_vs2";
	enablenpc "Death Match";
	donpcevent "agasper_dm::OnDM";
	end;
}

prontera,150,170,5	script	Death Match	811,{
	mes "[ Death Match ]";
	mes "Hi, "+strcharinfo(0)+"!";
	mes "Cost of registration: ^ff0000"+.reg_price+"^000000 Zeny!";
	if (select("I agree:Exit") == 2)
		close;
	if (BaseClass == Job_Novice) {
		next;
		mes "[ Death Match ]";
		mes "Beginners can not participate in the event!";
		close;
	}
	if (Zeny < .reg_price){
		next;
		mes "[ Death Match ]";
		mes "Where's the money?";
		close;
	}
	set Zeny, Zeny - .reg_price;
	set .@index, getarraysize(.player_list);
	if (.@index == 0)
		set .@index, 1;
	set .player_list[.@index], getcharid(3);
	set deathmatch_index, .@index;
	warp "guild_vs2", 50, 50;
	close;

OnInit:
	set .reg_price, 500000;
	disablenpc "Death Match";
	end;
}
-	script	agasper_dm	-1,{
OnClear:
	deletearray getvariableofnpc(.player_list[0], "Death Match"), getarraysize(getvariableofnpc(.player_list, "Death Match"));
	return;

OnDM:
	sleep 120000;
	disablenpc "Death Match";
	if(getmapusers("guild_vs2") < 2){
		announce "In the Event gathered less than 2-man! Event is canceled!",0;
		callsub(OnClear);
		mapwarp "guild_vs2", "prontera", 150, 170;
		end;
	}
	announce "Event 'Death Match' is start!",0;
	pvpon "guild_vs2";
	initnpctimer;
	end;

OnPCDieEvent:
	set .@dead, 1;
OnPCLogoutEvent:
	if (strcharinfo(3) != "guild_vs2")
		end;
	if (deathmatch_index < 1)
		end;

	set getvariableofnpc(.player_list[deathmatch_index], "Death Match"), -1;

	if (.@dead == 1) {
		warp "SavePoint", 0, 0;
		atcommand "@alive"+strcharinfo(0);
		dispbottom "[Death Match]: You lose =(";
	}
	end;

OnTimer5000:
	switch(getmapusers("guild_vs2")) {
		case 0:
			announce "Event 'Death Match' end as the players in the event is not!", 0;
			stopnpctimer;
			callsub(OnClear);
			break;
		case 1:
			callsub(OnWin);
			break;
		default:
			mapannounce "guild_vs2", getmapusers("guild_vs2")+" Player(s) are still in the event!", 0;
			initnpctimer;
		break;
	}
	end;

OnWin:
	for(set .@i, 0; .@i < getarraysize(getvariableofnpc(.player_list, "Death Match")); set .@i, .@i + 1) {
		if (getvariableofnpc(.player_list[.@i], "Death Match") != -1) {
			set .@account_id, .player_list[.@i];
			break;
		}
	}
	if (attachrid(.@account_id)) {
		callsub(OnPCKillEvent);
	}
	end;

OnPCKillEvent:
	.@players = getarraysize(getvariableofnpc(.player_list, "Death Match"));
	if(strcharinfo(3) == "guild_vs2" && getmapusers("guild_vs2") < 2) {
		stopnpctimer;
		announce "Player "+strcharinfo(0)+" won the event 'Death Match' and get "+ .reg_price * .@players +" Zeny!",0;
		set Zeny, Zeny + .reg_price * .@players;
		message strcharinfo(0),"You get "+ .reg_price*.@players +" Zeny!";
		warp "SavePoint",0,0;
		callsub(OnClear);
	}
	end;

}

guild_vs2	mapflag	noteleport
guild_vs2	mapflag	nowarp
guild_vs2	mapflag	nowarpto
guild_vs2	mapflag	nobranch
guild_vs2	mapflag	noicewall
guild_vs2	mapflag	pvp_noguild
guild_vs2	mapflag	pvp_noparty
guild_vs2	mapflag	nomemo
guild_vs2	mapflag	nodrop

 

if(strcharinfo(3) == "guild_vs2" && getmapusers("guild_vs2") < 2) {

try Change 2 > 1

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.01
  • Content Count:  35
  • Reputation:   2
  • Joined:  07/25/15
  • Last Seen:  

Hi @Bringer, tried that but still not announcing the winner. 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

You're script is similar to my Last Man Standing Event, I can't really take a look at the script of yours since I'm in work, but if you want you can check out my script and compare it.

Regards,

Chris

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.01
  • Content Count:  35
  • Reputation:   2
  • Joined:  07/25/15
  • Last Seen:  

This is what I'm looking for Sir @llchrisll! I am now using your script but I have this error in console after I won the event:
image.thumb.png.186fec3163b525da8c80593c48bc8733.png

image.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  626
  • Reputation:   188
  • Joined:  11/19/11
  • Last Seen:  

Weird, have to look at it, it was from eAthena times. But I was sure I tested it anyway.

Edit: I think I know what the problem is: if(attachrid(killerrid) == 1) at line 926 can't work when I detach every player, need to save killerrid in a variable first.

Edited by llchrisll
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...