summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xnpc/002-2/stranger.txt4
-rwxr-xr-xnpc/029-2/alchemy.txt98
-rw-r--r--npc/functions/main.txt5
3 files changed, 7 insertions, 100 deletions
diff --git a/npc/002-2/stranger.txt b/npc/002-2/stranger.txt
index 98c9ffd7..8be7ac21 100755
--- a/npc/002-2/stranger.txt
+++ b/npc/002-2/stranger.txt
@@ -150,8 +150,8 @@ L_Towel:
mes "\"What is the most important item for every hitchhiker to have?\"";
mes "";
mes "##BDrag & drop the item from your inventory##b.";
- requestitem .@answer$[0];
- if (.@answer$[0] != "Towel" && .@answer$[0] != "HitchhikersTowel")
+ .@answer=requestitem();
+ if (.@answer != Towel && .@answer != HitchhikersTowel)
goto L_Wrong_Answer;
mes "[Stranger]";
diff --git a/npc/029-2/alchemy.txt b/npc/029-2/alchemy.txt
deleted file mode 100755
index f9799252..00000000
--- a/npc/029-2/alchemy.txt
+++ /dev/null
@@ -1,98 +0,0 @@
-- script _N-Alchemy NPC32767,{
- @npc_distance = 1;
- callfunc "PCtoNPCRange";
- if (@npc_check) end;
-
- title "Alchemy Lab";
- mes "This is an alchemy lab.";
- mes "With it, you can combine reagents together to create powerful potions.";
- next;
- clear;
- mes "##BDrag & drop 2 items from your inventory. All items used will be lost.##b";
- cleararray @alchlab_items$[0], "", 2; // since we're not using a scoped (.@) array, we need to clean it
- requestitem @alchlab_items$[0], 2; // TODO: add a craft builtin (npc action 12)
- clear;
- if (@alchlab_items$[0] == "" || @alchlab_items$[1] == "")
- goto L_NoItems;
-
- mes "You are about to combine the following:";
- mes " ["+ getitemlink(@alchlab_items$[0]) +"]";
- mes " ["+ getitemlink(@alchlab_items$[1]) +"]";
- mes;
- mes "##BWarning! This will permanently destroy the selected items.##b";
- // can not use a scope variable to store item names because menu is a script terminator (destroys the scope)
- menu
- "Abort Mission.", L_Abort,
- "Proceed.", L_Proceed;
-
-L_Proceed:
- // XXX: here we could make it wait a little, while the potion is boiling (and show an animation/particles/sound)
- if (countitem(@alchlab_items$[0]) < 1 || countitem(@alchlab_items$[1]) < 1) // this shouldn't happen, but just to be safe..
- goto L_NoItems;
- delitem @alchlab_items$[0], 1;
- delitem @alchlab_items$[1], 1;
- if (@alchlab_items$[0] == "BottleOfWater" || @alchlab_items$[1] == "BottleOfWater") // give back used bottles
- getitem "EmptyBottle", if_then_else(@alchlab_items$[0] == "BottleOfWater" && @alchlab_items$[1] == "BottleOfWater",2,1);
-
- .@n = -3;
- goto L_CheckRecipes;
-
-L_CheckRecipes:
- .@n = .@n+3;
- if (.@n == get(.rsize, "_N-Alchemy"))
- goto L_Failed;
- if (!(get(.recipes$[.@n], "_N-Alchemy") == @alchlab_items$[0] && get(.recipes$[.@n+1], "_N-Alchemy") == @alchlab_items$[1]) &&
- !(get(.recipes$[.@n], "_N-Alchemy") == @alchlab_items$[1] && get(.recipes$[.@n+1], "_N-Alchemy") == @alchlab_items$[0]))
- goto L_CheckRecipes;
-
- getitem get(.recipes$[.@n+2], "_N-Alchemy"), 1; // XXX: here we could also make it fail sometimes depending on your expertise
-
- // XXX: here we could make it give profession/crafting exp
- clear;
- mes "You combined the following:";
- mes " ["+ getitemlink(@alchlab_items$[0]) +"]";
- mes " ["+ getitemlink(@alchlab_items$[1]) +"]";
- mes;
- mes "You obtained:";
- mes " ["+ getitemlink(get(.recipes$[.@n+2], "_N-Alchemy")) +"]";
- close;
-
-L_NoItems:
- mes "You must put exactly 2 items.";
- close;
-
-L_Failed:
- mes "The potion bubbles violently and evaporates."; // XXX: here we could have random failure messages
- close;
-
-L_Abort:
- close;
-
-S_Spawn:
- .@s = getarraysize(.x1);
- if (.spawned >= .@s)
- goto S_Return;
- .@n$ = "#_Al-lab"+chr(3)+.spawned;
- if (puppet(.m$[.spawned], .x1[.spawned], .y1[.spawned], .@n$, 399) < 1) mapexit;
- .spawned = .spawned + 1;
- if (.spawned < .@s)
- goto S_Spawn;
- return;
-
-S_Return:
- return;
-
-OnMaybeStart:
- callsub S_Spawn;
- if (.started == 0)
- goto L_InitVars;
- end;
-
-L_InitVars:
- setarray .recipes$[0], 0,
- "DilutedConcentrationPot", "DarkConcentrationPotion", "ConcentrationPotion",
- "CactusDrink", "CactusDrink", "CactusPotion",
- "PinkPetal", "BottleOfWater", "ConcentrationPotion";
- .rsize = getarraysize(.recipes$);
- end;
-}
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index 2bac9b29..d4fef57f 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -588,6 +588,11 @@ function script wgm {
return;
}
+function script registercmd {
+ bindatcmd getarg(0), getarg(1), getarg(2, 0);
+ return;
+}
+
//////////////////////////////////////////////////////////////////////
// maptimer("<map>", <tick>, "<npc>::<event>")
function script maptimer {