Jump to content

Recommended Posts

Hello, as promised here is a Trivia auto event.

This script is originally way back from eA, it was adjusted on rA. (All credits in the header)

And now, I decided to Enhance it.

P888Zdq.jpg

- An enhanced version of facts auto event. The Event is announced. The NPC asks 10 random 
- questions from a question bank. Players have to write the answer to the main chat.
- Players don't need to worry about CAPITAL letters.
- 1) Question is asked by the NPC.

l33tzjF.jpg
- 2) If there is no answer after 15 seconds NPC will give a hint.

ahaNusT.jpg
- 3) IF there is still no answer after a hint, the question is skipped.

ZB5wgGq.jpg
- 4) If the right answer is given, the player is announced and the reward is given

2k8BuqW.jpg

 

Side notes:

1) Control

If you have some kind of AutoEbent Controller, I've included the event control methods

OnEventStart:

OnStop:

OnEventTimeOut:

 

If you don't have a controller and just want to test this event, just setup the timers, when this event will run ex:

OnMinute33:

 

2) Rewards

I have special Event points, that I'm giving to the winners.

If you like to give Items or Zeny, I Included the examples in the code

// Winner gets reward in Zeny
//Zeny += 1000000; // Alotta bax ;)

 

3) Questions definition

To define more questions you need to follow this pattern

DefineQuestion("<question>", "<answer>", "<hint>");

 

4) Cheating

I'm aware that this event can be cheated/Automated by players.

Therefore only a modest reward is given :blush:

 

  Reveal hidden contents

Edited by Mystery
Spoiler.

Share this post


Link to post
Share on other sites
function GetQuestion {
	return getd(".question_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
}
function GetAnswer {
	return getd(".answer_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
}
function GetHint {
	return getd(".hint_" + (getarg(0) % 128) + "$[" + (getarg(0) / 128) + "]");
}

I believe you made it opposite ?
assuming that you are still using eathena, when script engine was still 128 elements
it should be

return getd(".question_" + (getarg(0) / 128) + "$[" + (getarg(0) % 128) + "]");

although there is no need to do like this anymore because our script engine no longer has such limitation


2nd thing is ...

L_loop:
	do
		set .@i, rand( .numQuestions ); // Randomly picks a fact.
	while( .Q_session & 1 << .@i && .Q_session && .count < .numQuestions );
	set .Q_session, .Q_session | 1 << .@i;// max 32 questions

rather than using a loop, can use shuffle algorithm

 

EDIT: for below

  Reveal hidden contents

 

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

Thanks Annie,

1 is not me, it is from way back ... eA days

2 will be redone, I will follow Dastgir`s advice and use an array instead of bit manipulation

(will make the script easier to understand for beginners)

 

 

I Already coded it, need to test it

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.