GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Open/Close a safe door

mscherermscherer Posts: 30Member, PRO

Hi All,

I was hoping someone could help me with the following.
I am creating a game that requires the same safe door to open and close multiple times during a game. I have created a rule using a boolean (true/false) but if a create two rules (one for true and one for false) under one actor then the first rule (true) works fine and the door opens, but when I change the boolean to false during the game the door does not close. I have setup a display text actor to confirm the boolean is changing from 'true to false' which it is, but the door will only open once on 'true' and will not close on 'false'.

Please help.

Comments

  • muoch10muoch10 Posts: 112Member

    This isn't quite the perfect solution but what I'd do is this:
    create a real attribute, call it booleanAttribute and set its value to 1.
    create a rule for whatever you want to switch the thing (touch or whatever)
    in that rule change attribute booleanAttribute to booleanAttribute*-1

    So that attribute will switch from -1 to 1 to -1 etc... Just make your safe door open and close depending on whether it's -1 or 1.

  • mscherermscherer Posts: 30Member, PRO

    Thanks muoch,
    I think I have fixed the problem now by doing the following.
    During the game different actors can trigger the sliding door to open and close. What I found is that if I set two rules under one actor referencing a game attribute and (I.e. 0 & 1) then this did not work. The door would open the first time when the attribute was set to 0 but it would not close when the attribute was set to 1.
    I ended up using a Boolean and a game attribute. Once the Boolean was set to true (as a trigger) and the game attribute was given a 'x' position then the dual rule would work. I then needed to change the Boolean to false. Once I needed to close or open the door again I then needed to set the Boolean trigger to true and give the game attribute a different 'x' position.
    This is probably a long way to go about achieving the desired outcome but it seems to work.

    Hope all this makes sense.

Sign In or Register to comment.