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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
// TMW2 Script
// Author:
// TMW Org. (original code)
// Jesusalva
// Description:
// Crazyfefe will wake up when he smells battle
// Variables:
// $@FEFE_CAVE_LEVEL
// Tracks if a fight is going on, and the current round if true.
// $@FEFE_DELAY
// Tracks the delay between challenges. Also used to start the combat. Set it to zero so you can start fight at once.
// $@FEFE_CAVE_HERO$
// Whoever started a fight. Also used to know if a fight is about to begin.
// $@FEFE_CAVE_PLAYER_COUNT
// How many players are there
// $@FEFE_WAVE
// Current wave
// $@GM_OVERRIDE
// Only possible with @set command, overrides the co-op requeriment. Affects other scripts.
006-1,47,22,0 script Crazyfefe NPC_STATUE_EVILMAN,{
if ($@FEFE_CAVE_LEVEL) goto L_Enjoy;
if ($@FEFE_DELAY > gettimetick(2)) goto L_Wait;
mesn;
mesq l("Who dares to disturb my slumber?");
next;
menu
l("Sorry, sorry! Please rest, great Crazyfefe!"), L_Exit,
l("I do. I want to challenge the Candor Cave!"), L_Next,
l("What is this place anyway?"), L_Explain;
L_Next:
mesn;
mesq l("Very well, but for a fee of @@ GP. There's no free lunch, after all!", .price);
select
rif(is_gm(), l("I'm GM and got the money. START THIS CRAP ALREADY!")),
l("Sorry, I misclicked the first button. Have a nice nap, great Crazyfefe!"),
l("Yeah, I have the money. Give me FIVE minutes, and Bring it on!"),
l("Yeah, I have the money. Give me TEN minutes, and Bring it on!"),
l("Yeah, I have the money. Give me FIFTEEN minutes, and Bring it on!"),
"","",
rif(is_gm(), l("I'm GM and got the money. Gimme HALF HOUR to invite everybody!"));
// Cancel?
if (@menu == 2)
goto L_Exit;
// Already started?
if ($@FEFE_CAVE_LEVEL || $@FEFE_CAVE_HERO$ != "")
goto L_AlreadyStarted;
// Enough money?
if (Zeny < .price)
goto L_NotEnough;
Zeny = Zeny - .price;
// Time delay
$@FEFE_DELAY = gettimetick(2)+300*(@menu-2);
$@FEFE_CAVE_HERO$ = strcharinfo(0);
if (@menu == 1) {
closeclientdialog;
goto L_StartFight;
}
initnpctimer;
announce $@FEFE_CAVE_HERO$+" invites everyone to a challenge against Candor Cave. It'll start in "+FuzzyTime($@FEFE_DELAY,2,2)+". Prepare yourselves!", bc_all|bc_npc;
mesn;
mesq l("Please wait, the fight will start in @@, as requested.", FuzzyTime($@FEFE_DELAY,2,2));
close;
L_StartFight:
if (getmapusers("006-1") < 3 && !$@GM_OVERRIDE)
goto L_NotEnoughPlayers;
$@FEFE_CAVE_LEVEL = 1;
$@FEFE_DELAY = gettimetick(2)+.delay;
$@FEFE_CAVE_PLAYER_COUNT = getmapusers("006-1");
mapannounce("006-1", "The battle is about to begin!", bc_map);
killmonsterall("006-1"); // Saulc likes to spawn stuff to heat stuff up
initnpctimer;
end;
L_Enjoy:
npctalk3 l("Pay attention to the fight, @@!", strcharinfo(0));
if (is_gm())
dispbottom l("Round @@", $@FEFE_CAVE_LEVEL);
end;
L_NotEnough:
mesn;
mesq l("You lack money. Go sell your stuff. And don't ask why a statue needs money!");
close;
L_AlreadyStarted:
mesn;
mesq l("Sorry, @@ already started the fight.", $@FEFE_CAVE_HERO$);
close;
L_Wait:
.@time$=FuzzyTime($@FEFE_DELAY,2,2);
if ($@FEFE_DELAY-gettimetick(2) <= 30) {
npctalk3 l("@@!", .@time$);
end;
}
mesn;
mesq l("Be Patient... You still need to wait @@.", .@time$);
goto L_Exit;
L_NotEnoughPlayers:
mapannounce("006-1", "Oh noes! There's not enough players. Fight aborted, no refunds!", bc_map);
goto L_CleanUp;
L_Explain:
mesn;
mesq l("I am @@, guardian of Candor Cave. Below this cave, lies the legendary Fefe, arch-wizard from the Great War.", .name$);
next;
mesn;
mesq l("During the war, the Monster King cursed the place where he died, but he fought back, and cursed the curse.");
next;
mesn;
mesq l("For short, they had a fight with curses, and now there's a talking statue over his grave which can spawn monsters here.");
next;
mesn;
mesq l("If you pay the fee, I'll spawn them, for no longer than 20 minutes. You should not fight alone, instead, you need a group of at least three, because, you know, the curse. Or something.");
next;
menu
l("I need to think about this."), L_Exit,
l("I'm interested."), L_Next;
L_Exit:
close;
// Recalc difficulty
OnSumLevel:
if (ispcdead()) end;
$@FEFE_DIFFICULTY+=BaseLevel; end;
// Check if we're ready for next wave. Otherwise, do this check again after 5 seconds.
L_CaveLogic:
.wtime+=5; // This is looped every 5 s
$@FEFE_CAVE_PLAYER_COUNT = getmapusers("006-1");
// New wave condition: All mobs dead, or 5 minutes have passed
if (mobcount("006-1", "Crazyfefe::OnPetDeath") <= 0 || .wtime >= 240)
goto L_NextRound;
// Victory conditions: Too few players are alive OR twenty minutes went on.
// WARNING, dead players still in cave are counted, we might never finish the fight.
// And a GM might be called to ban everyone inside.
if ($@FEFE_CAVE_PLAYER_COUNT <= any(1,1,1,1,1,1,1,1,1,2) && !$@GM_OVERRIDE || gettimetick(2) >= $@FEFE_DELAY - (60*20)) {
goto L_CleanUp;
}
// Recalculate difficulty
$@FEFE_DIFFICULTY=0;
areatimer "006-1", 20, 20, 70, 60, 10, "Crazyfefe::OnSumLevel";
// reset timer
initnpctimer;
end;
L_NextRound:
.wtime=0;
$@FEFE_WAVE = $@FEFE_WAVE + 1;
// Prepare next round, and reward survivors
$@FEFE_CAVE_LEVEL = $@FEFE_CAVE_LEVEL + $@FEFE_CAVE_PLAYER_COUNT + rand(1,3) + $@FEFE_WAVE;
$@FEFE_DIFFICULTY+=$@FEFE_CAVE_PLAYER_COUNT+$@FEFE_WAVE;
areatimer "006-1", 20, 20, 70, 60, 10, "Crazyfefe::OnReward";
mapannounce "006-1", "The wave nº "+$@FEFE_WAVE+" is starting with " + $@FEFE_CAVE_PLAYER_COUNT + " player(s) left alive." , 0;
goto L_Summon;
// TODO
L_Summon:
.@amount=($@FEFE_CAVE_LEVEL/rand(4,6))+1;
freeloop(true);
for (.@i = 0; .@i < .@amount; ++.@i) {
.@monsterId=Piou;
.@lv=max(1, $@FEFE_DIFFICULTY/10);
// Luck shall interfer with .@lv (up to +20 random levels)
// This prevents from excess of House Maggots, for example
.@lv+=any(0, 0, 0, 1, 1, 2);
//debugmes("[Candor] Difficulty is %d, pool is %d", .@lv, $@FEFE_DIFFICULTY);
switch (.@lv) {
case 1:
case 2:
.@monsterId = any(HouseMaggot, SlimeBlast) ; break;
case 3:
case 4:
//.@monsterId = Wolvern ; break;
.@monsterId = any(AngryScorpion, CaveMaggot, MagicGoblin, ViciousSquirrel, AngryBat) ; break;
case 5:
case 6:
.@monsterId = any(AngryBat, RedSlime, AngryRedScorpion, DesertBandit, Bandit, Sarracenus, VampireBat, Skeleton, GreenSlime) ; break;
case 7:
case 8:
.@monsterId = any(GreenSlime, LavaSlime, Bluepar, RedMushroom, CandiedSlime, RobinBandit, AngryYellowSlime, OldSnake, GrassSnake, BlueSlime) ; break;
case 9:
case 10:
.@monsterId = any(BlueSlime, SaxsoGhost, Snake, BlackSlime, Wolvern, FireSkull, DarkLizard, BlackScorpion) ; break;
case 11:
case 12:
.@monsterId = any(BlackScorpion, DustRifle, DustGatling, DustRevolver) ; break;
case 13:
case 14:
.@monsterId = any(DustRifle, DustGatling, DustRevolver, MountainSnake, Yeti, FallenGuard1, FallenGuard2) ; break;
case 15:
case 16:
.@monsterId = any(FallenGuard1, FallenGuard2, BanditLord, Yeti, WickedMushroom) ; break;
case 17:
case 18:
.@monsterId = any(Forain, GreenDragon, Michel) ; break;
case 19:
case 20:
.@monsterId = any(FafiDragon, BlackMamba, JackO, Terranite) ; break;
default:
.@monsterId = any(Tipiu, GiantMutatedBat, Terranite, Reaper) ; break;
}
areamonster "006-1", 20, 20, 70, 60, strmobinfo(1, .@monsterId), .@monsterId, 1, "Crazyfefe::OnPetDeath";
// We must lower difficulty according to summoned monster. Only 40% is lowered.
$@FEFE_DIFFICULTY=$@FEFE_DIFFICULTY-max(1, .@lv*4);
}
freeloop(false);
initnpctimer;
end;
L_CleanUp:
mapannounce "006-1", "Game over! Who will be the next to fall on Crazyfefe's Cave?", 0;
areatimer "006-1", 20, 20, 70, 60, 10, "Crazyfefe::OnReward";
$@FEFE_CAVE_LEVEL = 0;
$@FEFE_WAVE = 0;
$@FEFE_CAVE_HERO$ = "";
.wtime=0;
killmonster "006-1", "Crazyfefe::OnPetDeath";
stopnpctimer;
initnpctimer;
stopnpctimer;
end;
// Rewards surviving players between rounds, according to performance, and get rid of dead PCs.
OnReward:
if (ispcdead()) {
recovery(getcharid(3));
warp "Save", 0, 0;
end;
}
// Player reward is a random number based on current wave + lvl/50 (1 point ~= 12~8 mobs)
.@prize=rand($@FEFE_WAVE/2,$@FEFE_WAVE) + ($@FEFE_CAVE_LEVEL/50);
Zeny=Zeny+.@prize;
getexp .@prize, rand(1,3);
end;
// Every 5 seconds, handle cave, if fighting. Does nothing when waiting.
OnTimer5000:
if ($@FEFE_CAVE_LEVEL)
goto L_CaveLogic;
end;
// Announces and attempts to start the fight once time run out
//OnTimer30000: // If you need to start without 5 minutes delay, this line must be uncommented.
OnTimer300000:
if ($@FEFE_CAVE_LEVEL > 0) end;
if ($@FEFE_DELAY <= gettimetick(2)) goto L_StartFight;
announce $@FEFE_CAVE_HERO$+" invites everyone to a challenge against Candor Cave. It'll start in "+FuzzyTime($@FEFE_DELAY,2,2)+". Prepare yourselves!", bc_all|bc_npc;
initnpctimer;
end;
OnPetDeath:
end;
OnInit:
.sex=G_OTHER;
.distance=5;
.price=400;
.delay=(60*45);
.wtime=0;
end;
}
|