Ambiera ForumDiscussions, Help and Support. |
|
[ 1 2 ] Page 1 of 2 |
|
|||||
|
I'm trying to create a system in CopperCube where players can name the player before the game and it saves and displays the name entered when the player starts the level. I created a scene where I added a behavior of Editable Text Overlay (JIC) and I made it that when player presses F key, player can edit the 2D overlay, then I added a behavior where when the player presses Shift key in the same scene, it saves the variable to disk. Then I added a behaviour in my level 1 scene where I have a 2d overlay, I added a behavior on the 2d overlay such that when the player for presses N key, it loads variable and I also added a behavior to change 2d overlay text to that variable. The main issue I have now Is when player presses N key in level 1 scene, it only changes the 2d overlay text to the variable name not the name the player entered in the previous scene. I want to make it that the game loads what the player entered as his/her name in the previous scene not the variable name. I really hope someone can help me solve this problem. |
||||
|
I'm not sure if it's possible to use built-in set text action, but you can do that using 'execute javascript'. Instead of 'change 2d overlay text' attach 'execute javascript' from special category. The action should be attached to the behavior attached to your 2d overlay node. Put the following code: // Gets current node Make sure 'Draw Text' checkbox is checked under your 2d overlay node Attributes. |
||||
|
Coppercube's variables are specific to a single scene. So when you change your scene you might need to recreate those variables in that scene too. If you want to load the variables from the previous scene in the new scene then you might need to save and load them to disk in your first scene and then load them using the same behavior in the new scene. Or you can simply assign global variables that can be used throughout your game instead of using local and scene-specific variables. Hope that bit of information helps. Also I hope you are liking my Editable Text Overlay :) |
||||
|
Wow thanks @ just_in_case But there's still a little issue, it is not displaying the players name, it is just displaying "true" on the 2d Overlay. I don't know what went wrong. Maybe I'll send a drive link for all the behaviours so u can see where I went wrong. How do I pls create global Variables in CopperCube? |
||||
|
* Yhh I'm enjoying the Editable Text Overlap behavior Really helpful. Thanks |
||||
|
Thanks @ okeoke really appreciate bro. I made a mistake earlier, the first reply was meant for you about the displaying of "true" not just_in_case. I thought it was just_in_case that replied with the JavaScript solution. Sorry for the mix up |
||||
|
https://drive.google.com/folderv... This is the google drive link for the pictures of the behaviours |
||||
|
wrote: https://drive.google.com/folderv... This is the google drive link for the pictures of the behaviours I can't access the folder - try to change the access rights to 'everyone who has link can access' or something similar. |
||||
|
Ooh I'm so sorry I forgot to change the permission to everyone can view. I've changed it, you can view it now. |
||||
|
It will be much better if you can provide a test ccb file to figure out what you are doing wrong. Those are lot of images to understand what you are doing there. |
||||
|
I believe, on the second screenshot you're setting your variable value to "true" that's why it says "true" when you set it. Try to change Value field from "Capture 2" from "true" to something else - if the same value pops up on your 2d overlay it means you're setting the variable incorrectly. I believe, editable overlay extension should have some option like "write value to variable" or something similar. Use it to set the value. |
||||
|
I would also prefer to have the ccb, tbh:) |
||||
|
OK I'll send the drive link of the CCB file to you |
||||
|
But when I changed the value from "true" to something else and I publish the game, the F key to edit the name is not working in the published version, it is only when the value is "true" that The 2d overlay is editable. |
||||
|
Did you added the "Editable Text Overlay " behavior to the overlay in new scene as well? if not, then you need to attach the behavior to the overlay. and your overlay name should be same as the overlay name in previous scene. Otherwise, you need to add another variable with name of your new overlay. A ccb file as I said will be more helpful. |
[ 1 2 ] Page 1 of 2 |
|