Help: replacing empty item with new one?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
uggardian
Posts: 75
Joined: Sat May 19, 2012 5:53 pm

Help: replacing empty item with new one?

Post by uggardian »

So my plan is to fill a used venom edge by spawning a "venom_edge" when "venom_edge_empty" is placed on altar.
What am I doing wrong? Here's my script:

Code: Select all

function venomFill()
	for i in altarPoison:containedItems() do
		if i.name == "venom_edge_empty" then
		venom_edge_empty:destroy()
		altarPoison:addItem(spawn("venom_edge"))
		end
	end
end
The editor says "attempt to index global 'venom_edge_empty' (a nil value)".
How to fix this problem? :oops:
Magus
Posts: 56
Joined: Wed Sep 12, 2012 6:05 pm

Re: Help: replacing empty item with new one?

Post by Magus »

uggardian wrote:So my plan is to fill a used venom edge by spawning a "venom_edge" when "venom_edge_empty" is placed on altar.
What am I doing wrong? Here's my script:

Code: Select all

function venomFill()
	for i in altarPoison:containedItems() do
		if i.name == "venom_edge_empty" then
		venom_edge_empty:destroy()
		altarPoison:addItem(spawn("venom_edge"))
		end
	end
end
The editor says "attempt to index global 'venom_edge_empty' (a nil value)".
How to fix this problem? :oops:
You try to delete venom_edge_empty instead of the item. Try "i:destroy()" instead of venom_edge_empty:destroy(), this should work
Lilltiger
Posts: 95
Joined: Sun Sep 16, 2012 1:12 am

Re: Help: replacing empty item with new one?

Post by Lilltiger »

uggardian wrote:So my plan is to fill a used venom edge by spawning a "venom_edge" when "venom_edge_empty" is placed on altar.
What am I doing wrong? Here's my script:

Code: Select all

function venomFill()
	for i in altarPoison:containedItems() do
		if i.name == "venom_edge_empty" then
		venom_edge_empty:destroy()
		altarPoison:addItem(spawn("venom_edge"))
		end
	end
end
The editor says "attempt to index global 'venom_edge_empty' (a nil value)".
How to fix this problem? :oops:
The error says it all, there is no variable that is named 'venom_edge_empty', you check if the item 'i' is name "venom_edge_empty", if so you should use the item 'i'.
So change 'venom_edge_empty:destroy()' to 'i:destroy()'
uggardian
Posts: 75
Joined: Sat May 19, 2012 5:53 pm

Re: Help: replacing empty item with new one?

Post by uggardian »

I'm a complete idiot.. :oops:
Anyways thanks for help :)
Post Reply