Jump to content
  • 0

Last Man Standing (lost player received reward)


khoi

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/21/17
  • Last Seen:  

Hello sir, I have problem with Last Man Standing Script. 5 player enter event but the lost player receive the reward and the win player don't get the reward and remain inside last man standing map.Sometime this problem not happen.Hope can help me solve this problem.Thank You.

 

prontera,196,163,3	script	Last Man Standing	100,{
	if ( !.start ) {
		mes "Event Last Man Standing.";
		mes "Time: 4.30 PM";
		mes "Time: 8.15 PM";
		close;
	}
	if ( .start == 2 ) {
		mes "event is running";
		close;
	}
	if ( .register_count >= .register_limit ) {
		mes "this event has reach the maximum player participations";
		close;
	}
	percentheal 100,100;
	announce ""+ strcharinfo(0) +" Has Entered Last Man Standing Event !",bc_all | bc_blue; //announce and end
	warp "pvp_n_3-5", 0,0;
	
	.register_aid[ .register_count ] = getcharid(3);
	.register_count+++;
	end;
OnWhisperGlobal:
	if ( getgmlevel() < 60 ) end;
OnClock1630: // put all your start timer here 4.30PM
OnClock2215: // put all your start timer here 8.15PM
//OnMinute00:
	if ( .start == 2 )
		callsub L_resetmap;
	else if ( .start == 1 )
		end;
	announce "Last Man Standing event registration start in 4 minute", bc_all | bc_blue;
	.start = 1;
	sleep 60000; // registration timer here
	announce "Last Man Standing NPC Event start near poring catcher in 3 minute", bc_all | bc_blue;
	sleep 60000; // registration timer here
	announce "Last Man Standing NPC Event start near poring catcher in 2 minute", bc_all | bc_blue;
	sleep 60000; // registration timer here
	announce "Last Man Standing NPC Event start near poring catcher in 1 minute", bc_all | bc_blue;
	sleep 30000; // registration timer here
	announce "Last Man Standing NPC Event start near poring catcher in 30 seconds", bc_all | bc_blue;
	sleep 30000; // registration timer here
	announce "last Man Standing event registration close", bc_all | bc_blue;
	.start = 2;
	mapannounce "pvp_n_3-5", "Get ready the battle will start in 30 seconds, show NO MERCY", 0;
	sleep 30000;
	mapannounce "pvp_n_3-5", "THIS IS SPARTA !!!!!", 0;
	if ( .register_count < .register_min ) {
		announce "not enough participants for LMS event", 0;
		mapwarp "pvp_n_3-5", .map$, .x, .y;
		callsub L_resetmap;
		end;
	}
	pvpon "pvp_n_3-5";
	end;
OnPCDieEvent:
OnPCLogoutEvent:
	if ( .start != 2 || strcharinfo(3) != "pvp_n_3-5" ) end;
	while ( .register_aid != getcharid(3) && .@i < .register_count ) .@i++;
	deletearray .register_aid[.@i], 1;
	.register_count--;
	warp "SavePoint", 0,0;
	if ( .register_count > 1 ) end;
	killmonsterall "pvp_n_3-5";
	announce "congratulations ~ the winner of Last Man Standing event is "+ rid2name( .register_aid ), bc_all | bc_blue;
	getitem .reward_item_id, .reward_item_amount, .register_aid; // winner prize
	warpchar "SavePoint", 0,0, getcharid( 0, rid2name( .register_aid ) );
	callsub L_reset;
	end;
L_resetmap:
	mapwarp "pvp_n_3-5", .map$, .x, .y;
L_reset:
	.start = 0;
	deletearray .register_aid;
	.register_count = 0;
	pvpoff "pvp_n_3-5";
	return;


OnTimer1000:
delwaitingroom;
waitingroom getmapusers("pvp_n_3-5")+" player has enter..",0;
initnpctimer;
end;

OnInit:
	getmapxy .map$, .x, .y, 1;
	.register_min = 2; // minimum amount of players to start this event, or else it auto-abort
	.register_limit = 100; // maximum amount of players able to participate in this event
	.reward_item_id = 7539;
	.reward_item_amount = 1;
	initnpctimer;
	end;
}
pvp_n_3-5	mapflag	nosave	SavePoint
pvp_n_3-5	mapflag	nowarp
pvp_n_3-5	mapflag	nowarpto
pvp_n_3-5	mapflag	noteleport
pvp_n_3-5	mapflag	nomemo
pvp_n_3-5	mapflag	nopenalty
//pvp_n_3-5	mapflag	nobranch
pvp_n_3-5	mapflag	noicewall
pvp_n_3-5	mapflag	pvp_noparty
pvp_n_3-5	mapflag	pvp_noguild

 

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

There are some things in the script that can lead to a failure.

Take my advice and remove everything connected with the array .register_aid. Just use getmapusers() whenever a player dies or disconnects.

And you should check in OnPCLogoutEvent if the player is on the last_man_standing map since this event can be triggered by everyone on the server.

Edited by Jey
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  6
  • Reputation:   0
  • Joined:  02/21/17
  • Last Seen:  

@Jey Thanks showed that need to be change.I will try edit the script 

 

how can i get player name in specific map?

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  249
  • Reputation:   72
  • Joined:  10/20/12
  • Last Seen:  

Place the checking npc in the last man standing map and use addrid(1); .

This will attach all players on the map of the npc. Since there is one player left, you will attach a single player only.

Edited by Jey
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...