Saving data/states? Created 1 month ago2020-09-20 11:42:14 UTC by Draeger Draeger

Created 1 month ago2020-09-20 11:42:14 UTC by Draeger Draeger

Posted 1 month ago2020-09-20 11:42:14 UTC Post #344727
So, currently, I'm trying to make a sort of incremental story level, where you complete endings and in certain endings, a number is changed and saved and lets you advance further and further in the level by triggering door locks and stuff. But I'm not sure how I could save a number and let it trigger things when the number increases. Is that possible? I'm making the level/mod for a game based on the Portal 2 version of Source, by the way.
Posted 1 month ago2020-09-20 13:16:58 UTC Post #344728
Yep, you should be able to handle this with globals:

I don't know much about Source, so I don't know how flexible globals are - but at the very least they can store a yes/no value. So for every action that the player can take (or not take) throughout the mod, you store it as a yes/no value with a name against it. And then in the endings, you can load those values and use logic entities to lock/unlock the endings that you want to happen.

Oh- and also, if this is just for a single map (no level transitions) then you can just use math_counter, which can do the counting you described. You can then use logic_compare to fire events if the counter is less/greater/equal to a certain number.

For multiple maps, you could use all of the above - globals to store the variables across level changes, a math_counter to count all the "yes" globals in the ending map(s), and the logic_compare to trigger the appropriate endings.
Penguinboy PenguinboyHaha, I died again!
Posted 1 month ago2020-09-20 14:09:40 UTC Post #344730
Thanks a lot!
You must be logged in to post a response.