ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator Player and viable
person icon
Stewww
Guest
Quote
2026-02-14 06:48:42

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 youemoji icon_blink)

person icon
torvason
Guest
Quote
2026-02-14 13:40:21

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

person icon
okeoke
Registered User
Quote
2026-02-14 16:53:13

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

person icon
Stewww
Guest
Quote
2026-02-14 20:37:09

So if i have different damage values what would i do?

person icon
guest_Okeoke
Guest
Quote
2026-02-14 21:43:17

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.

person icon
Stewww
Guest
Quote
2026-02-17 17:21:59

Well, you misunderstood me. I wanted the variable displayed on the screen to match the invisible health on the player's actor.

person icon
dekon_17
Registered User
Quote
2026-02-18 04:59:40

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.

person icon
Stewww
Guest
Quote
2026-02-19 19:15:31

Thank you, it’s just i needemoji icon_smile

person icon
stewww
Guest
Quote
2026-02-20 18:22:03

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

person icon
stewww
Guest
Quote
2026-02-20 18:25:49

EDIT its not record gameplay but I'll tell you where the HP should be displayed, it just says $plr.health$

person icon
dekon_17
Registered User
Quote
2026-02-20 21:33:21

Here, made a (somewhat) visual demonstration on how to make this: https://youtu.be/ALY3SH9h8sM

person icon
Stewww
Guest
Quote
2026-02-21 06:50:09

I check it later, and write this work that or not

person icon
Stewww
Guest
Quote
2026-02-21 12:38:13

Thank you, im very happy to it works


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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