diff options
-rw-r--r-- | npc/001-3-1/_import.txt | 1 | ||||
-rw-r--r-- | npc/001-3-1/smith.txt | 28 | ||||
-rw-r--r-- | npc/functions/craft/alchemy.txt | 3 | ||||
-rw-r--r-- | npc/functions/craft/smith.txt | 41 | ||||
-rw-r--r-- | npc/scripts.conf | 2 |
5 files changed, 71 insertions, 4 deletions
diff --git a/npc/001-3-1/_import.txt b/npc/001-3-1/_import.txt index 8b25bdfb1..41049d07a 100644 --- a/npc/001-3-1/_import.txt +++ b/npc/001-3-1/_import.txt @@ -2,3 +2,4 @@ // This file is generated automatically. All manually added changes will be removed when running the Converter. "npc/001-3-1/_warps.txt", "npc/001-3-1/alchemy.txt", +"npc/001-3-1/smith.txt", diff --git a/npc/001-3-1/smith.txt b/npc/001-3-1/smith.txt new file mode 100644 index 000000000..5e5a2a5d3 --- /dev/null +++ b/npc/001-3-1/smith.txt @@ -0,0 +1,28 @@ +// TMW2 scripts. +// Author: +// Jesusalva +// Description: +// Debug functions for Craft Systems + + +001-3-1,52,86,0 script GM Black Smithy NPC_NO_SPRITE,{ + if (!$@GM_OVERRIDE && $EVENT$ == "" && !is_staff()) goto L_Offline; + mesc l("Welcome to Saulc's Magic Smith Table!"); + mesc l("This forge will prepare equipment for you, no skill required!"); + mesc l("What will you craft today?"); + mesc l("You need to have an @@ equipped.", getitemlink(Knife)), 1; + if (AlchemySystem(CRAFT_NPC)) + mesc l("Success!"), 3; + else + mesc l("That didn't work!"), 1; + close; + +L_Offline: + npctalk3 l("Oops! Seems like Saulc doesn't wants you messing on his raging furnaces!"); + close; + +OnInit: + .distance=5; + end; +} + diff --git a/npc/functions/craft/alchemy.txt b/npc/functions/craft/alchemy.txt index d0b8efa01..227e9e546 100644 --- a/npc/functions/craft/alchemy.txt +++ b/npc/functions/craft/alchemy.txt @@ -28,9 +28,6 @@ function script AlchemySystem { if (.@entry < 0) { .success=false; } else { - // Check against COOKING_RECIPES - // using CraftCarpCocktail for example (Craft ID) - // Checking somehow if you know it (array_find?) if (.scope == CRAFT_NPC || .knowledge[.@entry]) { usecraft .@craft; .success=true; diff --git a/npc/functions/craft/smith.txt b/npc/functions/craft/smith.txt new file mode 100644 index 000000000..d75f30d92 --- /dev/null +++ b/npc/functions/craft/smith.txt @@ -0,0 +1,41 @@ +// TMW2 Script +// Author: +// Jesusalva +// Description: +// Smith System (Player, Guild, NPC) +// Notes: +// Base for Evol MR + +// Usage: SmithSystem ({scope}) +// Scopes: CRAFT_NPC, CRAFT_PLAYER, CRAFT_GUILD +// If an invalid scope is passed, .knowledge won't be set but will be required +// Returns true on success, false on failure +function script SmithSystem { + // Set .scope, .knowledge and .success + .scope=getarg(0, CRAFT_PLAYER); + if (.scope == CRAFT_PLAYER) + copyarray(.knowledge,RECIPES_EQUIPMENT,getarraysize(RECIPES_EQUIPMENT)); + else if (.scope == CRAFT_GUILD) + copyarray(.knowledge,$@RECIPES_EQUIPMENT[getcharid(2)],getarraysize($@RECIPES_EQUIPMENT[getcharid(2)])); + .success=false; + + setskin "craft4"; + .@var$ = requestcraft(4); + .@craft = initcraft(.@var$); + .@entry = findcraftentry(.@craft, CRAFT_EQUIPMENT); + if (debug || $@GM_OVERRIDE) mes "found craft entry: " + .@entry; + if (debug || $@GM_OVERRIDE) mes "knowledge value: " + .knowledge[.@entry]; + if (.@entry < 0) { + .success=false; + } else { + if (.scope == CRAFT_NPC || .knowledge[.@entry]) { + usecraft .@craft; + .success=true; + } else { + .success=false; + } + } + deletecraft .@craft; + setskin ""; + return .success; +} diff --git a/npc/scripts.conf b/npc/scripts.conf index 51f620e56..448596ddc 100644 --- a/npc/scripts.conf +++ b/npc/scripts.conf @@ -69,7 +69,7 @@ // Crafting System "npc/functions/craft/alchemy.txt", - +"npc/functions/craft/smith.txt", // custom atcommands "npc/commands/music.txt", |