ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator Ammo Count how to add
person icon
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

person icon
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!emoji icon_holy

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

thanks

person icon
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

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

Set it to what?

person icon
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

person icon
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"....

person icon
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/...

person icon
zayans_world
Registered User
Quote
2024-07-11 11:21:43

Thank you a lot


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 |