How do I make a door open, by putting items on alcoves.
How do I make a door open, by putting items on alcoves.
Specifically, I want a door to open once I put 3 items on each alcove, which are specific to each alcove, then opening a door once all 3 are put in.
Basically like the rock/sword/scroll puzzle in the main game.
EDIT: This is the last thing I need before I can completely test my map, and publish it.
Basically like the rock/sword/scroll puzzle in the main game.
EDIT: This is the last thing I need before I can completely test my map, and publish it.
Re: How do I make a door open, by putting items on alcoves.
Bump, I really just need this one last thing if anyone knows how, so I can finally playtest my map and publish it
Re: How do I make a door open, by putting items on alcoves.
Mostly the same way as this.
Re: How do I make a door open, by putting items on alcoves.
I'm not all that good at scripting sadly, so I don't know how I can set it to 3 alcoves to open a single door. hmmNutJob wrote:Mostly the same way as this.
Re: How do I make a door open, by putting items on alcoves.
Someone may get to it first but I may provide some sample script for you later/tomorrow. I have a puzzle that uses something like this as part of the full puzzle progression... I just don't want to side track myself to much, right now.
Re: How do I make a door open, by putting items on alcoves.
Would love it, if it's of any help, the items I need to put on the alcoves are blue_gem, green_gem, red_gem, for each alcove, to open a dungeon_door_iron. The alcoves are also the dungeon alcoves.
Re: How do I make a door open, by putting items on alcoves.
Here is what you looking for. Add both functions in script entity and link Alcove to second one.
General function (check if surface contains item)
Riddle example (link alcove/alcoves to this and define conditions). Under if you can add as many alcoves you wish:
[/color]
General function (check if surface contains item)
Code: Select all
function surfaceContains(surface, item)
for _,i in surface:contents() do
if i.go.name == item then return true end
end
end
Code: Select all
function openRiddleDoor()
if surfaceContains(myFirstAlcove.surface, "rock") and
surfaceContains(mySecondAlcove.surface, "dagger") then
myRiddleDoor.door:open()
else
myRiddleDoor.door:close()
end
end
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
- Mysterious
- Posts: 226
- Joined: Wed Nov 06, 2013 8:31 am
Re: How do I make a door open, by putting items on alcoves.
Awesome Leki. So when the Items are put into the Alcove how do you destroy the items? Thxs for the code
EDIT: Ok I figured out how to destroy the 2 Items but the items have to have the names. (rock_3 and dagger_1) but if the names are not correct in the ID's of the item it wont work. So the code needs to destroy any rock or dagger no matter the ID. Here is my version:
I cant use just any old rock or dagger they have to be rock_3 and dagger_1 how can this be changed so it does not matter which rock or dagger you use? Thxs
EDIT: Ok I figured out how to destroy the 2 Items but the items have to have the names. (rock_3 and dagger_1) but if the names are not correct in the ID's of the item it wont work. So the code needs to destroy any rock or dagger no matter the ID. Here is my version:
Code: Select all
function surfaceContains(surface, item)
for _,i in surface:contents() do
if i.go.name == item then return true
end
end
end
function openRiddleDoor()
if surfaceContains(altar_2.surface, "rock") and
surfaceContains(altar_3.surface, "dagger") then
rock_3:destroy()
dagger_1:destroy()
dungeon_iron_gate_1.door:open()
else
dungeon_iron_gate_1.door:close()
end
end
Re: How do I make a door open, by putting items on alcoves.
So the first one can be not connected to anything, just existing as it's own script in the level?Leki wrote:Here is what you looking for. Add both functions in script entity and link Alcove to second one.
General function (check if surface contains item)Riddle example (link alcove/alcoves to this and define conditions). Under if you can add as many alcoves you wish:Code: Select all
function surfaceContains(surface, item) for _,i in surface:contents() do if i.go.name == item then return true end end end
[/color]Code: Select all
function openRiddleDoor() if surfaceContains(myFirstAlcove.surface, "rock") and surfaceContains(mySecondAlcove.surface, "dagger") then myRiddleDoor.door:open() else myRiddleDoor.door:close() end end
Thanks so much for this though! Will do it and playtest my map soon
- Mysterious
- Posts: 226
- Joined: Wed Nov 06, 2013 8:31 am
Re: How do I make a door open, by putting items on alcoves.
Ok I am stumped on this any suggestions?Mysterious wrote:Awesome Leki. So when the Items are put into the Alcove how do you destroy the items? Thxs for the code
EDIT: Ok I figured out how to destroy the 2 Items but the items have to have the names. (rock_3 and dagger_1) but if the names are not correct in the ID's of the item it wont work. So the code needs to destroy any rock or dagger no matter the ID. Here is my version:
I cant use just any old rock or dagger they have to be rock_3 and dagger_1 how can this be changed so it does not matter which rock or dagger you use? ThxsCode: Select all
function surfaceContains(surface, item) for _,i in surface:contents() do if i.go.name == item then return true end end end function openRiddleDoor() if surfaceContains(altar_2.surface, "rock") and surfaceContains(altar_3.surface, "dagger") then rock_3:destroy() dagger_1:destroy() dungeon_iron_gate_1.door:open() else dungeon_iron_gate_1.door:close() end end