[Solved]Filling inventory for testing purposes?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
vidarfreyr
Posts: 71
Joined: Sat Oct 20, 2012 4:40 am

[Solved]Filling inventory for testing purposes?

Post by vidarfreyr »

I made a little script to fill inventory of a character for testing purposes. But for some reason I can't get my simple script working.

Code: Select all

function itemPut1()
			for itemSlot = 11,31 do
						party:getChampion(1):insertItem(itemSlot,"baked_maggot"..itemSlot)
			end
end
I simply use a wall button to activate a script entity. I get error: "Item expected, got ???"
Last edited by vidarfreyr on Sat Jan 26, 2013 5:33 pm, edited 1 time in total.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Filling inventory for testing purposes?

Post by Komag »

you have to spawn the item, and don't try to number in that way. Try one of these:

Code: Select all

function itemPut1()
  for itemSlot = 11,31 do
      party:getChampion(1):insertItem(itemSlot,spawn("baked_maggot"))
  end
end
or

Code: Select all

function itemPut1()
  for itemSlot = 11,31 do
      party:getChampion(1):insertItem(itemSlot,spawn("baked_maggot",nil,nil,nil,nil,"baked_maggot"..itemSlot))
  end
end
Finished Dungeons - complete mods to play
User avatar
vidarfreyr
Posts: 71
Joined: Sat Oct 20, 2012 4:40 am

Re: Filling inventory for testing purposes?

Post by vidarfreyr »

They both work!! :D Thanks!
Post Reply