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
|
//-----------------------------------------------------------------------------
// Illia Forsaken Inn - Chest room
// $@illia_progress = 8
//
// Level progress:
// No progress: Players pick the rewards, then leave,
// with the Hero forced to leave last.
// @illia_got_rewards value:
// 0: player did not pick his reward yet
// 1: player picked his common rewards
// 2: player picked his unique rewards
// 3: player choosed to leave the room
//-----------------------------------------------------------------------------
052-2.gat,136,73,0|script|Chest|111,
{
set @step, 8;
if ($@illia_progress < @step) goto L_ShouldNotBeHere;
if (@illia_got_rewards > 2) end;
if (@illia_got_rewards == 2) goto L_AlreadyGotReward;
if (@illia_current_num_rewards > 0) goto L_ResumePick;
set @illia_current_num_rewards, 0;
mes "You find an opened chest which seems full of equipments.";
next;
mes "You realize again you were not the first one to visit this place. But where the others failed, you succeeded.";
goto L_Pick;
L_ShouldNotBeHere:
percentheal -100, 0;
end;
onInit:
setarray $@illia_item_common_rewards, 601, 636, 637, 638, 639, 625, 626, 658, 571, 579, 876, 782, 545, 758, 4028, 602, 536, 720, 532, 570, 642;
setarray $@illia_item_unique_rewards, 877, 878, 879, 880;
end;
L_ResumePick:
mes "Ok. I should continue to dig in this chest...";
menu
"... and quickly.", L_GetReward,
"... or maybe not. I am out of time.", L_AskLeaving,
"... but I can't carry more stuff.", L_AskLeaving,
"... no, wait a minute.", -;
close;
L_Pick:
menu
"Let's take what I deserve for all this.", L_GetReward,
"Wait.", -;
close;
L_GetReward:
if (@illia_got_rewards == 0)
goto L_GetCommonReward;
if (@illia_got_rewards == 1)
goto L_GetUniqueReward;
close;
L_GetCommonReward:
if (@illia_current_num_rewards == $@illia_num_common_reward_items)
goto L_RewardDone;
getinventorylist;
set @reward, $@illia_item_common_rewards[rand(getarraysize($@illia_item_common_rewards))];
if ((checkweight(@reward, 1) == 0) || (@inventorylist_count == 100))
goto L_InventoryNoSpace;
set @illia_current_num_rewards, @illia_current_num_rewards + 1;
getitem @reward, 1;
mes "You found a " + getitemname(@reward) + "!";
set @reward, 0;
goto L_GetCommonReward;
L_GetUniqueReward:
if (@illia_current_num_rewards == $@illia_num_unique_reward_items)
goto L_RewardDone;
if (Illia_Uniques_Count >= 2)
goto L_GetUniqueReward2;
getinventorylist;
set @reward, $@illia_item_unique_rewards[rand(getarraysize($@illia_item_unique_rewards))];
if ((checkweight(@reward, 1) == 0) || (@inventorylist_count == 100))
goto L_InventoryNoSpace;
next;
mes "You notice an interesting shape hidden under a cover...";
next;
set @illia_current_num_rewards, @illia_current_num_rewards + 1;
getitem @reward, 1;
mes "You found a " + getitemname(@reward) + "!";
set Illia_Uniques_Count, Illia_Uniques_Count + 1;
set @reward, 0;
goto L_GetUniqueReward;
L_GetUniqueReward2:
next;
mes "You find a bunch of gold pieces!";
next;
set Zeny, Zeny + 100000*($@illia_num_unique_reward_items - @illia_current_num_rewards);
getexp 200000*($@illia_num_unique_reward_items - @illia_current_num_rewards), 0;
set @illia_current_num_rewards, $@illia_num_unique_reward_items;
goto L_GetUniqueReward;
L_AlreadyGotReward:
mes "I already took my part.";
next;
goto L_AskLeaving;
L_RewardDone:
set @illia_got_rewards, @illia_got_rewards + 1;
set @illia_current_num_rewards, 0;
next;
if (@illia_got_rewards == 1)
goto L_GetUniqueReward;
goto L_AskLeaving; // @illia_got_rewards == 2
L_InventoryNoSpace:
mes "You cannot carry more stuff. Make some room first.";
close;
L_AskLeaving:
mes "It's time to leave this place now.";
next;
// Force the hero to leave last, as this event triggers the end of the quest
// as well as some dialogs from Valia, when the hero returns.
if (strcharinfo(0) == $@ILLIA_HERO$ && getareausers("052-2.gat", 19, 8, 137, 88) > 1)
goto L_WaitHelpersLeave;
goto L_PrepareLeaving;
L_WaitHelpersLeave:
mes "However, I'd better wait my friends leave before I do.";
next;
mes "I prefer to know they left safely this place.";
close;
L_PrepareLeaving:
mes "Use Valia's ring to teleport now?";
menu
"Yes. Time to make her pay for her trick!", L_Leave,
"No, I still need to see things here.", -;
close;
L_Leave:
set @illia_got_rewards, 3;
set @illia_current_num_rewards, 0;
addtimer 1000, "Chest::onMsg1";
addtimer 4000, "Chest::onMsg2";
addtimer 7000, "Chest::onMsg3";
addtimer 9000, "Chest::onFx";
addtimer 10000, "Chest::onRing";
close;
onMsg1:
message strcharinfo(0), "At the moment you are wearing the ring, you start to feel dizzy...";
end;
onMsg2:
message strcharinfo(0), "Who is Luvia? Something isn't right... It looks like your memory is rewritten.";
end;
onMsg3:
message strcharinfo(0), "Damn, this ring! That Valia! Someone...";
end;
onFx:
misceffect FX_MAGIC_BLUE_TELEPORT, strcharinfo(0);
end;
onRing:
warp "007-1.gat", 85 + rand(0,2), 75 + rand(0,2);
if (strcharinfo(0) == $@ILLIA_HERO$)
goto L_ScheduleEnd;
end;
L_ScheduleEnd:
set $@ILLIA_STATUS, 253;
startnpctimer "Valia";
cmdothernpc "#IlliaDaemon", "Toggle";
end;
}
|