Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
So in my game I pick up a key and unlock a door into a room, then I have a trigger to close the door behind me but I dont want to use the key again for that door so it does open. How can I delete the key variable from my player so I dont use that door again? |
||||
|
don't think you can "delete" a variable, but you can just change it to something you wont use once you hit the trigger. depends how you have it set up, i would recommend having variables like 'key1' 'key2' ect instead of just one variable like 'key' |
||||
|
Simply as tim12345 has said Just created another variable and name it for example DoorOpenedOnce and set it to 0 if never opened and 1 if opened once and check this variable each time you reach the door. |
||||
|
Thanks i have tried that before but didn't work, I'll keep working on it |
||||
|
Before starting the scene... Set a variable key_ found= '1'.. Set a variable key_lost = '0'... On proximity with door do something... On entering proximity... If a variable has a value do something... Variable name= key_found Value = 1 Do something = open the door.... And set a variable value.. Variable name =key_lost Value to be set = 1 On proximity with door do something ..on exiting proximity... If a variable has a value do something... Variable name = key_lost Value= 1 Do something = close the door...and set a variable value... Variable name =key_found Value to be set = 0 In the example value '1' = true and '0'= false... If key_found =1 then it means that you have founded the key..which is true...and let you open the door... If key_lost =1 or key_found= 0,. Then it means that you have lost the key, or you didn't found it yet... Which is true... And the door remains lock .... Untill you found the key.. In the above example the player had already found key...but you can trigger this on any scenenode... Instead of before starting the scene..... Sorry for my bad english... Now the door will open when you reach there... And when you exit from the door then it will close and will be locked permanently..... Hope thats helps you... |
|