Page 1 of 2
New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 4:13 pm
by Neikun
[strike]The connector on the counter doesn't appear to want to attach to more than one door.
I was thinking attaching the connector to a pressure plate and the pressure plate to the doors.[/strike]
Figured that bit out.
I want to use a counter to open four secret doors simultaneously when the party walks over it three times.
I need to know how to make the counter activate something at a specific count.
Thanks in advance.
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 4:34 pm
by Neikun
Another thing I need to learn is how to use lua script to make a secret door need two different buttons pushed in order to be opened.
EDIT: Apparently this doesn't work as I hoped.
Code: Select all
if wall_button_2 and wall_button_1: push() then dungeon_secret_door_8:open()
end
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 4:50 pm
by Magus
You could do something like this:
Code: Select all
openDoor = false
function button01()
openDoor = true
end
function button02()
if openDoor == true then
secretDoor:open()
end
end
link the connector for the first button to button01 and the second to button02, the door should open then.
(didn't testet it but it should work)
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 4:53 pm
by Shroom
Neikun wrote:Another thing I need to learn is how to use lua script to make a secret door need two different buttons pushed in order to be opened.
EDIT: Apparently this doesn't work as I hoped.
Code: Select all
if wall_button_2 and wall_button_1: push() then dungeon_secret_door_8:open()
end
The easiest way I have found is not to use code
Create 2 buttons and 1 counter and a door
set buttons to activate once
set the counter to initial value of 2
add connector from counter to door
add connectors to the counter and set to decrement
Done
Edit: I missed the pushed in order bit when reading it - in which case you do need code as magus pointed out
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 4:56 pm
by Shroom
Neikun wrote:[strike]The connector on the counter doesn't appear to want to attach to more than one door.
I was thinking attaching the connector to a pressure plate and the pressure plate to the doors.[/strike]
Figured that bit out.
I want to use a counter to open four secret doors simultaneously when the party walks over it three times.
I need to know how to make the counter activate something at a specific count.
Thanks in advance.
Use a counter that decrements and then links to the doors - give it an initial value of 3
link the pad to the counter and set the connector to decrement it
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 4:56 pm
by Neikun
Oh it doesn't matter which order their pushed in, just that they both get pushed.
I'mma try it out.
The counter doesn't appear to activate anything when I walk over it.
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 5:07 pm
by Magus
Oh, if the order doesn't matter then use counters and let the buttons decrease it with 1 (with activate once)
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 5:14 pm
by Shroom
Neikun wrote:Oh it doesn't matter which order their pushed in, just that they both get pushed.
I'mma try it out.
The counter doesn't appear to activate anything when I walk over it.
The pad must have a connector to the counter and it action set to decrement - then when the counter gets to 0, it will perform the action of its connector to the door which in this case is open
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 5:15 pm
by Neikun
I don't understand what I'm doing wrong with counters.
I have the initial value set to 2. Both buttons are connected to it with activate once.
The counter is linked to itself with decrement, and then linked to the door to open.
Why doesn't the counter activate the door after both buttons have been pressed?
Re: New to scripting, need a bit of help.
Posted: Sat Sep 15, 2012 5:19 pm
by Magus
Connect both buttons to the counter and select decrement in the action tab, then set the counter to 2 and add a connector from the counter to the door. This should work fine.