From e01b16bfa45a3bdf2ecd9b46cfc623f246c8c554 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 30 Jun 2018 23:41:15 -0300 Subject: Start fixing Shovel for use --- npc/items/shovel.txt | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'npc/items/shovel.txt') diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt index f01a0fcbe..f510d2f1b 100644 --- a/npc/items/shovel.txt +++ b/npc/items/shovel.txt @@ -1,6 +1,8 @@ +// TMW2 Script // Evol scripts. // Author: // Travolta +// Jesusalva // Description: // NPC to use shovel (dig, bury etc) @@ -44,7 +46,7 @@ function PlayerIsTired { .@tick = gettimetick(1); - .@playertick = .PlayerTiredTime - readparam(bStr); + .@playertick = .PlayerTiredTime - (readparam(bStr)/5); if (@ShovelLastUsed + max(4, .@playertick) > .@tick) { narrator S_FIRST_BLANK_LINE, @@ -84,19 +86,24 @@ function Bury { narrator S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE, l("What would you like to bury?"); .@items$ = ""; - getinventorylist; - for (.@i = 0; .@i < @inventorylist_count; .@i++) - { - .@items$ = .@items$ + getitemname(@inventorylist_id[.@i]) + ":"; - debugmes getitemname(@inventorylist_id[.@i]); + + mes "##B" + l("Drag and drop an item from your inventory.") + "##b"; + + .@id = requestitem(); + + if (.@id < 1 || countitem(.@id) < 1 || .@id == IronShovel) { + if (.@id == IronShovel) + mesc l("Uh... You can't bury your own shovel!"); + else + mesc l("You give up."); + return -6; } - .@idx = select(.@items$) - 1; - .@id = @inventorylist_id[.@idx]; + .@amount = 1; - if (@inventorylist_amount[.@idx] > 1) + if (countitem(.@id) > 1) { narrator S_FIRST_BLANK_LINE | S_LAST_BLANK_LINE, l("Amount?"); - input .@amount, 1, @inventorylist_amount[.@idx]; + input .@amount, 1, countitem(.@id); } getmapxy(.@map$, .@x, .@y, 0); @@ -133,15 +140,13 @@ } OnUse: - if (!CheckDigLocation()) - { + if (!CheckDigLocation()) { message strcharinfo(0), l("I can't use the shovel here."); close; } narrator S_LAST_BLANK_LINE, - l("You hold the shovel in your hands."), - l("What are you going to do?"); + l("You hold the shovel in your hands. What are you going to do?"); .@action = select( l("Dig."), -- cgit v1.2.3-60-g2f50