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
|
// rEvolt functions.
// Description:
// Foraging functions.
//
// Just a timer and some graphical effects, don't move while harvesting
// Also need to know the region for the obtainable forage
// Foraging:
// Stone = 100 + (FORAGE_LVL * 1000)
// Pibery = 0 + (FORAGE_LVL * 1000)
// Manana = -100 + (FORAGE_LVL * 1000)
// ...
// Level also reduces the time you must wait.
// For drop chance, luck is added to the level
// And you gain some luck experience when you get a good roll?
// What about other stats? Agility and Vitality in special.
// We also need int and dex to learn cooking >.<
// How about reading books to get INT? (on Library, and once by reading WH Books)
// Some sort of training which you pay some esperins and gain:
// DEX (archery, might reuse Gwendolyn game)
// AGI (running, might reuse Miriam game)
// STR (helping the dock workers)? VIT (resistance)?
function script foraging {
.@npc$ = strnpcinfo(0); // the full name of the spot
// Array of (loot, base chance)
// All rolls are standard RNG rolls (10.000)
// Negative is OK
if (getvariableofnpc(.loot_ids[1], .@npc$) < 1)
{
// default loot: <array: 0, {[loot, probability]..}>
setarray getvariableofnpc(.loot_ids[1], .@npc$),
StoneProjectile, 9500,
StoneProjectile, 8100,
StoneProjectile, 7000,
StoneProjectile, 6400,
Piberries, 4500,
Blueberries, 3800,
Moss, 2400,
Acorn, 1800,
Plushroom, 1200,
MauveHerb, 1000,
AlizarinHerb, 900,
CobaltHerb, 900,
GambogeHerb, 900,
//PumpkinSeeds, 400,
SilkCocoon, 100,
Curshroom, 0,
BugLeg, -100,
Manana, -300,
GrassSeeds, -500,
RawLog, -800,
HardSpike, -1200,
Carrot, -1800;
}
// Cooldown
if (@last_used[getnpcid(.@npc$)] > gettimetick(2) && !is_dev()) {
dispbottom l("You just foraged this spot, please wait %s.", FuzzyTime(@last_used[getnpcid(.@npc$)], 2, 2));
end;
}
getmapxy(.@m$, .@x, .@y, 0);
sit();
dispbottom l("You started foraging. Do not stand nor move until you're done.");
// Wait time. Foraging level can make foraging up to 67% faster
.@wait = 10+rand2(30);
.@wait = (.@wait*1000) - (min(.@wait*2, LVL_FORA) * 300);
// TODO: Play a Foraging Animation or it is just boring
freeloop(true);
for (.@t = 0; .@t < .@wait; .@t += 500) {
if (!issit()) {
dispbottom l("In hurry, you give up foraging.");
end;
}
sleep2(500);
}
freeloop(false);
// Did you move?
if (!isin(.@m$, .@x, .@y, 0)) {
dispbottom l("You left your foraging spot.");
end;
}
// Let the bush recover (5 minutes)
@last_used[getnpcid(.@npc$)] = gettimetick(2) + 300;
// Give you the forage
.@lcount=0;
.@loots=getarraysize(getvariableofnpc(.loot_ids[0], .@npc$));
copyarray(.@loot, getvariableofnpc(.loot_ids[0], .@npc$), .@loots);
.@buff = min(100, LVL_FORA)*((readbattleparam(getcharid(3), UDT_LUK)/2)+1);
.@buff = min(10000, .@buff);
freeloop(true);
for (.@i = .@loots; .@i > 0; .@i -= 2) {
if (.@i == 1) continue;
// Foraging level multiplies luck with bonus
// But getting a loot inflict a 5% penalty on next loot roll
.@luck = rand2(10000) + (.@lcount*500) - .@buff;
if (.@luck < .@loot[.@i-1]) {
getitem .@loot[.@i-2], 1;
.@lcount+=1;
}
}
freeloop(false);
dispbottom l("You have foraged some items!");
EXP_FORA+=1;
return;
}
// This should not be here
000-1,73,113,0 script #forage001 NPC_NO_SPRITE,{
foraging();
OnInit:
.distance=1;
end;
}
// Drasil spots
000-1,33,112,0 duplicate(#forage001) #forage002 NPC_NO_SPRITE
000-1,67,97,0 duplicate(#forage001) #forage003 NPC_NO_SPRITE
000-1,55,90,0 duplicate(#forage001) #forage004 NPC_NO_SPRITE
000-1,44,62,0 duplicate(#forage001) #forage005 NPC_NO_SPRITE
000-1,26,36,0 duplicate(#forage001) #forage006 NPC_NO_SPRITE
000-1,42,25,0 duplicate(#forage001) #forage007 NPC_NO_SPRITE
000-1,50,26,0 duplicate(#forage001) #forage008 NPC_NO_SPRITE
000-1,76,29,0 duplicate(#forage001) #forage009 NPC_NO_SPRITE
000-1,81,40,0 duplicate(#forage001) #forage010 NPC_NO_SPRITE
000-1,85,47,0 duplicate(#forage001) #forage011 NPC_NO_SPRITE
// Artis spots
001-1,181,33,0 duplicate(#forage001) #forage012 NPC_NO_SPRITE
001-1,178,59,0 duplicate(#forage001) #forage013 NPC_NO_SPRITE
001-1,156,30,0 duplicate(#forage001) #forage014 NPC_NO_SPRITE
001-1,156,33,0 duplicate(#forage001) #forage015 NPC_NO_SPRITE
001-1,115,31,0 duplicate(#forage001) #forage016 NPC_NO_SPRITE
001-1,112,37,0 duplicate(#forage001) #forage017 NPC_NO_SPRITE
001-1,81,44,0 duplicate(#forage001) #forage018 NPC_NO_SPRITE
001-1,72,62,0 duplicate(#forage001) #forage019 NPC_NO_SPRITE
001-1,103,69,0 duplicate(#forage001) #forage020 NPC_NO_SPRITE
001-1,91,92,0 duplicate(#forage001) #forage021 NPC_NO_SPRITE
001-1,81,117,0 duplicate(#forage001) #forage022 NPC_NO_SPRITE
001-1,95,119,0 duplicate(#forage001) #forage023 NPC_NO_SPRITE
|