I been trying to figure out why I am unable to set variables within my records via action. This has absolutely devastated my progress in my map.
Here is a demonstration of what I am trying to achieve. (Not actual codes from map but I can give that if requested)
(Name)
Record (Data)
Variable - (Test)[Integer]
Trigger
Event Elapsed time 2 seconds
Local Variable
(Data)
Action
Set variable (Data).(Test) to 5
Trigger
Event Elapsed time 3 seconds
Local Variable
(Data)
Action
Display , convert integer to string (Data).(Test), to all players to subtitle area
What this should be doing is showing me the number 5 after 3 seconds in the game, however this is not the case. Nothing happens. However, if I were to change the (Data).(Test) into a string and initially set it as 5. Then it works. This is proving that I am failing to set the variable for the record
This is confusing so I'll ask the question in a different way.
I am having issues setting variables within records through actions. I already have variables inside records, and the triggers has the local variable record already. I want to be able to change a variable inside a record.
Please help, and again if necessary I can post actual codes from my map.
The variable that references a record should be global, not local.
Make your record, then make a new global variable of type "- Record" and set the record slot to the name of your record. In your trigger you will then reference that global variable to save or get values inside the record.
Oh my god! Thank you! That was exactly the problem!
Although it is a bit odd you need to do that extra step, regardless this fixes my issue! I had a few things working when I did it the local method which give the game more performance. But this method shouldn't be too much more effort.
I been trying to figure out why I am unable to set variables within my records via action. This has absolutely devastated my progress in my map.
Here is a demonstration of what I am trying to achieve. (Not actual codes from map but I can give that if requested)
(Name)
What this should be doing is showing me the number 5 after 3 seconds in the game, however this is not the case. Nothing happens. However, if I were to change the (Data).(Test) into a string and initially set it as 5. Then it works. This is proving that I am failing to set the variable for the record
This is confusing so I'll ask the question in a different way.
I am having issues setting variables within records through actions. I already have variables inside records, and the triggers has the local variable record already. I want to be able to change a variable inside a record.
Please help, and again if necessary I can post actual codes from my map.
@cam55555: Go
The variable that references a record should be global, not local.
Make your record, then make a new global variable of type "- Record" and set the record slot to the name of your record. In your trigger you will then reference that global variable to save or get values inside the record.
Oh my god! Thank you! That was exactly the problem!
Although it is a bit odd you need to do that extra step, regardless this fixes my issue! I had a few things working when I did it the local method which give the game more performance. But this method shouldn't be too much more effort.