Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
NEED HELP

thantoan
Registered User
Quote
2017-10-07 13:09:39

I created a mana bar with 2d overlay = 200 pixel, I add to this every seconds the 2d overlay + 1pixel, and when I press a key the 2d overlay
-5pixel ( for skill ). BUT I DONT KNOW HOW TO LIMIT WHEN MANA =0 THE 2D OVERLAY PIXEL STOP IN 0 PIXEL, AND WHEN MANA = 200 ( MAX) THE 2D OVERLAY STOP IN 200 PIXEL ? ?

🔎︎



just_in_case
Moderator
Quote
2017-10-07 14:02:30

Simply use if a variable has a value do something...for example when a variable name mana has value 0 then execute javascript..

And use the code...

Var s = CcbgetScenenodefromname("2Doverlay1")
Ccbsetscenenodeproperty(s,"pixels" 0,0);

This isn't the accurate code....
But the code should be something like this...

Please go through the javascript reference api in the documentation...




wild-master
Registered User
Quote
2017-10-07 14:06:37

Are you using JavaScript, or are you using the variable Actions?

You must add more checks, like this:



This will limit the high point of the Mana to 200:
If Mana is less than 200,
every 1000 milliseconds,
add 1 to 2D overlay

That will only allow the Mana to grow if its current amount is any number below 200. If the Mana is 199, 1 point will be added, so it will reach 200 and it won't grow higher.




And this will only allow the Mana skill to be used if the player has at least 5 Mana points:
If Mana key is pressed,
if 2D overlay is greater than 4,
Activate Magic Spell, and subtract 5 from 2D overlay

That will limit the low point of the Mana to zero because a Magic Spell will only be used if your character has at least 5 points!

I hope you can understand what I mean. You must set your variable Actions like those examples show. If you're using JavaScript, the same ideas will work, but they must be written according to the syntax rules of JavaScript.


thantoan
Registered User
Quote
2017-10-07 16:38:58

Big thanks for your help ! But Im still not developer

I send you my .ccp file, Can you complete the idea on the ccp file, for me? thanks :3

https://drive.google.com/file/d/0B3boo-rjTAQASXZUblpUdFlxNDg/view?usp=sharing


wild-master
Registered User
Quote
2017-10-07 17:32:02

I added my examples from my previous post to your JavaScript sections.

Download it here:
https://drive.google.com/file/d/...

You will notice that the bar doesn't grow higher than 200 points.

If you hold the left mouse button, you will see that the bar only uses the Mana points if you have at least five points available. Even if you hold the left mouse button forever, it will never move below zero!


thantoan
Registered User
Quote
2017-10-07 18:30:31

wrote:
I added my examples from my previous post to your JavaScript sections.

Download it here:
https://drive.google.com/file/d/...

You will notice that the bar doesn't grow higher than 200 points.

If you hold the left mouse button, you will see that the bar only uses the Mana points if you have at least five points available. Even if you hold the left mouse button forever, it will never move below zero!

woa thanks friend !!


thantoan
Registered User
Quote
2017-10-07 18:39:44

I want to do if mana is too low skill does not work, and players need to wait for mana to recover or drink more mana potion !! :)


Zoo
Guest
Quote
2017-10-07 21:46:49

Added CCB template to MTM for everyones convenience...This thread is linked on MTM with the product, so that people better understand the context of the ccb


Zoo
Guest
Quote
2017-10-07 21:47:09

https://marshtownmadness.com


thantoan
Registered User
Quote
2017-10-08 03:29:59

Hi there. ! I want to create a skill like in the picture, I want the AI around the circle to lose blood when entering, how to do?


🔎︎



thantoan
Registered User
Quote
2017-10-09 02:50:42

wrote:
Are you using JavaScript, or are you using the variable Actions?

You must add more checks, like this:



This will limit the high point of the Mana to 200:
If Mana is less than 200,
every 1000 milliseconds,
add 1 to 2D overlay

That will only allow the Mana to grow if its current amount is any number below 200. If the Mana is 199, 1 point will be added, so it will reach 200 and it won't grow higher.




And this will only allow the Mana skill to be used if the player has at least 5 Mana points:
If Mana key is pressed,
if 2D overlay is greater than 4,
Activate Magic Spell, and subtract 5 from 2D overlay

That will limit the low point of the Mana to zero because a Magic Spell will only be used if your character has at least 5 points!

I hope you can understand what I mean. You must set your variable Actions like those examples show. If you're using JavaScript, the same ideas will work, but they must be written according to the syntax rules of JavaScript.


Can you show me how to do this with variable ? because im not coder


Create reply:


Posted by: (you are not logged in)


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