Page 1 of 1
triggering an event from an alcove
Posted: Mon Oct 08, 2012 3:45 am
by gamefanatic
Hi everyone. Hope your having fun with the editor.
I want to set up a trap/puzzle that when you remove a iron key from a dungeon alcove then a trap door is opened. The logic I have will
only open the trap door if the key is returned to the alcove. Removing the key doesn't open the trapdoor.
These are the settings I have for the alcove and trap door.
Dungeon Alcove: Activate always is checked. Contents: iron key. Event: Activate; Target: dungeon_pit_1; Action:open
Dungeon Pit: trap door checked. Initial State closed.
Thanks in advance for any help.
Re: triggering an event from an alcove
Posted: Mon Oct 08, 2012 4:12 am
by Neikun
Turn off activate always.
You want your activation as always, your target being the pit and your event being toggle.
It should be noted that the player will be able to fool this by placing any other item into the alcove.
Re: triggering an event from an alcove
Posted: Mon Oct 08, 2012 4:17 am
by Skuggasveinn
I want to set up a trap/puzzle that when you remove a iron key from a dungeon alcove then a trap door is opened. The logic I have will
only open the trap door if the key is returned to the alcove. Removing the key doesn't open the trapdoor.
This sentence is confusing me !!! , I feel like it's in contradiction
Anyway, If you want to open a trapdoor when someone moves a key from an alcove, and close the trapdoor if the key is replaced you can to something like this.
(btw have a look at the scripts repository
viewtopic.php?f=14&t=3099 this is VaeVictis scripts that he placed there.)
Code: Select all
function DoWeHaveKey()
local itemName = "iron_key"
local alcoveID = dungeon_alcove_1
for i in alcoveID:containedItems() do
if i.name == itemName then
dungeon_pit_1:close()
else
dungeon_pit_1:open()
end
end
end
what we are doing here is we have an alcove that is set to event=any and it targets a script with that code inside it.
The script simply runs everytime you do something to the alcove (hence the event=any).
you have defined the name of the alcove as dungeon_alcove_1 and the item as iron_key (feel free to rename here)
when the scripts runs it goes to dungeon_alcove_1 and checks of iron_key is inside, if thats the case dungeon_pit_1 is closed.
if the key is removed then dungeon_pit_1 is opened.
hope this helps.
clarification of the problem
Posted: Mon Oct 08, 2012 6:25 am
by gamefanatic
What I want to happen is that when the key is picked up from the alcove by the party then the trap door opens.
When I pick up the key the trappdoor isn't opening. Nothing triggers. The trigger is activated when the key is put back which is opposite to what I want to happen.
I fixed the problem
Posted: Mon Oct 08, 2012 6:34 am
by gamefanatic
I only needed to change the EVENT to ANY for the dungeon alcove. Now when I remove the key the trapdoor opens.
Thanks to everyone who offered help. And so quickly!
Re: triggering an event from an alcove
Posted: Mon Oct 08, 2012 11:49 am
by Komag
glad you got it figured out! the Event logic is a stumbling block to lots of people learning the editor, hard to really get your head around how that works at first