Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hi, If I have behavior script attached on my player character with its health, armor, gold etc, is it possible to access those properties from another behavior or action? Another question, I am a bit confused about the custom mouse cursor script. Where do I attach that script? Thank you |
||||
|
not sure what you're asking but i think yes, you should be able to access them from anywhere. custom mouse cursor script... the one thats a function? should be able to attach that anywhere with 'execute javascript' action |
||||
|
If You are asking to use the variable health,gold,armor ... Then yes u can use it anywhere anytime in ur scenes... not sure about other behaviours....if u can use them anywhere or not... maybe not.. And about custom mouse script i will advice u to use it with your root scenenode.. click on the root scene node... Add a behaviour "before first drawing do something" ,assign an action "execute JavaScript " from special...and put that custom mouse script there... and click ok... You are done.... |
||||
|
wrote: If You are asking to use the variable health,gold,armor ... Then yes u can use it anywhere anytime in ur scenes... Actually I am asking how do I access those properties from another script (behavior or action). e.g. If I shoot an enemy, how do I access the health property of enemy (which is attached to the enemy as behavior) from player script (which is attached to player)? Thank you |
||||
|
They are special variable and yes u can change them by assigning a behaviour and then using the action set or change variable.... And type player.health here player is the name of scene node to which u have assigned game behaviour " player with health and ai" And set the value to whatever you want for example on proximity with something set or change a variable... Variable name = player.health Subtract value.. Value =50 Now whenever the player get near to that object it health will decreases to half... Hope that help you.. |
||||
|
Can I access my custom variables same way? Thank you for your reply. |
||||
|
Yes you can access your own created variables same way... |
||||
|
Thank you for your reply and help. |
|