How can I create a global variable in Script Canvas? [Lumberyard 1.14]

I defined a variable in AreaTrigger Entity (Script Canvas) with name Ammo1 variable.
How can I use this variable(ammo1) in another Entity (MyPlayer Entity)?
Basically, how can I create a global variable in Script Canvas?
I think All variables are private in ScriptCavas,How to get my variable in another entity?

I using Lumberyard 1.14, also I making a game with script canvas , I hope receive my answers soon, please add a lot nodes to script canvas , Disappointed with these nodes,Because the number of nodes seems to be very low.

I found but I implemented with a other way but my answer is remain.

if persons/person is/are here , you have this problem , You can use this method instead of the variable/variables:

I made Empty Entities for each weapon , I use of SetLocalX / GetLocalX ,SetLocalY / GetLocalY, SetLocalZ / GetLocalZ nodes , etc for implementation ammo value, also relation to different graph sections.

In fact, each Entity is a variable, or each x , each y , each z are three variables , etc :slight_smile:
I’m really smart :wink:

I was asking myself the same question lately …it seems to me more in the spirit of Lumberyard to use here Events on an entity, empty or other entity already in place, which will contain the global variables that can be in this way in unlimited quantity and of all types like a matrix for example and callable from any other script.

1 Like

You can use script events. Make an event for setting and getting the variable. Anytime you want it just catch that that event catch it in script with the event node for that script event. And every time you set it it will then fire that event wherever that event is placed.

Script events is how you pass around data


I found this solution for lumberyard 1.14, global variables could not be used in lumberyard 1.14 :blush:

We can use script events(Send/Rec global variables) for lumberyard 1.24 now :wink:

Yes, it’s true , global variables & script events :slightly_smiling_face:

@_AhmadKarami except you can’t put a container in a Send… and it’s often this type of global variable container that we need the most.

In my opinion, there is actually in this 1.24 a lack on this global variable part, as well as on simple things like a complete FiFo node useful to manage asynchronisms such as with Events that modify the current data in a script and basic Maths nodes.

1 Like

After several trials and tests to reproduce something that would correspond to a Global Array … it’s heavy and not practiced with even an impossibility noted here A consumer of an Event aware on how to retrieve relevant data ... a business model barrier?

I think this should be seriously considered as a potential sticking point :no_entry: :triangular_flag_on_post: :warning: :loudspeaker: before embarking on any development using Lumberyard scripts in the current beta version.

1 Like

Hi @Didier

I’m aware of this situation, I agree with you completely ,Plus, I’ve been reporting bugs and bugs for lumberyard since 2016 - 2020(Now).
I even wrote strategies as different ideas for Amazon & Lumberyard Team in the forum here.

There seems to be some ambiguity that Amazon doesn’t want to Hire for Grow Lumberyard’s team, at least the script canvas team. :thinking: :face_with_monocle: I found a lot bugs/defects/problems in script canvas & lumberyard since 2016 - 2020(Now) , I reported most of these bugs and defects and problems.

There is no live stream and no road map at the moment.

You can’t make great games with Script Canvas with bugs and many flaws(independent of C++/Lua , ONLY SC), I don’t want to disappoint anyone but as a teacher and writer, I try to present positive reviews.

I know that developing and completing a game engine is very hard and time consuming, but people don’t wait, people love surprises.

I think Lumberyard Prime is on its way to the final and stable version.