Page 1 of 1
Altar or Alcove Destroy
Posted: Fri Oct 25, 2013 2:51 am
by Eleven Warrior
Hi all
I would like to know how to create a table of objects that can go onto a Altar and destroy all of them..
eg: the player puts, dagger, long sword, leather cap and knife on the Altar to complete a quest but when the items are put on the altar they are all Destroyed.. That way the player cant get the Items back..
The code below allows me to destroy 1 Item in Qt3. What I want to know is how do I destroy multiple items..
function Quest3()
for i in Qt3:containedItems() do -- Altar --
if i.name == "note" then -- Would like this to be 4 items not 1 --
i:destroy() -- Need this to destroy the 4 Items --
end
Thxs for any help
Re: Altar or Alcove Destroy
Posted: Fri Oct 25, 2013 12:21 pm
by DesperateGames
Hello Eleven Warrior,
do you want to destroy the items one after another, just in the moment the player puts them on the altar? Then you could use:
Code: Select all
function Quest3()
for i in Qt3:containedItems() do
if i.name == "knife"
or i.name=="leather_cap"
or i.name=="long_sword"
or i.name=="dagger"
then
i:destroy()
end
end
end
If you want to only delete the items if the player has put them on the altar in combination, I would do it like this:
Code: Select all
function Quest3()
knifeFound=false
leatherCapFound=false
longSwordFound=false
daggerFound=false
for i in Qt3:containedItems() do
if i.name == "knife" then knifeFound = true end
if i.name=="leather_cap" then leatherCapFound = true end
if i.name=="long_sword" then longSwordFound = true end
if i.name=="dagger" then daggerFound = true end
end
if knifeFound and leatherCapFound and longSwordFound and daggerFound then
hudPrint("Quest completed!")
for i in Qt3:containedItems() do
if i.name == "knife"
or i.name=="leather_cap"
or i.name=="long_sword"
or i.name=="dagger"
then
i:destroy()
end
end
end
end
The above examples will work with ALL daggers, knifes etc. that can be found in your dungeon. If you want to restrict this to a specific instance of the item, you would need to change i.name= to i.id= and check for the specific id of the item that needs to be put down. (For example if the player is supposed to use a specific dagger that he found on a certain alcove which has the id "dagger_1" you would need to check for i.id ="dagger_1")
You need to activate "Activate Always" for the altar to make sure the code is executed every time a new item is added to the altar!
Re: Altar or Alcove Destroy
Posted: Sat Oct 26, 2013 6:03 am
by Eleven Warrior
Hi
Thank you so much for that.
I should have realised that's how it was done..
if i.name == "knife"
or i.name=="leather_cap"
or i.name=="long_sword"
or i.name=="dagger"
Thxs again for help..