Removing an item from alcove
Removing an item from alcove
Is there a way to remove an item from an alcove with scripting?
I can only find the "addItem"...I would like the alcove to "eat" an item, when a button is pushed
I can only find the "addItem"...I would like the alcove to "eat" an item, when a button is pushed
Re: Removing an item from alcove
Yes, you can, I'll give you an example:
Let's say you want to destroy a dagger in an alcove, then the script will be:
Let's say you want to destroy a dagger in an alcove, then the script will be:
Code: Select all
funcion destroyDagger()
for i in alcove:containedItems() do
if i.name == "dagger" then
i:destroy()
end
end
end
Re: Removing an item from alcove
But if you don't want the dagger to be permanently destroyed do it like:
eatalcove:addItem(spawn("dagger", nil, nil, nil, nil, "eatdagger"))
That will give unique name to the dagger, change alcove name to what you want as well, use crismans script and change name to "eatdagger" then tie button press to the script.
I believe that will work, not tested.
eatalcove:addItem(spawn("dagger", nil, nil, nil, nil, "eatdagger"))
That will give unique name to the dagger, change alcove name to what you want as well, use crismans script and change name to "eatdagger" then tie button press to the script.
I believe that will work, not tested.
The FORCE is with me!!!
Re: Removing an item from alcove
Great - thanks both of you
"i:destroy" was what I needed!
"i:destroy" was what I needed!

Removing the alcove...
I would like to also remove the alcove all together - but when I destroy it with alcove:destroy(), the whole wall gets removed and only a black hole remains...
Is there a way to only remove the alcove, and not the entire wall?
Is there a way to only remove the alcove, and not the entire wall?
Re: Removing the alcove...
best bet is probably to spawn a secret wall from the same wallset in the same place the alcove wasxbdj wrote:I would like to also remove the alcove all together - but when I destroy it with alcove:destroy(), the whole wall gets removed and only a black hole remains...
Is there a way to only remove the alcove, and not the entire wall?
Re: Removing an item from alcove
Thought about that too - but havent looked into how (if possible) it is done...
Re: Removing an item from alcove
This seems to work fine:xbdj wrote:Thought about that too - but havent looked into how (if possible) it is done...
Code: Select all
function alcoveswap()
dungeon_alcove_1:destroy()
spawn("dungeon_secret_door",1,13,16,1)
end
Re: Removing an item from alcove
Nice thinking...you cant place a wall (?) so you place a secret door instead 
Works nicely though!

Works nicely though!
Re: Removing an item from alcove
Yep...just be really careful when you destroy the alcove...if the same script gets called again somehow (e.g., by a pressure plate), or if another script somewhere else tries to do something with the alcove, it will crash the game because that alcove ID was already destroyed once! 
