Jump to content
  • 0

How to check for first 3 winner of an event ?


Noire

Question


  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  103
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

Request NPC, its like a race Event first 3 players will get the prize and if the NPC already gave the prizes for those 3 it will announce we already have our 3 winners race is event is over domming map now.

 

Example script :

 

job_sword1,223,167,2 script  92,{

mapannounce "job_sword1","Player " + strcharinfo(0) + ", You have successfully finish all course you came up 1st Place!.",bc_map;

end;

+

mapannounce "job_sword1","Player " + strcharinfo(0) + ", You have successfully finish all course you came up 2nd Place!.",bc_map;

end;

+

mapannounce "job_sword1","Player " + strcharinfo(0) + ", You have successfully finish all course you came up 3rd Place!.",bc_map;

end;

}

Edited by Noire
Link to comment
Share on other sites

13 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

switch ( .winner_count++ ) {
	case 1: 
		mes "You're first winner.";
		break;
	case 2:
		mes "You're second winner.";
		break;
	case 3:
		mes "You're third winner.";
		break;
	default:
		break;
}
warp "prontera",155,181;
end;

you can try something like this.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

You can use global variables for these type of things. Just increase the value of the global variable you used every time it has been done. Set a check that will check the value of the global variable and if it is over 3, it will just end the conversation with the NPC.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  103
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

switch ( .winner_count++ ) {
	case 1: 
		mes "You're first winner.";
		break;
	case 2:
		mes "You're second winner.";
		break;
	case 3:
		mes "You're third winner.";
		break;
	default:
		break;
}
warp "prontera",155,181;
end;

you can try something like this.

 

 

How to reset the counts if i re-open the NPC ( Need to reload the scipt the reset it ) i cant open it anymore and can you add some line to doommap all players who left inside if the npc already got the 3 winners?

Edited by Noire
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

add atcommand "doommap"; on default:

prontera...{

if(getgmlevel() >= 99){ goto GMMenu; }

switch(...){...}

GMMenu:
mes "Reset?";
menu "Yes",-;
set .winner_count,0
close;
end;

}
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  103
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

 

add atcommand "doommap"; on default:

prontera...{

if(getgmlevel() >= 99){ goto GMMenu; }

switch(...){...}

GMMenu:
mes "Reset?";
menu "Yes",-;
set .winner_count,0
close;
end;

}

 

Tried its not working wont reset my characters, still need to reboot my emulator :(

any help?!
Edited by Noire
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  350
  • Reputation:   43
  • Joined:  09/07/12
  • Last Seen:  

set .winner_count,0;

add it on the start of event;

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  103
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

Ok i got it, but can i reset it on different NPC ?

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

Ok i got it, but can i reset it on different NPC ?

possible, use the getvariableofnpc if the variable is a npc scope variables.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  103
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

 

Ok i got it, but can i reset it on different NPC ?

possible, use the getvariableofnpc if the variable is a npc scope variables.

 

Can anyone site example using this code? thjank you :)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  103
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

Up!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  452
  • Reputation:   33
  • Joined:  12/18/14
  • Last Seen:  

Examples are show on the wiki page: https://rathena.org/wiki/Getvariableofnpc

prontera...{
	mes "....reset?"
	menu "Yes",-;
	mes "...done";
	close2;
	set getvariableofnpc(.winner_count, "Test"), 0;
	end;
}

Not tested. First time using the function xD

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

  • 0

  • Group:  Members
  • Topic Count:  35
  • Topics Per Day:  0.01
  • Content Count:  103
  • Reputation:   1
  • Joined:  06/26/13
  • Last Seen:  

Thank you so much !

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