Jump to content
  • 0

When pvp ends, the winning party does not teleport


Yukaiii

Question


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   9
  • Joined:  11/20/13
  • Last Seen:  

Could anyone tell me how to resolve this?

the two parties go to pvp... so far so good, but when a party wins the match it is not automatically bounced off the map.

// 1. 3v3 an 5v5 menu to choose from
// 2. Party leader must already have party of 3 or 5 so he can talk to NPC to register.
// 3. If he still do not have party the NPC will say to make party with 3 or 5 members.
// 4. Once he registers the NPC will announce that party (partyname) is waiting for a 3v3 or 5v5 event (whatever he registered on)
// 5. Announcement will be every minute until 15 mins then cancel the registration. Cancellation of registration is also announced when after 15 mins.
// 6. used maps will be guild_vs1-3 and guild_vs2-2. The first to register will choose which map to use and it will be included in the announcement.
// 7. Now the joining party with 3 or 5 members will talk to NPC and if they are complete they are accepted. if they are not complete then the NPC will say to make party with 3 or 5 members (whatever is needed by the first registered party).
// 8. Both teams will be warped at the same time and that is already the start of the match. But Announcement first of "In 1 minute both party A (partyname) and Party B (partyname) will be warped to the Arena and start the match.". Then after 1 minute countdown of "Party recalling in 5", 4 3 2 1 before warp.
// 9. both party leaders will have to pay 3 pcs or 5pcs item 7179 upon registering. Whoever wins will get all 6 pcs (or 10 pcs) 7179 from the NPC. Its like a bet match.



function	script	ValueConvert	{
	set .@num, atoi(""+getarg(0));
	if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
	set .@l, getstrlen(""+.@num);
	for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
		set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
			if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
	}
	return .@num$;
}


prontera,155,181,5	script	Sample#myro	757,{
set .@gmlevel,getgmlevel();
set .@partyid,getcharid(1);

callsub display_event_info;
next;
switch( select( ( .status == 1 )?"Register":( .status == 2 )?"Join / Quit Match":"",
				( .@gmlevel < .gm_level || .status )?"":"Configurations",
				( .@gmlevel < .gm_level || !.status )?"":"Stop Event" ) ){
	
	Case 1:
		if( getcharid(0) != getpartyleader( .@partyid,2 ) ){
			mes "Only Party Leader can register.";
		}else if( .@partyid == .team[0] ){
			if( !.team[1] ){
				if( select("Quit Match","Cancel") == 1 ){
					set .team[0],0;
					set .status,1;
					stopnpctimer;
					if( $match_amount && $match_itemid ){
						message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid )+".";
						getitem $match_itemid,$match_amount;
					}
					if( $zeny ){
						message strcharinfo(0),"Retrieved "+callfunc( "ValueConvert", $zeny )+" Zeny.";
						set Zeny,Zeny + $zeny;
					}
				}
				
			}else{
				mes "Cant quit since team 2 already joined.";
			}
			close;
		}else{
		
			set .@count,callsub( count_party_member,.@partyid );
			if( .@count != $party_member ){
				mes "Please make a party of ^FF0000"+$party_member+" online members^000000.";
				mes " ";
				mes "You have "+.@count+" members online now.";
				
			}else{
						
				if( $match_itemid )
					if( countitem( $match_itemid ) < $match_amount ){
						mes "You need "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid );
						close;
					}
					
				if( $zeny )
					if( Zeny < $zeny ){
						mes "You need "+callfunc( "ValueConvert", $zeny )+" Zeny";
						close;
					}
					
				if( $match_itemid ){
					set .@amount,$match_amount;
					message strcharinfo(0),"Paid "+callfunc( "ValueConvert", .@amount )+" x "+getitemname( $match_itemid )+".";
					delitem $match_itemid,.@amount;
				}
				
				if( $zeny ){
					message strcharinfo(0),"Total of "+callfunc( "ValueConvert", $zeny )+" Zeny deducted.";
					set Zeny,Zeny - $zeny;
				}
				
				switch( .status ){
					Case 1:
						mes "You may decide the map now.";
						set .map,select( .map_name_menu$ ) - 1;
						mes "Your team has been registered.";
						set .team[0],.@partyid;
						set .status,2;
						set .minute,0;
						initnpctimer;
						break;
					Case 2:
						mes "Your team has joined the match.";
						set .team[1],.@partyid;
						set .status,3;
						stopnpctimer;
						close2;
						donpcevent strnpcinfo(0)+"::OnEventStart";
						end;
						break;
					default: 
						mes "Registration closed.";
						close;
				}
			}
		}
		break;
	Case 2:
		while( 1 ){

			callsub display_event_info;
			next;
			switch( select( "Edit Party Member","Required Item","Required Zeny","^FF0000Start Event^000000" ) ){
				Case 1:
					mes "Enter the Amount of Party Member required.";
					mes "^777777( 0 ~ 10 )^000000";
					input $party_member,0,10;
					break;
				Case 2:
					mes "Enter item ID :";
					do{
						input .@input;
					}while( getitemname( .@input ) == "null" );
					mes "Enter Amount : "+getitemname( .@input );
					mes "^777777( 0 ~ "+callfunc( "ValueConvert", 30000 )+" )^000000";
					input $match_amount,0,30000;
					if( $match_amount ) set $match_itemid,.@input;
					break;
				Case 3:
					mes "Enter Zeny amount :";
					mes "^777777( 0 ~ "+callfunc( "ValueConvert", 10000000 )+" )^000000";
					input $zeny,0,10000000;
					break;
				Case 4:
					if( $party_member < 1 ){
						mes "^FF0000Invalid^000000. Minimum 1 Party Member.";
					}else if( !$match_amount && !$zeny ){
						mes "^FF0000Invalid^000000. Required 1 item or Zeny.";
					}else{
						mes "Event started.";
						announce "An Event has been started by GM, registration are now opened.",0;
						set .status,1;
						close;
					}
					break;
			}
			next;
		}
		break;
	Case 3:
		mes "Event Cancelled";
		close2;
		announce "Event has been cancelled by GM.",0;
		mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
		callsub( clear_variable );
		end;
	default: break;
}
close;


	
OnInit:
	// Minimum GM Level to access cp.
	set .gm_level,80;
	// Map Name List
	setarray .map_name$,"Map 1","Map 2";
	setarray .map_list$,"guild_vs1-3","guild_vs2-2";
	
	// map flag initialize
	set .map_size,getarraysize( .map_list$ );
	for( set .@i,0; .@i < .map_size; set .@i,.@i + 1 ){
		set .map_name_menu$,.map_name_menu$ + .map_name$[.@i] +":";
		setmapflag .map_list$[.@i],mf_partylock;
		setmapflag .map_list$[.@i],mf_nogo;
		setmapflag .map_list$[.@i],mf_pvp;
		setmapflag .map_list$[.@i],mf_battleground,2;
		bg_updatescore .map_list$[.@i],.score[ 0 ],.score[ 1 ];
	}

	// npc locations
	getmapxy( .npc_map$,.npc_x,.npc_y,1 );
	end;

display_event_info:
	mes "^FF0000[ PARTY MATCH EVENT ]^000000";
	mes "Status : ^777777"+(( !.status )?"^FF0000Not Running":( .status == 1 )?"Waiting Team 1":( .status == 2 )?"Waiting Team 2":"Running" )+"^000000";
	if( .status || getgmlevel() >= .gm_level ){
		mes "Party Member : ^777777"+$party_member+"^000000";
		if( .status == 2 ) mes "Location : ^777777"+.map_name$[.map]+"^000000";
	}
	mes " ";
	if( $match_amount ) mes "Required Item : ^777777"+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid )+"^000000";
	if( $zeny ) mes "Required Zeny : ^777777"+callfunc( "ValueConvert", $zeny )+" Zeny^000000";
	if( .status == 2 ) mes "Registration Countdown : "+( 15 - .minute )+" minutes.";
	return;
	
count_party_member:
	set .@getarg,getarg(0);
	
	getpartymember .@getarg,1;
	getpartymember .@getarg,2;
	for( set .@i,0; .@i < $@partymembercount; set .@i,.@i + 1 )
		if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
			set .@count,.@count + 1;
			
	return .@count;

clear_variable:
	set .minute,0;
	set .status,0;
	deletearray .team;
	deletearray .score;
	end;
	
OnTimer60000:
	set .minute,.minute + 1;
	if( .minute < 15 ){
		announce "[ Party : "+getpartyname( .team[0] )+" ] is waiting for a "+$party_member+" vs "+$party_member+" event. ( "+( 15 - .minute )+" minutes to go )",0;
		initnpctimer;
	}else{
		stopnpctimer;
		announce "Event Cancelled, 2 Teams failed to register.",0;
		callsub clear_variable;
	}
	end;
	
OnEventStart:
	announce "Both team success to register for the events. Get ready while you're being warped within 1 minutes.",0;
	sleep 55000;
	
	for( set .@i,5; .@i; set .@i,.@i - 1 ){
		announce " ::: Warp within "+.@i+" seconds ::: ",0;
		sleep 1000;
	}
	
	// re-count for party members..
	set .@count[0],callsub( count_party_member,.team[0] );
	set .@count[1],callsub( count_party_member,.team[1] );
	
	// check party.
	if( .@count[0] != $party_member || .@count[1] != $party_member ){
		announce "Event stopped, one of the registered team doesnt meet the requirements of "+$party_member+" members.",0;
	}else{
		announce "Event Start now......",0;
		warpparty .map_list$[.map],0,0,.team[0];
		warpparty .map_list$[.map],0,0,.team[1];
		deletearray .score;
		bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
		
		sleep 5000;
		mapannounce .map_list$[.map],"Kill all opponent enemy and win the events within 15 minute.",0;
		
		sleep ( 10 * 60000 );
		
		// check and set winner
		if( .score[0] > .score[1] ) set .winner,.team[0];
		else if( .score[0] < .score[1] ) set .winner,.team[1];
		else if( .score[0] == .score[1] ) set .winner,0;
	
		
		// if got winner
		if( .winner ){
			mapannounce .map_list$[.map],"WINNER Party : [ "+getpartyname( .winner )+" ] : Game end.",0;
			
			set .@party_leader,getpartyleader( .winner,1 );
			if( attachrid( .@party_leader ) ){
				if( $zeny ){
					mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", $zeny )+" Zeny",bc_blue;
					set Zeny,Zeny + ( $zeny * 2 );
				}
				if( $match_amount ){
					mapannounce .map_list$[.map],"Party Leader received "+callfunc( "ValueConvert", $match_amount )+" x "+getitemname( $match_itemid ),bc_blue;
					getitem $match_itemid,( $match_amount * 2 ),.@party_leader;
				}
				detachrid;
				
			}else{
				mapannounce .map_list$[.map],"Fail to claim rewards because Party Leader not found / offline.",0;
			}
			
		// draw game
		}else{
			mapannounce .map_list$[.map],"This Game is DRAW !!! No winner.",0;
		}
		
		// clear map users.
		sleep 3500;
		mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
	}
	callsub( clear_variable );

// OnMinute00:
	if( $party_member && ( $match_amount || $zeny ) && !.status ){
		announce "Registration are now opened.",0;
		set .status,1;
	}
	end;
	
OnPCKillEvent:
	if( .status > 2  && strcharinfo(3) == .map_list$[.map] ){
		set .@team,( ( getcharid(1) == .team[0] )? 0:1 );
		mapannounce .map_list$[.map],"[ Party : "+getpartyname( .team[ .@team ] )+" ] "+strcharinfo(0)+" has  "+( ( killedrid == getcharid(3) )?"commit suicide":"killed "+rid2name( killedrid ) )+" .",0;

		set .score[ .@team ],.score[ .@team ] + 1;
		bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
		
		if( attachrid( killedrid ) ){
			sleep2 1000;
			atcommand "@alive";
			warp "Save",0,0;
			detachrid;
		}
		
		if( .score[0] >= $party_member || !.score[1] >= $party_member )
			awake strnpcinfo(0);
	}
// "OnDeath" event
OnRedDead:  callsub L_Dead, .red_score;
OnBlueDead: callsub L_Dead, .blue_score;
L_Dead:
	set getarg(0), getarg(0) -1;
	bg_updatescore "guild_vs3", .red_score, .blue_score;
	bg_leave;
	if ( !getarg(0) )
		awake strnpcinfo(0);
	sleep2 1250;
	percentheal 100,100;
	end;
}

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  22
  • Reputation:   5
  • Joined:  02/22/22
  • Last Seen:  

Can you try this just to test propose ?

replace this :

mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;

to this:

mapwarp .map_list$[.map],"prontera",155,181;

Are you getting any console error ?

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...