Having a bit of trouble with pressure plates.

Get help using Construct 2

Post » Wed Nov 26, 2014 6:19 pm

Hi! I'm currently trying to implement pressure plates into my game and I'm having a bit of a problem:

When I walk onto the pressure plate, things work fine, it activates the plate (when I view the instance in the debugger, it's activated variable is true). This is good and all but when I try to link that pressure plate to other objects, things get weird.

So here's the objects I'm using and their variables:

This is the pressure plate, when the player collide with it, the it will activate (set Activated to true)
Cave_FloorButton
    Connector_ID
    Activated

This is a wall trigger, it acts as a wall as long as collision is enabled. When the pressure plate is activated, it will disable collision. And it doesn't work.
trg_Wall
    Connector_ID
    Activated

This is a grate, when pressure plate is activated, it will raise. And it works.
Grate
    Connector_ID
    Activated

The idea is that the objects (or rather instances) will check their Connector_ID and check whether the matching connected object is activated. For example: It will check if the trg_Wall/Connector_ID match the Cave_FloorButton/Connector_ID. And if it does, then it will do whatever the object should when activated.

Here's a screencap of the events involved: I'm really confused and frustrated because the event chains dealing with the trg_Wall and the Grate are identical, yet the trg_Wall one doesn't work but the Grate one does. I have double and tripple checked that the Connector_ID for all involved objects are indeed matching (they are all set to 1).

EDIT: Sorry, forgot to say: Thanks in advance! :)

EDIT2: Woop woop, I found another problem, I think it's connected to the Connector_ID. If I add another Grate, with another Connector_ID (2) then none work. I suppose the same thing happens with the trg_wall since every other unaffected wall have a Connector_ID of 0 instead of 1.
You do not have the required permissions to view the files attached to this post.
B
20
S
8
G
4
Posts: 195
Reputation: 3,555

Post » Wed Nov 26, 2014 6:47 pm

There's a lot of picking errors here and there. Why all the pick by evaluate ? All of them are picking all objects with non-zero UID, is it intended ?

Also, most of these problems stem from the fact that some pick condition scopes might select more than one object and it can't iterate through them unless explicitely said to, by using a for each condition.
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735

Post » Wed Nov 26, 2014 7:14 pm

I'm still a bit new to Construct so I expect myself to make errors, thankfully people will tell me when I do stuff wrong! :)

I was under the impression that using the 'pick by evaluate' would only pick the ones with the specified condition. I thought that if I only had [is Cave_FloorButton/Activated], it would activate the actions every single instance because one of them met the criteria, I suppose I misunderstood how that worked. Re-read the manual entry and I see what you mean though. Do you know why it doesn't pick values that are 0?

I didn't think the loops allowed me to do that, Thanks for telling me, saves me a lot of trouble. I got it to work using for each loops.

Thanks for the help, it's much appreciated. :)
B
20
S
8
G
4
Posts: 195
Reputation: 3,555

Post » Wed Nov 26, 2014 7:27 pm

Then I guess you could do with a bit of reading on How Events Work. ;)

You'll see that conditions themselves are doing the picking. Pick by evaluate will pick all objects which the provided expression evaluates to a non-zero value, that is by the book. UIDs are non-zero value (except the very first object instance), so you were in fact re-picking all objects that were already in the SOL.
B
75
S
31
G
27
Posts: 1,000
Reputation: 20,735


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests