Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
So i have a player that haves a basic health and i have HP viable that created by me. So i want when player gets damage health get lower with the HP it’s visible, HP makes lower and can be higher if player use medkits, i want the same with basic health in created character (Thank you |
||||
|
you could create a variable called "hp", and then set on your player the "actor behaivour", you set when he gets damaged that a desired ammount of numbers would subtract the value. so you just give him the desired value of damage points. otherwise for medkits you could add a desired ammount of health points when touching the medkit |
||||
|
You can use "special variable" to track and modify hp, no need to create your own. Check the last section: https://www.ambiera.com/coppercube/doc/cnt_actions.html |
||||
|
So if i have different damage values what would i do? |
||||
|
If you use Shoot action - just use multiple with different damage values set and execute only one based on selected weapon (use variable for that). If you can code, you can make this logic in js, so it's more readable. |
||||
|
Well, you misunderstood me. I wanted the variable displayed on the screen to match the invisible health on the player's actor. |
||||
|
So, you want to display your character's health on a 2D overlay, is it? If so, and if, as far as I understand, you're using only built-in Coppercube actions and behaviors, here's what you can do: Upon taking damage (or when a bullet hits your player character), you can use "Change 2D Overlay Text" action. There, you must select health 2D overlay, and type "$[player character name].health$" (for example, "$plr.health$). Here's the information directly from the documentation: Change 2D Overlay Text Sets the text of a 2D overlay to a new text. It is also possible to print the content of variables with this, if wanted, by inserting the variable name surrounded by the '$' symbol. For example to display the text of a variable named 'score' after some text in the 2D overlay, set the text to "Your score: $score$". For showing the health of a game AI, use for example "Health: $player1.health$", where 'player1' is the name of the object with the health. Set or change a Variable ... There are also special variables available, for quickly accessing data in the current scene. The names of these variables look like this: "name.attribute". Use for example player1.health for getting or changing the variable storing the health of the object with the game AI behavior of a scene node with the name 'player1'. Edit: for some reason forum keeps removing the symbol before the variable name. So, just in case, check Coppercube documentation > Actions > Change 2D Overlay Text. |
||||
|
Thank you, it’s just i need |
||||
|
so i trynna it but it not working i give a video file to you https://youtu.be/vjcRYK7uNCc please say to me what im doing wrong |
||||
|
EDIT its not record gameplay but I'll tell you where the HP should be displayed, it just says $plr.health$ |
||||
|
Here, made a (somewhat) visual demonstration on how to make this: https://youtu.be/ALY3SH9h8sM |
||||
|
I check it later, and write this work that or not |
||||
|
Thank you, im very happy to it works |
||||
|
|