ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > CopperCube > Programming and Scripting
Behavior as additional attributes container
Author Text

Registered User
2017-11-22 07:06:15

Greetings. I develop a game in the genre of first-person shooter. Therefore, I need to get a more sophisticated behavior of weapons and monsters AI. Suppose I want all weapons on the scene to have ammo counters.
Yesterday I tried to write a script for this. For this, I added the "cAmmo" field via the "this" pointer inside the behavior script function. In onAnimate function, when I pressed the left key, which plays the role of a shoot key, I incremented the ammo count (usually when the shot is fired it decrements, but for the test I increased their number). I also printed the current value of the ammo count of the gun. It worked. Then I put a cylinder on the scene and attached behavior to it, which is that when the right mouse button is clicked, the gun is cloned. In the test, the behavior script for the gun , which was cloned later, prints fewer cAmmo, as I wanted. As though all works, but I am not assured that it is correct (such examples are not present in the documentation).
Hence my question. Can I use the behavior script to store additional data parameters of scene node (ammo counts of weapons, goals of monsters). Does behavior script "this" fields shared between scene node clones or not?

2017-11-22 21:11:11

Check out https>// there are a lot of resources there

Create reply:

Posted by: (you are not logged in)

Enter the missing letter in: "Inter?ational" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]



Software: Ambiera Light Forum. © 2008-2018 Nikolaus Gebhardt, Ambiera e.U.