Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Completely unable to access Monster's Health.

bracer
Registered User
Quote
2017-05-10 06:21:29

var Monster = ccbGetSceneNodeFromName("soldier1");

I tried:
var Health_Level = Monster.health; //Error: Undefined.
and
var Health_Level = soldier1.health; //Illegal Character
and
var Health_Level = Monster.health; //Illegal Character

print("Health Level: " + Health_Level);

All three method doesn't work, how does it actually work ?
Thanks !
And if you are able to answer that, how do you do a health bar on top of the character following it ?


techno-valley
Registered User
Quote
2017-05-10 10:16:33

Hi bracer,

In order to be able to verify I guess you need to add a sign before the object.

You may check the special variables section
http://www.ambiera.com/coppercub...


bracer
Registered User
Quote
2017-05-10 11:28:39

Monster.health //illegal Character
soldier1.health //Illegal Character

It's not working techno-valley, but I appreciate your attempt to help.

So to summaries:
var Monster = ccbGetSceneNodeFromName("soldier1");

I tried:
var Health_Level = Monster.health; //Error: Undefined.
and
var Health_Level = soldier1.health; //Illegal Character
and
var Health_Level = Monster.health; //Illegal Character
and
var Health_Level = Monster.health //illegal Character
and
var Health_Level = soldier1.health //Illegal Character

print("Health Level: " + Health_Level);

ALL not working :-(


erik
Registered User
Quote
2017-05-10 12:36:10

It doesn't work like that. You only need to use that text as variable name, it is like a virtual variable. Like this:

// note: the forum deletes the hash, so this must be the first character in the name
var health = ccbGetCopperCubeVariable("HASHMonster.health");


Also, bracer: Would you mind to use shorter titles for your forum threads? This one is nicer already, but your older ones where quite long!


bracer
Registered User
Quote
2017-05-11 04:26:04

Thank you so much erik.
It works now, I am updating my own documentation of CopperCube.

Erik, I am not very good at summarizing my questions, I am not very smart.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (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