Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Ammo Count how to add

faith_254
Registered User
Quote
2018-08-20 09:58:36

Can any one plz help me
i want to add a ammo limit so that you have to reload, not unlimited bullets


just_in_case
Moderator
Quote
2018-08-20 19:46:32

Use variables... Suppose you have a pistol with a magzine of maximum 6 bullets..

So u can create a vraible "ammo_pistol" with a value of "6"

Then you can use when a key is pressed behaviour then attach action if a variable "ammo_pistol" has a value bigger than "0" and then attach another subaction to it... If a variable "ammo_pistol" has value less than "6" then add the shoot action and another action set or change a variable "ammo_pistol" subtracts by value "1"

This will make you shoot with limited bullets only for the current example it will allow you to shoot maximum of 6 bullets... When you shoot it will decrease the ammo hy 1 and check if the value of bullet is greater than 0 and less than 6 and allow you to do a succesfull shoot...

To make a reload functionality simply use set or change variable and then change the variable value to maximum ammo value for example "6"

Good luck!


faith_254
Registered User
Quote
2018-08-20 23:31:21

thanks


faith_254
Registered User
Quote
2018-08-21 02:41:01

its not working i do it and when i click to shoot it does my animation but wont
show bullet even when i set it to


just_in_case
Moderator
Quote
2018-08-21 02:55:41

Set it to what?


faith_254
Registered User
Quote
2018-08-21 03:19:31

so at the moment if i put shoot if value bigger then 0
on shoot if i put shoot with scene node, i.e bullet
it wont show the bullet


just_in_case
Moderator
Quote
2018-08-21 04:49:36

Ooops... Sorry my mistake... When you add the sub action if a variable "ammo_pistol" has a value less than ... Always use one value higher than the maximun ammo... Instead of using less than value"6"... Try using value "7"....


just_in_case
Moderator
Quote
2018-08-21 05:03:30

to make it easy for you here is the ccb file.... so that you can understand it better... pressing left mouse button will shoot and right mouse button will reload...
https://drive.google.com/file/d/...


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