When I go through a trigger to do something it doesn't save

Use a Lua variable to remember it.supadupa64 wrote:Hey so here's another thing. My load works every time except for the first time as usual. But here's another issue.
When I go through a trigger to do something it doesn't save. What would I add to the trigger to the game remembers when the sequence is? I have a sequence trigger on a trigger collider.
Code: Select all
Variable["EnteredCave"] == false
Code: Select all
SetActive(Rocks);
Audio(Rumble);
SetVariable(EnteredCave, true)
You don't really have to set up the variables ahead of time.supadupa64 wrote:Here's the thing. I have about 60 or so triggers in the game. A lot of them just enable or disable objects with SetActive(). Are you saying that if I want the game to save the SetActive() command I have to set up a variable for every sequence trigger?
Use a Persistent Active Data component. For the tree example, let's say your Sequence Trigger looks like this:supadupa64 wrote:Let's say my player goes through a trigger collider and it enables lots of trees. If I go through that trigger, save the game, then load it, those lots of trees are not there because the trigger didn't save. Maybe you got that the first time though.
Code: Select all
Variable["EnabledTrees"] ~= true
Code: Select all
SetActive(TreesParent); SetVariable(EnabledTrees,true)
Code: Select all
Variable["EnabledTrees"] == true