New to scripting, need a bit of help.

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

New to scripting, need a bit of help.

Post 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.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: New to scripting, need a bit of help.

Post 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
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
Magus
Posts: 56
Joined: Wed Sep 12, 2012 6:05 pm

Re: New to scripting, need a bit of help.

Post 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)
User avatar
Shroom
Posts: 98
Joined: Tue Mar 27, 2012 6:37 pm
Location: UK

Re: New to scripting, need a bit of help.

Post 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
User avatar
Shroom
Posts: 98
Joined: Tue Mar 27, 2012 6:37 pm
Location: UK

Re: New to scripting, need a bit of help.

Post 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
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: New to scripting, need a bit of help.

Post 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.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
Magus
Posts: 56
Joined: Wed Sep 12, 2012 6:05 pm

Re: New to scripting, need a bit of help.

Post by Magus »

Oh, if the order doesn't matter then use counters and let the buttons decrease it with 1 (with activate once)
User avatar
Shroom
Posts: 98
Joined: Tue Mar 27, 2012 6:37 pm
Location: UK

Re: New to scripting, need a bit of help.

Post 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
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: New to scripting, need a bit of help.

Post 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?
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
Magus
Posts: 56
Joined: Wed Sep 12, 2012 6:05 pm

Re: New to scripting, need a bit of help.

Post 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.
Post Reply