|
Post by Tirollie on Sept 22, 2016 14:38:49 GMT
Hello,
I would like to know where the current wave level and the worldvariables are stored, i can't seem to find it.
I'm using autosave from easy save 2 to save these values.
|
|
|
Post by DarkTonic Dev on Sept 22, 2016 15:54:45 GMT
It's not in a WV. You can access it with the code:
LevelSettings.CurrentWaveInfo
|
|
|
Post by Tirollie on Sept 22, 2016 19:36:57 GMT
I don't understand, how can i use this to save the current wave level? I need to bring it in the hierarchy before i can save it with easy save2.
|
|
|
Post by DarkTonic Dev on Sept 22, 2016 19:58:48 GMT
I'm not sure how you do that. This is a static method on a class that's in the Hierarchy but you have to access it via code.
|
|
|
Post by Tirollie on Sept 22, 2016 20:12:21 GMT
I really need a way to save the current wave or else my game is useless if i can't save the waves...
|
|
|
Post by DarkTonic Dev on Sept 22, 2016 20:26:26 GMT
I told you how to get it through code. Surely EasySave has a way to use code for certain parts? You may need to ask the author of that plugin. I am not familiar with it.
|
|
|
Post by Tirollie on Sept 23, 2016 9:06:12 GMT
Hi,
So i checked with easysave and they wrote me a script how to save the values:
using UnityEngine; using System.Collections; using DarkTonic.CoreGameKit;
public class SaveStaticVariable : MonoBehaviour { void Start() { if (ES2.Exists("myFile.txt?tag=_currentLevelWave")) LevelSettings.CurrentWaveInfo = ES2.Load<int>("myFile.txt?tag=_currentLevelWave"); }
void OnDestroy() { ES2.Save(LevelSettings.CurrentWaveInfo, "myFile.txt?tag=_currentLevelWave"); } }
Only problem now is that CurrentWaveInfo is read only and returns a error because it is an accessor.
I checked and there is a value _CurrentLevelWave in LevelSettings.cs but when i save this value and start the game at lvl 1, wave1, and then quit, and then start the game again i start at level 1 wave 2 and i after that at level 1 wave 3 etc.
Could you give me more clarification on what specific variable i need to save, i'm so close now
|
|
|
Post by Tirollie on Sept 23, 2016 20:22:30 GMT
I tried almost everything now, saved different values but without any luck, the best value to save was _CurrentLevelWave but when i save this it skips a wave on load, can't figure out why. I can't seem to save the current level i'm in which means all my work is for nothing if i can't save that value.
Why can't you help me with this?
|
|
|
Post by Tirollie on Sept 23, 2016 22:30:10 GMT
Nvm already ninjad my way threw it
|
|
|
Post by DarkTonic Dev on Sept 23, 2016 23:12:51 GMT
Sometimes I only have one time a day I can respond to messages here. Today, now is that time. Yes the property is readonly.
What you would want to do is save the level + wave number out of CurrentWaveInfo, and then call LevelSettings.GotoWave with those parameters when you're loading a saved game. That *should* work, but this isn't really a supported feature as I've never tested it.
|
|