Trigger a reset number variable to zero
Posted: Thu Oct 08, 2020 6:44 pm
I am using Invector integration. One of my quests uses a number variable to record the number of enemies killed. The enemies have an "Increment On Destroy" component attached. However, if my Player dies in combat the level is reset and the Player re-starts the level. This means that any enemies not destroyed are destroyed when the level resets and my variable continues to increment thereby messing up the "enemies killed" quest when it is assigned for the second time because the variable says the enemies are already dead.
But - the game restarts in an area where I can place a trigger across the path and I want to trigger lua code to *re-set* the variable to zero. After passing through that trigger the player can then go through a second trigger to deactivate the first trigger. This would fix the issue I hope. If it does, what sort of trigger can I use to call lua code to reset the variable to zero and what lua code would I use to do that please?
But - the game restarts in an area where I can place a trigger across the path and I want to trigger lua code to *re-set* the variable to zero. After passing through that trigger the player can then go through a second trigger to deactivate the first trigger. This would fix the issue I hope. If it does, what sort of trigger can I use to call lua code to reset the variable to zero and what lua code would I use to do that please?