From 40add9a2181ef5cb2d8804eeb01c0a190d6c8ee5 Mon Sep 17 00:00:00 2001 From: mekolat Date: Wed, 30 Mar 2016 19:52:24 -0400 Subject: slowly getting things done explain the debug spell is deprecated upmarmu typo cooldown fix make maps with updated converter, make nodes update permissions --- world/map/npc/029-2/alchemy.txt | 48 +++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 14 deletions(-) (limited to 'world/map/npc/029-2/alchemy.txt') diff --git a/world/map/npc/029-2/alchemy.txt b/world/map/npc/029-2/alchemy.txt index d0d2909a..3d49d5ae 100644 --- a/world/map/npc/029-2/alchemy.txt +++ b/world/map/npc/029-2/alchemy.txt @@ -1,11 +1,16 @@ -029-2,113,57,0|script|#alchemylab|400 +-|script|_N-Alchemy|32767 { + set @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] == "") @@ -35,13 +40,13 @@ L_Proceed: L_CheckRecipes: set .@n, .@n+3; - if (.@n == get(.rsize, "#alchemylab")) + if (.@n == get(.rsize, "_N-Alchemy")) goto L_Failed; - if (!(get(.recipes$[.@n], "#alchemylab") == @alchlab_items$[0] && get(.recipes$[.@n+1], "#alchemylab") == @alchlab_items$[1]) && - !(get(.recipes$[.@n], "#alchemylab") == @alchlab_items$[1] && get(.recipes$[.@n+1], "#alchemylab") == @alchlab_items$[0])) + 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], "#alchemylab"), 1; // XXX: here we could also make it fail sometimes depending on your expertise + 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; @@ -50,7 +55,7 @@ L_CheckRecipes: mes " ["+ getitemlink(@alchlab_items$[1]) +"]"; mes; mes "You obtained:"; - mes " ["+ getitemlink(get(.recipes$[.@n+2], "#alchemylab")) +"]"; + mes " ["+ getitemlink(get(.recipes$[.@n+2], "_N-Alchemy")) +"]"; close; L_NoItems: @@ -64,15 +69,30 @@ L_Failed: L_Abort: close; -OnInit: - void // the first alchemy lab doesn't need a puppet, it's already on a map - puppet("027-2", 51, 100, strnpcinfo(0)+0, 400), // TODO: make a npc like npc 400 but with hoverCursor="action" => looks better for things like crafting - puppet("001-2", 92, 76, strnpcinfo(0)+1, 400), - puppet("001-2", 98, 76, strnpcinfo(0)+2, 400), - puppet("001-2", 92, 89, strnpcinfo(0)+3, 400), - puppet("001-2", 98, 89, strnpcinfo(0)+4, 400); +S_Spawn: + set .@s, getarraysize(.x1); + if (.spawned == 0) + set .spawned, 1; // FIXME: in tmwa (getarraysize2, setarray) allow to set array index 0 when setting in another npc + if (.spawned >= .@s) + goto S_Return; + set .@n$, "#_Al-lab"+chr(3)+.spawned; + void puppet(.m$[.spawned], .x1[.spawned], .y1[.spawned], .@n$, 400); // TODO: make a npc like npc 400 but with hoverCursor="action" => looks better for things like crafting + set .spawned, .spawned + 1; + if (.spawned < .@s) + goto S_Spawn; + return; + +S_Return: + return; + +OnMaybeStart: + callsub S_Spawn; + if (.started == 0) + goto L_InitVars; + end; - setarray .recipes$[0], +L_InitVars: + setarray .recipes$[0], 0, "DilutedConcentrationPot", "DarkConcentrationPotion", "ConcentrationPotion", "CactusDrink", "CactusDrink", "CactusPotion", "PinkPetal", "BottleOfWater", "ConcentrationPotion"; -- cgit v1.2.3-60-g2f50