Jump to content
  • 0
skymia

Quest NPC w/ Question & Answer

Question

does anyone have here a script like this?

I saw this npc in Dark-Ro Force...credits to them...I hope someone have this type of script...thanks

  1. Pay an application Fee (5 Milion Zenies).
  2. Show your survival skills (hunt 5 Majestic Goats).
  3. Do a knowledge Test.
  • After paying the fees you need to delivery 5 Majestic Goats (They can be bought at @mall).
  • The last step is the test, you can either answer in small letter (test), in capital letters (TEST), or the normal way (Test), but nothing else will work (i.e teSt). You need at least a 8/10 score to pass the exam. You can't quit the exam before answering all questions. Here are the questions:
  1. What is the special source of energy used by ninjas ?
  2. What is the name of the special eye of the Uchiha clan ?
  3. What is the name of the secret village of the country of Fire ?
  4. What is the prefered jutsu of Naruto ?
  5. How many villages are there in total ?
  6. What is the name of the 'star looking' weapon of the ninjas ?
  7. What is the name of the ultimate warrior/ninja in a particular village ?
  8. What is the name of Kiba's dog ?
  9. Who is the master of Naruto, Sasuke and Sakura ?
  10. What is the name of the nine-tailed demon fox ?
Answers to the question:
  1. chakra
  2. sharingan
  3. konoha
  4. kage bunshin no jutsu
  5. 10
  6. shuriken
  7. kage
  8. akamaru
  9. kakashi
  10. kurama
  • Once you passed on the exam you can choose to be a genin of one country, each country gives a different Head Protector with different status

Item Quest

  1. Headprotector Fire - Country of Fire (Item Effect:+10 STR HP)
    Example:
    31224,_headprotectorfire,Headprotector Fire,4,0,,200,,3,,1,0xFFFFFFFF,7,2,256,,0,1,1621,{bonus bStr,10; bonus bMaxHP,1000;},{},{}

     

  2. Headprotector Wind - Country of Wind (Item Effect:+10 AGI HP)
  3. Headprotector Water - Country of Water. (Item Effect:+10 INT HP)
  4. Headprotector Lightning - Country of Lightning. (Item Effect:+10 LUK HP)
  5. Headprotector Earth - Country of Earth. (Item Effect:+10 VIT HP)
  6. Headprotector Sound - Country of Sound. (Item Effect:+10 DEX HP)

 

 

Edited by skymia
Link to comment
Share on other sites

30 answers to this question

Recommended Posts

  • 1

Little rough, I'm tired... but it works enjoy

 

//===== Script =========================================================================
//= Quizzer
//===== Made by: =======================================================================
//= Z3R0
//===== Current Version: ===============================================================
//= Version: 1.0
//===== Description: ===================================================================
//= rAthena Script Request
//= https://rathena.org/board/topic/112260-quest-npc-w-question-answer
//===== Additional Comments: ===========================================================
//= version 1.0: Initial Attempt
//======================================================================================

prontera,158,173,4	script	Quizzer	92,{ doevent "quizzer_core::OnClick"; }

-	script	quizzer_core	-1,{

	// Function Declarations
	function MesItem;
	function ChkItem;
	function ChkAnswer;

	OnInit:

		// ---------------------------------
		// Configurable Settings
		// ---------------------------------

			// NPC Name to Display
			set(.npc$, "[Quizzer]");

			// Fee to Pay to Begin Quiz
			set(.fee, 5000000);

			// Show # of Question Player is On and Total number of questions?
			set(.ShowQuestionProgress, 1);

			// Number of Answers to Pass Quiz
			set(.NumRightToPass, 8);

			// Required Items Array (Pair: Item_ID, Item_Amount)
			setarray(.required_items[0], 2256, 5); // Here you can setup multiple items in pairs.. (item_id, amount)

			// Array of Questions (Each question must have a corresponding answer)
			setarray(.questions$[0],
				"What is the special source of energy used by ninjas ?",
				"What is the name of the special eye of the Uchiha clan ?",
				"What is the name of the secret village of the country of Fire ?",
				"What is the prefered jutsu of Naruto ?",
				"How many villages are there in total ?",
				"What is the name of the 'star looking' weapon of the ninjas ?",
				"What is the name of the ultimate warrior/ninja in a particular village ?",
				"What is the name of Kiba's dog ?",
				"Who is the master of Naruto, Sasuke and Sakura ?",
				"What is the name of the nine-tailed demon fox ?"
			);

			// Array of Answers (Each Answer must have a corresponding Question)
			setarray(.answers$[0],
				"Chakra",
				"Sharingan",
				"Konoha",
				"Kage bunshin no jutsu",
				"10",
				"Shuriken",
				"Kage",
				"Akamaru",
				"Kakashi",
				"Kurama"
			);

			// Array of Reward Item ID's
			setarray(.rewards[0], 501, 502, 503, 504, 505, 506);
			setarray(.rewards_effects$[0], "+10 STR HP", "+10 AGI HP", "+10 INT HP", "+10 LUK HP", "+10 VIT HP", "+10 DEX HP");

			// STOP!!! DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING!!!!
			// check .ShowQuestionProgress
			if (.ShowQuestionProgress > 1) set(.ShowQuestionProgress, 1);

			// Check .required_items
			if (getarraysize(.required_items) % 2 != 0) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Items in .required_items", bc_all, C_YELLOW); end();
			}

			if (getarraysize(.questions$) != getarraysize(.answers$)) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Questions to Answers", bc_all, C_YELLOW); end();
			}

			if (getarraysize(.rewards) != getarraysize(.rewards_effects$)) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Rewards to Reward Effects", bc_all, C_YELLOW); end();
			}

			set(.error, 0);
			end();



	// Player clicks the initial NPC
	OnClick:
		if (.error) {
			mes("There was an error loading this script. Please contact your server administrator");
			close();
		}

		if (quizzer & 8) {
			mes("You have already completed this trial.");
			close();
		}
		else if (quizzer & 4) doevent("quizzer_core::OnComplete");
		else if (quizzer & 2) doevent("quizzer_core::OnQuiz");
		else if (quizzer & 1) doevent("quizzer_core::OnHunt");
		else doevent("quizzer_core::OnStart");
		end();

	OnStart:
		mes(.npc$);

		if (.fee) {
			mes("You will need " + .fee + " zeny to start this trial.");
			mes("Are you ready to proceed?");
			next();
			switch(select("Yes:No")) {
				case 1:

					if (Zeny < .fee) {
						mes("You do not have enough zeny to start this trial.");
						close();
					}

					set(Zeny, Zeny - .fee);
					set(quizzer, 1);

					mes("I need you to gather these items:");
					for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
						mes( MesItem(.required_items, [email protected]) );
					}
					mes("I await your return");
					close();

				case 2:
				default:
					mes("I knew you weren't capable!");
					close();
			}
		}

	OnHunt:
		mes(.npc$);

		// Determine if they have completed all the required items...
		mes("Checking Requirement Status:");
		for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
			mes(MesItem(.required_items, [email protected]) + " - " + ChkItem(.required_items[[email protected]], .required_items[[email protected]+1]));
		}

		if (@quizzer_no_items == 1) {
			mes("You do not have enough items... You fail!");
			set(@quizzer_no_items, 0);
			close();
		}

		// Passed let's remove the items
		for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
			delitem .required_items[[email protected]], .required_items[[email protected]+1];
		}

		mes("Success! You may now start the quiz!");
		next();
		set(quizzer, quizzer^2);
		doevent("quizzer_core::OnQuiz");
		end();

	OnQuiz:
		mes(.npc$);

		[email protected]_right = 0;

		for([email protected] = 0; [email protected] < getarraysize(.questions$); [email protected]++) {

			if (.ShowQuestionProgress) {
				mes("Question #" + ([email protected]+1) + " / " + getarraysize(.questions$));
			}

			mes(.questions$[[email protected]]);
			input .player_answers$[[email protected]];

			// Let's compare the answer :D
			[email protected]_right += ChkAnswer(.answers$[[email protected]], .player_answers$[[email protected]]);

			mes("Answer Recorded. Next Question");
			next();

		}

		if ([email protected]_right >= .NumRightToPass) {
			set(quizzer, quizzer^4);
			mes("You have passed the quiz!");
			next();
			doevent("quizzer_core::OnComplete");
			end();
		}

		mes("You did not pass the quiz!");
		close();

	OnComplete:
		mes(.npc$);
		mes("Well Done Old Chap!");
		mes("Please select from the following rewards");

		set([email protected]$, "");
		for([email protected] = 0; [email protected] < getarraysize(.rewards); [email protected]++) {
			set([email protected]$, [email protected]$ + getitemname(.rewards[[email protected]]) + " (" + .rewards_effects$[[email protected]] + "):");
		}

		getitem .rewards[select([email protected]$) - 1], 1;
		set(quizzer, quizzer^8);

		mes("Thank you for participating");
		close();

	// getarg(0) = Array
	// getarg(1) = Index
	function MesItem {
		[email protected]_id = getelementofarray(getarg(0), getarg(1));
		[email protected]_amount = getelementofarray(getarg(0), getarg(1) + 1);

		return [email protected]_amount + ( [email protected]_amount > 1 ? "x" : "") + " " + getitemname([email protected]_id);
	}

	// getarg(0) = item_id
	// getarg(1) = amount required
	function ChkItem {
		[email protected] = countitem(getarg(0));

		if ([email protected] >= getarg(1)) {
			return "^000000" + [email protected] + "^000000/^000000" + getarg(1) + "^000000";
		}

		set(@quizzer_no_items, 1);
		return "^FF0000" + [email protected] + "^000000/^000000" + getarg(1) + "^000000";
	}

	// getarg(0) = Answer
	// getarg(1) = Player Answer
	function ChkAnswer {
		if (getarg(0) == getarg(1)) return 1;
		else if (strtoupper(getarg(0)) == getarg(1)) return 1;
		else if (strtolower(getarg(0)) == getarg(1)) return 1;
		else return 0;
	}


}

 

Edited by Z3R0
  • Upvote 3
Link to comment
Share on other sites

  • 0
2 hours ago, skymia said:

does anyone have here a script like this?

I saw this npc in Dark-Ro Force...credits to them...I hope someone have this type of script...thanks

  1. Pay an application Fee (5 Milion Zenies).
  2. Show your survival skills (hunt 5 Majestic Goats).
  3. Do a knowledge Test.
  • After paying the fees you need to delivery 5 Majestic Goats (They can be bought at @mall).
  • The last step is the test, you can either answer in small letter (test), in capital letters (TEST), or the normal way (Test), but nothing else will work (i.e teSt). You need at least a 8/10 score to pass the exam. You can't quit the exam before answering all questions. Here are the questions:
  1. What is the special source of energy used by ninjas ?
  2. What is the name of the special eye of the Uchiha clan ?
  3. What is the name of the secret village of the country of Fire ?
  4. What is the prefered jutsu of Naruto ?
  5. How many villages are there in total ?
  6. What is the name of the 'star looking' weapon of the ninjas ?
  7. What is the name of the ultimate warrior/ninja in a particular village ?
  8. What is the name of Kiba's dog ?
  9. Who is the master of Naruto, Sasuke and Sakura ?
  10. What is the name of the nine-tailed demon fox ?
Answers to the question:
  1. chakra
  2. sharingan
  3. konoha
  4. kage bunshin no jutsu
  5. 10
  6. shuriken
  7. kage
  8. akamaru
  9. kakashi
  10. kurama
  • Once you passed on the exam you can choose to be a genin of one country, each country gives a different Head Protector with different status:
  1. Country of Fire (+10 STR HP)
  2. Country of Wind (+10 AGI HP)
  3. Country of Water. (+10 INT HP)
  4. Country of Lightning. (+10 LUK HP)
  5. Country of Earth. (+10 VIT HP)
  6. Country of Sound. (+10 DEX HP)

 

 

Hello please try this i made it for you :))

 

Quiz Test.txt

Edited by crazyarashi
Link to comment
Share on other sites

  • 0
2 minutes ago, crazyarashi said:

can you send errors :))

and this

  1. Country of Fire (+10 STR HP)
  2. Country of Wind (+10 AGI HP)
  3. Country of Water. (+10 INT HP)
  4. Country of Lightning. (+10 LUK HP)
  5. Country of Earth. (+10 VIT HP)
  6. Country of Sound. (+10 DEX HP)

i put the script in items

image.png.436974f2c3a1a7e49c4b4208cad80dd0.png

dasda.png

Link to comment
Share on other sites

  • 0
3 minutes ago, skymia said:

and this

  1. Country of Fire (+10 STR HP)
  2. Country of Wind (+10 AGI HP)
  3. Country of Water. (+10 INT HP)
  4. Country of Lightning. (+10 LUK HP)
  5. Country of Earth. (+10 VIT HP)
  6. Country of Sound. (+10 DEX HP)

i put the script in items

image.png.436974f2c3a1a7e49c4b4208cad80dd0.png

dasda.png

Test agaiiiin :))

Quiz Test.txt

Link to comment
Share on other sites

  • 0
10 hours ago, crazyarashi said:
prontera,145,173,4	script	Wise Ninja	637,{
	
if( !application ) {
	goto Intro; 
	}
	
	if( application == 1 ) {
	goto Challenge;
	}
	
	if ( application && explanation == 1) {
	goto Challenge2;
	}
	
	if ( application && explanation && challenge == 1){
	goto Quiz;
	}
	
	if ( application && explanation && challenge && passed == 1){
	goto Reward;
	}

	if ( application && explanation && challenge && passed && reward == 1){
	goto Finish;
	}
	
	

Intro:
	mes .npc$;
	mes "Hello, I am travelling shinobi. I am looking for a wise people";
	mes "who can answer all my questions";
	next;
	mes .npc$;
	mes "If you can finish my challenges and answer all my questions";
	mes "I will make you a genin and reward you with a special item";
	next;
	mes .npc$;
	mes "But of course its not for free";
	mes "The application fee for one try is ^FF0000" + .zeny + " z^000000.";
	next;
	mes .npc$;
	mes "Do you want to try answering my questions?";
	next;
		switch(select("Yes I Do!:No Thanks:Ignore Him")) {
			case 1:
				mes .npc$;
				mes "The Application Fee is ^FF0000" + .amount[0] + " z^000000";
				next;
					switch(select("Pay!:I will get the money first")) {
						case 1:
							if(Zeny < .zeny){
								mes .npc$;
								mes "Kid this is not enough!";
								mes "You need^FF0000 " + .zeny$ + " for the application fee^000000";
								close;
						} else {
								mes .npc$;
								set Zeny, Zeny - .zeny[0];
								mes "Okay, This is enough";
								set application,1; 
								next;
								mes .npc$;
								mes "I will think about your challenge";
								mes "come talk to me again in a bit";
								end;
								}
						case 2:
								mes .npc$;
								mes "Okay, come back to me anytime";
								close;
								}
			case 2:
				mes .npc$;
				mes "Are you sure kid?";
				mes "It's once in a lifetime offer";
				close;
			case 3:
				mes .npc$;
				mes "......";
				close;
				}
Challenge:
	set explanation,1;
	mes .npc$;
	mes "So for your challenge, I want you to get me a";
	mes "^00FF005"+ getitemname(.item[0]) +" "+.item_amount[0]+"^000000 ";
	close;

Challenge2:
	if(countitem(.item[0]) == .item_amount){
	mes .npc$;
	delitem .item[0],.item_amount[0]; 
	mes "Oh, I see you have collected all the items for the challenge";
	next;
	mes .npc$;
	mes "Give them to me";
	next;
	mes .npc$;
	mes "You may now take the quiz";
	mes "Talk to me anytime you're ready";
	set challenge,1;
	close;
	} else {
	mes .npc$;
	mes "So for your challenge, I want you to get me a";
	mes "^00FF005"+ getitemname(.item[0]) +" "+.item_amount[0]+"^000000 ";
	close;
	}

Quiz:
mes .npc$;
mes "Are you ready?";
next;
	switch(select("Yes!:No")) {
		case 1:
			mes .npc$;
			mes "Okay, let's start";
			goto Quiz02;
		case 2:
			mes .npc$;
			mes "Okay, whenever youre ready";
			close;
			}
Quiz02:
	set [email protected]$, .answers[[email protected]];
	mes .npc$;
	mes "1st Question";
	mes ".questions[0]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	end;
	next;
	mes .npc$;
	mes "2nd Question";
	mes ".questions[1]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "3rd Question";
	mes ".questions[2]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "4th Question";
	mes ".questions[3]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "5th Question";
	mes ".questions[4]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;	
	mes .npc$;
	mes "6th Question";
	mes ".questions[5]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "7th Question";
	mes ".questions[6]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "8th Question";
	mes ".questions[7]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "9th Question";
	mes ".questions[8]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "10th Question";
	mes ".questions[9]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "The Quiz is done";
	mes "Let me check your answers";
	goto Checking;
	next;

Checking:
	if( score > 7 ){
	mes .npc$;
	mes "Congratulations you passed the quiz";
	set passed, 1;
	close;
	} else {
	mes .npc$;
	set score, 0;
	mes "You Failed the quiz";
	mes "Feel free to try again";
	close;
	}

Reward:
	mes .npc$;
	mes "Congratulations for passing my challenge";
	mes "As a promise here is your reward";
	mes "Select Carefully for your reward";
	next;
		[email protected]_item_size = getarraysize([email protected]$);
		for ([email protected] = 0; [email protected] < [email protected]_item_size; [email protected]++) {
		[email protected]$ = [email protected]$ + ([email protected] > 0 ? ":" : "") + [email protected]$[[email protected]];
		}
		[email protected] = select( [email protected]$ ) - 1;
		mes "You selected : "+ [email protected]_item$[[email protected]];
		getitem .rewardid$[[email protected]],1;
		set reward,1;
		end;
		
		
Finish:
	mes .npc$;
	mes "Congratulations on finishing my challenge";
	mes "I hope you have a nice day";
	close;
	
OnInit:	
set .npc$ = "[ ^0000FFWise Ninja^000000 ]"
setarray .zeny, 5000000 //zeny 
setarray .item, 5160; // challenge item id
setarray .item_amount, 5;	//challenge item amount
setarray .questions, What is the special source of energy used by ninjas ?, What is the name of the special eye of the Uchiha clan ? , What is the name of the secret village of the country of Fire ? , What is the prefered jutsu of Naruto ?, How many villages are there in total ?, What is the name of the 'star looking' weapon of the ninjas ?, What is the name of the ultimate warrior/ninja in a particular village ?, What is the name of Kiba's dog ?, Who is the master of Naruto, Sasuke and Sakura ?, What is the name of the nine-tailed demon fox ?;
setarray .answers, Chakra, Sharingan, Konoha, Kage bunshin no jutsu, 10, Shuriken, Kage, Akamaru, Kakashi, Kurama;
setarray [email protected]$, "Country of Fire", "Country of Wind", "Country of Water", "Country of Lightning", "Country of Earth", "Country of Sound";
setarray .rewardid$, 33001, 33002, 33003, 33004, 33005, 33006;
setarray .effect$, "+10 STR HP", "+10 AGI HP", "+10 INT HP", "+10 LUK HP", "+10 VIT HP", "+10 DEX HP";
.totalreward = 6;
end;
}

I check all Quiz2 and change them all to Quiz02

and here's the new error sir

dasda.png

Link to comment
Share on other sites

  • 0
1 minute ago, skymia said:
prontera,145,173,4	script	Wise Ninja	637,{
	
if( !application ) {
	goto Intro; 
	}
	
	if( application == 1 ) {
	goto Challenge;
	}
	
	if ( application && explanation == 1) {
	goto Challenge2;
	}
	
	if ( application && explanation && challenge == 1){
	goto Quiz;
	}
	
	if ( application && explanation && challenge && passed == 1){
	goto Reward;
	}

	if ( application && explanation && challenge && passed && reward == 1){
	goto Finish;
	}
	
	

Intro:
	mes .npc$;
	mes "Hello, I am travelling shinobi. I am looking for a wise people";
	mes "who can answer all my questions";
	next;
	mes .npc$;
	mes "If you can finish my challenges and answer all my questions";
	mes "I will make you a genin and reward you with a special item";
	next;
	mes .npc$;
	mes "But of course its not for free";
	mes "The application fee for one try is ^FF0000" + .zeny + " z^000000.";
	next;
	mes .npc$;
	mes "Do you want to try answering my questions?";
	next;
		switch(select("Yes I Do!:No Thanks:Ignore Him")) {
			case 1:
				mes .npc$;
				mes "The Application Fee is ^FF0000" + .amount[0] + " z^000000";
				next;
					switch(select("Pay!:I will get the money first")) {
						case 1:
							if(Zeny < .zeny){
								mes .npc$;
								mes "Kid this is not enough!";
								mes "You need^FF0000 " + .zeny$ + " for the application fee^000000";
								close;
						} else {
								mes .npc$;
								set Zeny, Zeny - .zeny[0];
								mes "Okay, This is enough";
								set application,1; 
								next;
								mes .npc$;
								mes "I will think about your challenge";
								mes "come talk to me again in a bit";
								end;
								}
						case 2:
								mes .npc$;
								mes "Okay, come back to me anytime";
								close;
								}
			case 2:
				mes .npc$;
				mes "Are you sure kid?";
				mes "It's once in a lifetime offer";
				close;
			case 3:
				mes .npc$;
				mes "......";
				close;
				}
Challenge:
	set explanation,1;
	mes .npc$;
	mes "So for your challenge, I want you to get me a";
	mes "^00FF005"+ getitemname(.item[0]) +" "+.item_amount[0]+"^000000 ";
	close;

Challenge2:
	if(countitem(.item[0]) == .item_amount){
	mes .npc$;
	delitem .item[0],.item_amount[0]; 
	mes "Oh, I see you have collected all the items for the challenge";
	next;
	mes .npc$;
	mes "Give them to me";
	next;
	mes .npc$;
	mes "You may now take the quiz";
	mes "Talk to me anytime you're ready";
	set challenge,1;
	close;
	} else {
	mes .npc$;
	mes "So for your challenge, I want you to get me a";
	mes "^00FF005"+ getitemname(.item[0]) +" "+.item_amount[0]+"^000000 ";
	close;
	}

Quiz:
mes .npc$;
mes "Are you ready?";
next;
	switch(select("Yes!:No")) {
		case 1:
			mes .npc$;
			mes "Okay, let's start";
			goto Quiz02;
		case 2:
			mes .npc$;
			mes "Okay, whenever youre ready";
			close;
			}
Quiz02:
	set [email protected]$, .answers[[email protected]];
	mes .npc$;
	mes "1st Question";
	mes ".questions[0]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	end;
	next;
	mes .npc$;
	mes "2nd Question";
	mes ".questions[1]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "3rd Question";
	mes ".questions[2]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "4th Question";
	mes ".questions[3]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "5th Question";
	mes ".questions[4]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;	
	mes .npc$;
	mes "6th Question";
	mes ".questions[5]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "7th Question";
	mes ".questions[6]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "8th Question";
	mes ".questions[7]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "9th Question";
	mes ".questions[8]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "10th Question";
	mes ".questions[9]";
	input [email protected]$;
	if ([email protected]$ == [email protected]$) {
	set score, +1; }
	next;
	mes .npc$;
	mes "The Quiz is done";
	mes "Let me check your answers";
	goto Checking;
	next;

Checking:
	if( score > 7 ){
	mes .npc$;
	mes "Congratulations you passed the quiz";
	set passed, 1;
	close;
	} else {
	mes .npc$;
	set score, 0;
	mes "You Failed the quiz";
	mes "Feel free to try again";
	close;
	}

Reward:
	mes .npc$;
	mes "Congratulations for passing my challenge";
	mes "As a promise here is your reward";
	mes "Select Carefully for your reward";
	next;
		[email protected]_item_size = getarraysize([email protected]$);
		for ([email protected] = 0; [email protected] < [email protected]_item_size; [email protected]++) {
		[email protected]$ = [email protected]$ + ([email protected] > 0 ? ":" : "") + [email protected]$[[email protected]];
		}
		[email protected] = select( [email protected]$ ) - 1;
		mes "You selected : "+ [email protected]_item$[[email protected]];
		getitem .rewardid$[[email protected]],1;
		set reward,1;
		end;
		
		
Finish:
	mes .npc$;
	mes "Congratulations on finishing my challenge";
	mes "I hope you have a nice day";
	close;
	
OnInit:	
set .npc$ = "[ ^0000FFWise Ninja^000000 ]"
setarray .zeny, 5000000 //zeny 
setarray .item, 5160; // challenge item id
setarray .item_amount, 5;	//challenge item amount
setarray .questions, What is the special source of energy used by ninjas ?, What is the name of the special eye of the Uchiha clan ? , What is the name of the secret village of the country of Fire ? , What is the prefered jutsu of Naruto ?, How many villages are there in total ?, What is the name of the 'star looking' weapon of the ninjas ?, What is the name of the ultimate warrior/ninja in a particular village ?, What is the name of Kiba's dog ?, Who is the master of Naruto, Sasuke and Sakura ?, What is the name of the nine-tailed demon fox ?;
setarray .answers, Chakra, Sharingan, Konoha, Kage bunshin no jutsu, 10, Shuriken, Kage, Akamaru, Kakashi, Kurama;
setarray [email protected]$, "Country of Fire", "Country of Wind", "Country of Water", "Country of Lightning", "Country of Earth", "Country of Sound";
setarray .rewardid$, 33001, 33002, 33003, 33004, 33005, 33006;
setarray .effect$, "+10 STR HP", "+10 AGI HP", "+10 INT HP", "+10 LUK HP", "+10 VIT HP", "+10 DEX HP";
.totalreward = 6;
end;
}

I check all Quiz2 and change them all to Quiz02

and here's the new error sir

dasda.png

I will up a test server and test it :)) 

Link to comment
Share on other sites

  • 0
21 minutes ago, Z3R0 said:

I wanna take on this challenge tonight possibly. So we will see who wins haha

haha good luck master

Link to comment
Share on other sites

  • 0
7 hours ago, Z3R0 said:

Little rough, I'm tired... but it works enjoy

 

//===== Script =========================================================================
//= Quizzer
//===== Made by: =======================================================================
//= Z3R0
//===== Current Version: ===============================================================
//= Version: 1.0
//===== Description: ===================================================================
//= rAthena Script Request
//= https://rathena.org/board/topic/112260-quest-npc-w-question-answer
//===== Additional Comments: ===========================================================
//= version 1.0: Initial Attempt
//======================================================================================

prontera,158,173,4	script	Quizzer	92,{ doevent "quizzer_core::OnClick"; }

-	script	quizzer_core	-1,{

	// Function Declarations
	function MesItem;
	function ChkItem;
	function ChkAnswer;

	OnInit:

		// ---------------------------------
		// Configurable Settings
		// ---------------------------------

			// NPC Name to Display
			set(.npc$, "[Quizzer]");

			// Fee to Pay to Begin Quiz
			set(.fee, 5000000);

			// Show # of Question Player is On and Total number of questions?
			set(.ShowQuestionProgress, 1);

			// Number of Answers to Pass Quiz
			set(.NumRightToPass, 8);

			// Required Items Array (Pair: Item_ID, Item_Amount)
			setarray(.required_items[0], 2256, 5); // Here you can setup multiple items in pairs.. (item_id, amount)

			// Array of Questions (Each question must have a corresponding answer)
			setarray(.questions$[0],
				"What is the special source of energy used by ninjas ?",
				"What is the name of the special eye of the Uchiha clan ?",
				"What is the name of the secret village of the country of Fire ?",
				"What is the prefered jutsu of Naruto ?",
				"How many villages are there in total ?",
				"What is the name of the 'star looking' weapon of the ninjas ?",
				"What is the name of the ultimate warrior/ninja in a particular village ?",
				"What is the name of Kiba's dog ?",
				"Who is the master of Naruto, Sasuke and Sakura ?",
				"What is the name of the nine-tailed demon fox ?"
			);

			// Array of Answers (Each Answer must have a corresponding Question)
			setarray(.answers$[0],
				"Chakra",
				"Sharingan",
				"Konoha",
				"Kage bunshin no jutsu",
				"10",
				"Shuriken",
				"Kage",
				"Akamaru",
				"Kakashi",
				"Kurama"
			);

			// Array of Reward Item ID's
			setarray(.rewards[0], 501, 502, 503, 504, 505, 506);
			setarray(.rewards_effects$[0], "+10 STR HP", "+10 AGI HP", "+10 INT HP", "+10 LUK HP", "+10 VIT HP", "+10 DEX HP");

			// STOP!!! DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING!!!!
			// check .ShowQuestionProgress
			if (.ShowQuestionProgress > 1) set(.ShowQuestionProgress, 1);

			// Check .required_items
			if (getarraysize(.required_items) % 2 != 0) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Items in .required_items", bc_all, C_YELLOW); end();
			}

			if (getarraysize(.questions$) != getarraysize(.answers$)) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Questions to Answers", bc_all, C_YELLOW); end();
			}

			if (getarraysize(.rewards) != getarraysize(.rewards_effects$)) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Rewards to Reward Effects", bc_all, C_YELLOW); end();
			}

			set(.error, 0);
			end();



	// Player clicks the initial NPC
	OnClick:
		if (.error) {
			mes("There was an error loading this script. Please contact your server administrator");
			close();
		}

		if (quizzer & 8) {
			mes("You have already completed this trial.");
			close();
		}
		else if (quizzer & 4) doevent("quizzer_core::OnComplete");
		else if (quizzer & 2) doevent("quizzer_core::OnQuiz");
		else if (quizzer & 1) doevent("quizzer_core::OnHunt");
		else doevent("quizzer_core::OnStart");
		end();

	OnStart:
		mes(.npc$);

		if (.fee) {
			mes("You will need " + .fee + " zeny to start this trial.");
			mes("Are you ready to proceed?");
			next();
			switch(select("Yes:No")) {
				case 1:

					if (Zeny < .fee) {
						mes("You do not have enough zeny to start this trial.");
						close();
					}

					set(Zeny, Zeny - .fee);
					set(quizzer, 1);

					mes("I need you to gather these items:");
					for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
						mes( MesItem(.required_items, [email protected]) );
					}
					mes("I await your return");
					close();

				case 2:
				default:
					mes("I knew you weren't capable!");
					close();
			}
		}

	OnHunt:
		mes(.npc$);

		// Determine if they have completed all the required items...
		mes("Checking Requirement Status:");
		for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
			mes(MesItem(.required_items, [email protected]) + " - " + ChkItem(.required_items[[email protected]], .required_items[[email protected]+1]));
		}

		if (@quizzer_no_items == 1) {
			mes("You do not have enough items... You fail!");
			set(@quizzer_no_items, 0);
			close();
		}

		// Passed let's remove the items
		for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
			delitem .required_items[[email protected]], .required_items[[email protected]+1];
		}

		mes("Success! You may now start the quiz!");
		next();
		set(quizzer, quizzer^2);
		doevent("quizzer_core::OnQuiz");
		end();

	OnQuiz:
		mes(.npc$);

		[email protected]_right = 0;

		for([email protected] = 0; [email protected] < getarraysize(.questions$); [email protected]++) {

			if (.ShowQuestionProgress) {
				mes("Question #" + ([email protected]+1) + " / " + getarraysize(.questions$));
			}

			mes(.questions$[[email protected]]);
			input .player_answers$[[email protected]];

			// Let's compare the answer :D
			[email protected]_right += ChkAnswer(.answers$[[email protected]], .player_answers$[[email protected]]);

			mes("Answer Recorded. Next Question");
			next();

		}

		if ([email protected]_right >= .NumRightToPass) {
			set(quizzer, quizzer^4);
			mes("You have passed the quiz!");
			next();
			doevent("quizzer_core::OnComplete");
			end();
		}

		mes("You did not pass the quiz!");
		close();

	OnComplete:
		mes(.npc$);
		mes("Well Done Old Chap!");
		mes("Please select from the following rewards");

		set([email protected]$, "");
		for([email protected] = 0; [email protected] < getarraysize(.rewards); [email protected]++) {
			set([email protected]$, [email protected]$ + getitemname(.rewards[[email protected]]) + " (" + .rewards_effects$[[email protected]] + "):");
		}

		getitem .rewards[select([email protected]$) - 1], 1;
		set(quizzer, quizzer^8);

		mes("Thank you for participating");
		close();

	// getarg(0) = Array
	// getarg(1) = Index
	function MesItem {
		[email protected]_id = getelementofarray(getarg(0), getarg(1));
		[email protected]_amount = getelementofarray(getarg(0), getarg(1) + 1);

		return [email protected]_amount + ( [email protected]_amount > 1 ? "x" : "") + " " + getitemname([email protected]_id);
	}

	// getarg(0) = item_id
	// getarg(1) = amount required
	function ChkItem {
		[email protected] = countitem(getarg(0));

		if ([email protected] >= getarg(1)) {
			return "^000000" + [email protected] + "^000000/^000000" + getarg(1) + "^000000";
		}

		set(@quizzer_no_items, 1);
		return "^FF0000" + [email protected] + "^000000/^000000" + getarg(1) + "^000000";
	}

	// getarg(0) = Answer
	// getarg(1) = Player Answer
	function ChkAnswer {
		if (getarg(0) == getarg(1)) return 1;
		else if (strtoupper(getarg(0)) == getarg(1)) return 1;
		else if (strtolower(getarg(0)) == getarg(1)) return 1;
		else return 0;
	}


}

 

Nice master you did it. thanks a lot

thanks also to

crazyarashi

Link to comment
Share on other sites

  • 0
On 8/11/2017 at 1:43 PM, Z3R0 said:

Little rough, I'm tired... but it works enjoy

 

//===== Script =========================================================================
//= Quizzer
//===== Made by: =======================================================================
//= Z3R0
//===== Current Version: ===============================================================
//= Version: 1.0
//===== Description: ===================================================================
//= rAthena Script Request
//= https://rathena.org/board/topic/112260-quest-npc-w-question-answer
//===== Additional Comments: ===========================================================
//= version 1.0: Initial Attempt
//======================================================================================

prontera,158,173,4	script	Quizzer	92,{ doevent "quizzer_core::OnClick"; }

-	script	quizzer_core	-1,{

	// Function Declarations
	function MesItem;
	function ChkItem;
	function ChkAnswer;

	OnInit:

		// ---------------------------------
		// Configurable Settings
		// ---------------------------------

			// NPC Name to Display
			set(.npc$, "[Quizzer]");

			// Fee to Pay to Begin Quiz
			set(.fee, 5000000);

			// Show # of Question Player is On and Total number of questions?
			set(.ShowQuestionProgress, 1);

			// Number of Answers to Pass Quiz
			set(.NumRightToPass, 8);

			// Required Items Array (Pair: Item_ID, Item_Amount)
			setarray(.required_items[0], 2256, 5); // Here you can setup multiple items in pairs.. (item_id, amount)

			// Array of Questions (Each question must have a corresponding answer)
			setarray(.questions$[0],
				"What is the special source of energy used by ninjas ?",
				"What is the name of the special eye of the Uchiha clan ?",
				"What is the name of the secret village of the country of Fire ?",
				"What is the prefered jutsu of Naruto ?",
				"How many villages are there in total ?",
				"What is the name of the 'star looking' weapon of the ninjas ?",
				"What is the name of the ultimate warrior/ninja in a particular village ?",
				"What is the name of Kiba's dog ?",
				"Who is the master of Naruto, Sasuke and Sakura ?",
				"What is the name of the nine-tailed demon fox ?"
			);

			// Array of Answers (Each Answer must have a corresponding Question)
			setarray(.answers$[0],
				"Chakra",
				"Sharingan",
				"Konoha",
				"Kage bunshin no jutsu",
				"10",
				"Shuriken",
				"Kage",
				"Akamaru",
				"Kakashi",
				"Kurama"
			);

			// Array of Reward Item ID's
			setarray(.rewards[0], 501, 502, 503, 504, 505, 506);
			setarray(.rewards_effects$[0], "+10 STR HP", "+10 AGI HP", "+10 INT HP", "+10 LUK HP", "+10 VIT HP", "+10 DEX HP");

			// STOP!!! DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING!!!!
			// check .ShowQuestionProgress
			if (.ShowQuestionProgress > 1) set(.ShowQuestionProgress, 1);

			// Check .required_items
			if (getarraysize(.required_items) % 2 != 0) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Items in .required_items", bc_all, C_YELLOW); end();
			}

			if (getarraysize(.questions$) != getarraysize(.answers$)) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Questions to Answers", bc_all, C_YELLOW); end();
			}

			if (getarraysize(.rewards) != getarraysize(.rewards_effects$)) {
				set(.error, 1);
				announce(strnpcinfo(0) + ": [ERROR] Invalid Number of Rewards to Reward Effects", bc_all, C_YELLOW); end();
			}

			set(.error, 0);
			end();



	// Player clicks the initial NPC
	OnClick:
		if (.error) {
			mes("There was an error loading this script. Please contact your server administrator");
			close();
		}

		if (quizzer & 8) {
			mes("You have already completed this trial.");
			close();
		}
		else if (quizzer & 4) doevent("quizzer_core::OnComplete");
		else if (quizzer & 2) doevent("quizzer_core::OnQuiz");
		else if (quizzer & 1) doevent("quizzer_core::OnHunt");
		else doevent("quizzer_core::OnStart");
		end();

	OnStart:
		mes(.npc$);

		if (.fee) {
			mes("You will need " + .fee + " zeny to start this trial.");
			mes("Are you ready to proceed?");
			next();
			switch(select("Yes:No")) {
				case 1:

					if (Zeny < .fee) {
						mes("You do not have enough zeny to start this trial.");
						close();
					}

					set(Zeny, Zeny - .fee);
					set(quizzer, 1);

					mes("I need you to gather these items:");
					for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
						mes( MesItem(.required_items, [email protected]) );
					}
					mes("I await your return");
					close();

				case 2:
				default:
					mes("I knew you weren't capable!");
					close();
			}
		}

	OnHunt:
		mes(.npc$);

		// Determine if they have completed all the required items...
		mes("Checking Requirement Status:");
		for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
			mes(MesItem(.required_items, [email protected]) + " - " + ChkItem(.required_items[[email protected]], .required_items[[email protected]+1]));
		}

		if (@quizzer_no_items == 1) {
			mes("You do not have enough items... You fail!");
			set(@quizzer_no_items, 0);
			close();
		}

		// Passed let's remove the items
		for([email protected] = 0; [email protected] < getarraysize(.required_items); [email protected]+=2) {
			delitem .required_items[[email protected]], .required_items[[email protected]+1];
		}

		mes("Success! You may now start the quiz!");
		next();
		set(quizzer, quizzer^2);
		doevent("quizzer_core::OnQuiz");
		end();

	OnQuiz:
		mes(.npc$);

		[email protected]_right = 0;

		for([email protected] = 0; [email protected] < getarraysize(.questions$); [email protected]++) {

			if (.ShowQuestionProgress) {
				mes("Question #" + ([email protected]+1) + " / " + getarraysize(.questions$));
			}

			mes(.questions$[[email protected]]);
			input .player_answers$[[email protected]];

			// Let's compare the answer :D
			[email protected]_right += ChkAnswer(.answers$[[email protected]], .player_answers$[[email protected]]);

			mes("Answer Recorded. Next Question");
			next();

		}

		if ([email protected]_right >= .NumRightToPass) {
			set(quizzer, quizzer^4);
			mes("You have passed the quiz!");
			next();
			doevent("quizzer_core::OnComplete");
			end();
		}

		mes("You did not pass the quiz!");
		close();

	OnComplete:
		mes(.npc$);
		mes("Well Done Old Chap!");
		mes("Please select from the following rewards");

		set([email protected]$, "");
		for([email protected] = 0; [email protected] < getarraysize(.rewards); [email protected]++) {
			set([email protected]$, [email protected]$ + getitemname(.rewards[[email protected]]) + " (" + .rewards_effects$[[email protected]] + "):");
		}

		getitem .rewards[select([email protected]$) - 1], 1;
		set(quizzer, quizzer^8);

		mes("Thank you for participating");
		close();

	// getarg(0) = Array
	// getarg(1) = Index
	function MesItem {
		[email protected]_id = getelementofarray(getarg(0), getarg(1));
		[email protected]_amount = getelementofarray(getarg(0), getarg(1) + 1);

		return [email protected]_amount + ( [email protected]_amount > 1 ? "x" : "") + " " + getitemname([email protected]_id);
	}

	// getarg(0) = item_id
	// getarg(1) = amount required
	function ChkItem {
		[email protected] = countitem(getarg(0));

		if ([email protected] >= getarg(1)) {
			return "^000000" + [email protected] + "^000000/^000000" + getarg(1) + "^000000";
		}

		set(@quizzer_no_items, 1);
		return "^FF0000" + [email protected] + "^000000/^000000" + getarg(1) + "^000000";
	}

	// getarg(0) = Answer
	// getarg(1) = Player Answer
	function ChkAnswer {
		if (getarg(0) == getarg(1)) return 1;
		else if (strtoupper(getarg(0)) == getarg(1)) return 1;
		else if (strtolower(getarg(0)) == getarg(1)) return 1;
		else return 0;
	}


}

 

how can i make multiple item in one character? because this script is 1 item per character only sir

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.