1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
// TMW-2 Script
// Author:
// Jesusalva
// Description:
// Legendary hero
// I started with 'Greetings, citzen' and then I thought on 4144.
// He would never do such formal, hero-ish introduction. So I decided for something
// more realistic, which sounded like a human hero (ie. a normal player).
012-1,75,58,0 script Andrei Sakar NPC_ANDREI,{
// NLib_question ( )
function NLib_question {
//freeloop(true);
do {
@qid=rand(0,7);
} while (! (2**@qid) & @sortable);
debugmes "Question "+@qid;
@sortable-=(2**@qid);
setarray @ans$, $@NLIBa1$[@qid], $@NLIBa2$[@qid], $@NLIBa3$[@qid], $@NLIBa4$[@qid];
setarray @val, $@NLIBmr1[@qid], $@NLIBmr2[@qid], $@NLIBmr3[@qid], $@NLIBmr4[@qid];
/*
@nm=15;
@i=0;
debugmes "BG WHILE S00002";
while (@nm > 0) {
do {
@nai=rand(0,3);
} while ((2**@nai) & @nm);
debugmes "BG WS2 NODE";
@nm-=@nai;
@ans$[@i]=@as$[@nai];
@val[@i]=@nai;
}
debugmes "BG NO FREE LOOP";
//freeloop(false);
*/
// Final: @ans$ ; @val ; @qid
// Question, menuret, QID
mes "";
addtimer(30000, "Andrei Sakar::OnTooLong");
.@q=getq3(Q_NivalisLibday);
setq3 Q_NivalisLibday, .@q-7;
mesn;
mesq $@NLIBqs$[@qid];
menuint
@ans$[0], @val[0],
@ans$[1], @val[1],
@ans$[2], @val[2],
@ans$[3], @val[3];
mes "";
deltimer("Andrei Sakar::OnTooLong");
if (@menuret == 1) {
.@q=getq3(Q_NivalisLibday);
setq3 Q_NivalisLibday, .@q+7;
mesn;
mesq l("That's right.");
next;
} else {
mesn;
mesq l("Sorry, but that's wrong.");
close;
}
debugmes "BG END";
// end
}
mesn l("Andrei Sakar, Legendary Hero");
if ($NLIB_DAY || ($@GM_OVERRIDE && is_admin())) goto L_Quizz;
L_Default:
if (strcharinfo(0) == $MOST_HEROIC$)
mesq l("Hi, @@.", strcharinfo(0));
else
mesq l("Hi.");
close;
L_Quizz:
.@q=getq3(Q_NivalisLibday);
if (.@q == 0) {
setq3 Q_NivalisLibday, 100;
.@q=100;
} else if (.@q > 100) {
goto L_Default;
}
mesq l("We are assembling forces to take Nivalis back.");
mesq l("I'll make you five questions about lore and general knowledge. You'll have 30 seconds to read and answer each.");
mesq l("If you finish everything, and answer everything right, you may get a reward.");
mesq l("If you take too long you'll be penalized.");
mesq l("Do you want to start?");
next;
if (askyesno() == ASK_NO)
close;
setarray @sortable, 255;
NLib_question();
NLib_question();
NLib_question();
NLib_question();
NLib_question();
mesn;
.@q=getq3(Q_NivalisLibday);
// You cannot go above 100 points.
if (.@q > 100) {
mesq l("...More bugs.");
mesc l("A bug was found. Aborting script."), 1;
close;
} else if (.@q == 100) {
mesq l("Congratulations. You really know about the world lore.");
getitem HastePotion, 2;
getitem StrengthPotion, 2;
getitem Bread, 5;
} else if (.@q > 90) {
mesq l("Outstanding. Congratulations.");
getitem HastePotion, 2;
getitem StrengthPotion, 2;
getitem Bread, 4;
} else if (.@q > 75) {
mesq l("Good, knowing the world lore is important.");
getitem HastePotion, 1;
getitem StrengthPotion, 1;
getitem Bread, 4;
} else if (.@q > 50) {
mesq l("Good job.");
getitem HastePotion, 1;
getitem StrengthPotion, 1;
getitem Bread, 2;
} else if (.@q > 25) {
mesq l("Well, that was bad, but at least you know a bit from story.");
getitem Bread, 2;
} else if (.@q > 0) {
mesq l("Terrible. You know almost nothing from world lore...");
getitem Bread, 1;
} else {
mesq l("You really should read the dialogs.");
}
// If you got a negative value, this will default to 1.
getexp .@q*BaseLevel, .@q*JobLevel;
setq3 Q_NivalisLibday, 9999;
close;
OnTooLong:
.@q=getq3(Q_NivalisLibday);
setq3 Q_NivalisLibday, .@q-21;
npctalk3 l("You took too long to answer.");
close;
OnInit:
.sex = G_MALE;
.distance = 5;
/* Because I was lazy to calculate array size, it is hard-coded to eight questions numbered from 0 to 7.
setarray $@NLIBqs$;
setarray $@NLIBa1$;
setarray $@NLIBa2$;
setarray $@NLIBa3$;
setarray $@NLIBa4$;
setarray $@NLIBmr1;
setarray $@NLIBmr2;
setarray $@NLIBmr3;
setarray $@NLIBmr4;
*/
end;
}
|