Hi. New Dungeon Editor user here. I've hit an issue that I haven't been able to get past and I was hoping someone could help. I am interested in having a "global" script where game-wide variables are stored, such as flags representing player actions and choices. I have been able to read global variables thusly ("globals" is a script object on the map for these examples):
Code: Select all
if globals.script.f_undeadFood then ...
And if I set variables, such as f_undeadFood, from within the global script object, then things work as expected. This includes the variable's state being serialized along with the save game:
Code: Select all
function toggleUndeadFood()
f_undeadFood = not f_undeadFood;
end
However, if I try to assign to the variables from a different script, such as this:
Code: Select all
globals.script.f_undeadFood = true;
It seems to override an implicit getter with a direct value rather than modifying the actual variable within the global script. This still updates what other scripts see as the variable's value, but the value change is not serialized along with the save game. Instead, saving the game after changing the value in this way produces this warning:
Code: Select all
Warning! Game object property not saved: globals.script._userProperties
So, is it possible to modify a scripts global variables from a different script? If not, is there any other way to make game-wide global flags? I've already tried this:
Which had basically the same warning when saving the game:
Code: Select all
Warning! Game object property not saved: party.party._userProperties
This party.party.* option has some benefit, actually, as it resolves a concern I have about flags being tied to specific maps.
Thanks for any help you can provide.
PS >> I recognize that I could write a setter method for each variable. However, I've written a branching dialogue system, and I expect to have a LOT of flags. Any overhead to flag management is pretty rough.