Return to Inventory

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Emciel
Posts: 34
Joined: Fri Sep 14, 2012 2:19 am

Re: Return to Inventory

Post by Emciel »

one thing you might want to do is flavour the text and add a sound to when it drops the torch too =)
User avatar
Xzalander
Posts: 62
Joined: Thu Sep 13, 2012 1:27 pm
Location: Yorkshire, United Kingdom

Re: Return to Inventory

Post by Xzalander »

Yeah I noticed that afterward :p
User avatar
vidarfreyr
Posts: 71
Joined: Sat Oct 20, 2012 4:40 am

Re: Return to Inventory

Post by vidarfreyr »

I´m trying to use this script to disarm the players, that is: taking any and all items in hands.

I made a simplified script..
SpoilerShow

Code: Select all

function disarm()
   for champ = 1,4 do
   for slot = 7,8 do
      item = party:getChampion(champ):getItem(slot)
		if item ~= nil then
			for itemSlot = 11,32 do
				if itemSlot < 32 then
					if party:getChampion(champ):getItem(itemSlot) == nil then
						party:getChampion(champ):insertItem(itemSlot,item)
						party:getChampion(champ):removeItem(slot)
				break
					end
				else
					spawn(item,party.level,party.x,party.y,party.facing)
					party:getChampion(champ):removeItem(slot)
					break
				end
			end
		end   
   end    
   end   
end
..and sure enough it removes any item from hands and puts them in inventory. But the script fails when the inventory is full. Returning the error: "string expected, got table". Seems to me that the spawn function can't read the 'item' variable in the same way that the 'insertItem' command does. Any ideas for a workaround? Any other variable type I could use?
User avatar
vidarfreyr
Posts: 71
Joined: Sat Oct 20, 2012 4:40 am

Re: Return to Inventory

Post by vidarfreyr »

..perhaps a use of wildcards would be needed here?
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Return to Inventory

Post by Komag »

it's beyond me but Xanathar can do it
Finished Dungeons - complete mods to play
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Return to Inventory

Post by Xanathar »

Hi :)
the best solution would be:
  • Install grimq (see my signature, it's just a file to be copy/pasted into your dungeon, so don't fear its complexity) Installation notes below.
  • Replace the spawn/removeItem part with the code below:

Code: Select all

local saveditem = grimq.saveItem(item)
party:getChampion(champ):removeItem(slot)
grimq.loadItem(saveditem, party.level, party.x, party.y, party.facing, saveditem.id)
In this way it should handle all the cases like nested containers, scrolls, torches, etc. etc.

How to install grimq:
  • Download the zip from http://code.google.com/p/lualinq/downlo ... -1.3.2.zip
  • Extract grimq.lua, and copy paste its code into a scripting entity in your dungeon called grimq
  • Done :)
    ...
  • (You might also want to change AUTO_ALL_SECRETS=true to AUTO_ALL_SECRETS=false at the top of grimq scripting entity).
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
Post Reply