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
|
029-2,33,88,24,7 monster HouseMaggot 1050,2,100000,30000,Barrel#0::OnMaggotDeath
- script #BarrelConfig NPC32767,{
end;
OnInit:
setarray $@BarrelBits, (1 << 20), (1 << 21), (1 << 22), (1 << 23), (1 << 24), (1 << 25), (1 << 26), (1 << 27);
setarray $@BarrelRewards, 533, 507, 505, 518, 537, 526;
$@BarrelSpawnCnt = 1;
$@BarrelSpawnId = 1050;
$@BarrelSpawnName$ = "House Maggot";
$@BarrelMax = getarraysize($@BarrelBits);
end;
}
function script CountBarrels {
@barrel_count = 0;
@count_tmp = 0;
goto L_Loop;
L_Loop:
if (STARTAREA & $@BarrelBits[@barrel_count])
goto L_AddOne;
goto L_LoopAgain;
L_AddOne:
@barrel_count = (@barrel_count + 1);
goto L_LoopAgain;
L_LoopAgain:
@count_tmp = (@count_tmp + 1);
if (@count_tmp == getarraysize($@BarrelBits))
goto L_BarrelTally;
goto L_Loop;
L_BarrelTally:
return;
}
function script CheckBarrel {
@npc_distance = 2;
callfunc "PCtoNPCRange";
if(@npc_check) goto L_Return;
if (!(QL_ZEGAS == 2))
goto L_NoI;
if (STARTAREA & $@BarrelBits[@barrel])
goto L_Empty;
STARTAREA = STARTAREA | $@BarrelBits[@barrel];
callfunc "CountBarrels";
if (@barrel_count == $@BarrelMax)
goto L_QuestReward;
@player_random = rand(@barrel_count * 10);
@barrel_random = rand(@barrel_count * $@BarrelMax);
if (@barrel_random > @player_random)
goto L_Spawn;
goto L_Reward;
L_NoI:
message strcharinfo(0), "Nothing interesting here.";
goto L_Return;
L_Empty:
message strcharinfo(0), "You've already searched this barrel.";
goto L_Return;
L_QuestReward:
message strcharinfo(0), "You found the bug bomb.";
misceffect 33;
QL_ZEGAS = 3;
killmonster getmapname() + "", "Barrel#0::OnMaggotDeath";
goto L_Return;
L_Spawn:
message strcharinfo(0), "Uck, More Maggots!";
setarray @npc_loc, getnpcx(), getnpcy();
areamonster getmapname(), @npc_loc[0], @npc_loc[1], (@npc_loc[0] + 1), (@npc_loc[1] + 1), $@BarrelSpawnName$, $@BarrelSpawnId, $@BarrelSpawnCnt, "Barrel#0::OnMaggotDeath";
cleararray @npc_loc, 0, 2;
goto L_Return;
L_Reward:
getitem $@BarrelRewards[rand(getarraysize($@BarrelRewards))], 1;
goto L_Return;
L_Return:
return;
}
|