summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--npc/functions/treasure.txt206
1 files changed, 206 insertions, 0 deletions
diff --git a/npc/functions/treasure.txt b/npc/functions/treasure.txt
index 489c3c407..fbcf80bec 100644
--- a/npc/functions/treasure.txt
+++ b/npc/functions/treasure.txt
@@ -75,3 +75,209 @@ function script TreasureBox {
return;
}
+//////////////////////////////
+// Dungeon's Points Of Interest
+// A Point Of Interest is a temporary duplicate NPC which is randomly
+// created & assigned to key points and contains minor stuff you can loot.
+// #DungeonPOI controls the duplication, and #DungeonPOI_Type<%02d> is the type
+boss,0,0,0 script #DungeonPOI_Type01 NPC_NO_SPRITE,0,0,{
+ // Someone already looted this before you
+ if (.empty) end;
+ // You are the first one looting this, so provision space
+ inventoryplace NPCEyes, 1;
+ inventoryplace Iten, 1;
+ // No one else can now loot this
+ .empty = true;
+ // Retrieve the item from Type 1 list
+ // relative_array_random()
+ setarray(.@prizes, 0,
+ TolchiAmmoBox, 100,
+ TrainingAmmoBox, 75,
+ ArrowAmmoBox, 50,
+ IronAmmoBox, 35,
+ BigArrowSack, 20,
+ MysteriousBottle, 7,
+ SmokeGrenade, 7,
+ IronPowder, 3,
+ CottonCloth, 6,
+ TreasureKey, 60,
+ StrangeCoin, 1,
+ PileOfAsh, 5,
+ EverburnPowder, 2,
+ EarthPowder, 2,
+ ShadowHerb, 3
+ );
+ // Some are conditional unlocks
+ if ($ARKIM_ST >= 1400) {
+ array_push(.@prizes, CursedAmmoBox);
+ array_push(.@prizes, 25);
+ }
+ if ($ARKIM_ST >= 2800) {
+ array_push(.@prizes, PoisonAmmoBox);
+ array_push(.@prizes, 15);
+ }
+ if ($ARKIM_ST >= 10000 && $GAME_STORYLINE >= 4) {
+ array_push(.@prizes, ThornAmmoBox);
+ array_push(.@prizes, 5);
+ }
+ if ($ARKIM_ST >= 10000 && $GAME_STORYLINE >= 5) {
+ array_push(.@prizes, BoneAmmoBox);
+ array_push(.@prizes, 1);
+ }
+ // Story-limited content
+ if ($GAME_STORYLINE < 5) {
+ array_push(.@prizes, EmptyBottle);
+ array_push(.@prizes, 5);
+ array_push(.@prizes, MintDonut);
+ array_push(.@prizes, 4);
+ array_push(.@prizes, ChocolateDonut);
+ array_push(.@prizes, 4);
+ array_push(.@prizes, StrawberryDonut);
+ array_push(.@prizes, 4);
+ array_push(.@prizes, ScrollBattlePlansA);
+ array_push(.@prizes, 2);
+ array_push(.@prizes, ScrollCriticalFortuneA);
+ array_push(.@prizes, 2);
+ } else {
+ array_push(.@prizes, MintDonut);
+ array_push(.@prizes, 2);
+ array_push(.@prizes, ChocolateDonut);
+ array_push(.@prizes, 2);
+ array_push(.@prizes, StrawberryDonut);
+ array_push(.@prizes, 2);
+ array_push(.@prizes, EmptyBottle);
+ array_push(.@prizes, 2);
+ }
+ // Decide what you'll find this time
+ .@item = relative_array_random(.@prizes);
+ dispbottom l("You've found a(n) %s.", getitemname(.@item));
+ getitem .@item, 1;
+ // Expire the instance as soon as reasonable
+ .@t = htget($@_DUPES, .name$, 0);
+ if (.@t) {
+ .@t = min(gettimetick(2)+2, .@t);
+ htput($@_DUPES, .name$, .@t);
+ }
+ end;
+
+OnInit:
+ .distance = 1;
+ .empty = false;
+ end;
+
+}
+
+
+boss,0,0,0 script #DungeonPOI_Type02 NPC_NO_SPRITE,0,0,{
+ // Someone already looted this before you
+ if (.empty) end;
+ // You are the first one looting this, so provision space
+ inventoryplace NPCEyes, 1;
+ inventoryplace Iten, 1;
+ // No one else can now loot this
+ .empty = true;
+ // Retrieve the item from Type 2 list
+ // relative_array_random()
+ setarray(.@prizes, 0,
+ Bread, 10,
+ Tomato, 8,
+ Potatoz, 6,
+ ChickenLeg, 5,
+ Cheese, 5,
+ Curshroom, 3,
+ MoubooSteak, 3,
+ SnakeEgg, 2,
+ Orange, 1,
+ Pear, 1,
+ TonoriDelight, 1
+ );
+ // Decide what you'll find this time
+ .@item = relative_array_random(.@prizes);
+ dispbottom l("You've found a(n) %s.", getitemname(.@item));
+ getitem .@item, 1;
+ // Expire the instance as soon as reasonable
+ .@t = htget($@_DUPES, .name$, 0);
+ if (.@t) {
+ .@t = min(gettimetick(2)+2, .@t);
+ htput($@_DUPES, .name$, .@t);
+ }
+ end;
+
+OnInit:
+ .distance = 1;
+ .empty = false;
+ end;
+
+}
+
+
+// Core logic
+- script #DungeonPOI NPC_HIDDEN,{
+ function create_poi;
+ function p;
+ end;
+OnInit:
+ .offset = 0;
+OnClock0551:
+ // 026-2 Impregnable Fortress B2F
+ create_poi("026-2", 44, 30, 1, p(15));
+ create_poi("026-2", 89, 57, 1, p(15));
+ create_poi("026-2", 95, 68, 1, p(15));
+ create_poi("026-2", 48, 89, 1, p(15));
+ create_poi("026-2", 32, 68, 1, p(15));
+ create_poi("026-2", 27, 50, 1, p(15));
+ // 026-0 Impregnable Fortress B0F
+ create_poi("026-0", 91, 69, 2, p(100));
+ create_poi("026-0", 29, 38, 1, p(15));
+ create_poi("026-0", 89, 25, 1, p(30));
+ create_poi("026-0", 97, 25, 1, p(30));
+ // 027-7 Magic Academy Storage Room
+ create_poi("027-7", 34, 41, 1, p(5));
+ create_poi("027-7", 36, 41, 1, p(5));
+ create_poi("027-7", 31, 41, 1, p(5));
+ create_poi("027-7", 34, 41, 1, p(5));
+ create_poi("027-7", 23, 40, 2, p(5));
+ create_poi("027-7", 51, 41, 1, p(5)); // Sack
+ create_poi("027-7", 34, 32, 1, p(5));
+ create_poi("027-7", 36, 32, 1, p(5));
+ create_poi("027-7", 21, 32, 1, p(5));
+ create_poi("027-7", 27, 20, 1, p(5));
+ create_poi("027-7", 34, 20, 1, p(5));
+ create_poi("027-7", 46, 20, 1, p(5));
+ create_poi("027-7", 48, 20, 1, p(5));
+ create_poi("027-7", 58, 20, 1, p(5));
+ // 015-2 Bandit Cave
+ create_poi("015-2", 264, 172, 1, p(40));
+ create_poi("015-2", 266, 170, 1, p(10));
+ create_poi("015-2", 247, 233, 1, p(40));
+ create_poi("015-2", 244, 237, 1, p(20));
+ create_poi("015-2", 260, 237, 1, p(60));
+ if ($GAME_STORYLINE >= 4)
+ create_poi("015-2", 262, 246, 2, p(20));
+ // I have no idea how Kamelot would behave to this!!
+ // Same for Gemini Sisters
+ // Tests must be done first
+ end;
+
+// p({base}) aka. probability given storyline step (with rounding)
+function p {
+ return getarg(0) * min(5, max(1, $GAME_STORYLINE)) / 5;
+}
+
+// create_poi(map, x, y, type, probability)
+function create_poi {
+ if (rand2(100) > getarg(4)) return;
+ .offset += 1;
+ .@n$ = sprintf("#POI_%06d_%02d_%03d", .offset, .@id, htsize($@_DUPES));
+ .@m$ = getarg(0);
+ .@x = getarg(1);
+ .@y = getarg(2);
+ .@id = getarg(3);
+ npc_duplicate(sprintf("#DungeonPOI_Type%02d", .@id), .@n$, .@m$, .@x, .@y, NPC_NO_SPRITE, 0, 0, 0);
+ htput($@_DUPES, .@n$, gettimetick(2) + 86400);
+ return;
+}
+
+}
+
+