Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Needed help with variables

crackyourspeaker
Registered User
Quote
2017-04-02 03:51:55

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?


tim12345
Guest
Quote
2017-04-02 04:52:57

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'


techno-valley
Registered User
Quote
2017-04-03 10:41:15

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.


crackyourspeaker
Registered User
Quote
2017-04-03 23:13:28

Thanks i have tried that before but didn't work, I'll keep working on it


just_in_case
Moderator
Quote
2017-04-04 09:25:56

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


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "?nternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact