magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 14, 2018 0:35:51 GMT
This doesn't happen every time on every wave/level, but I'm seeing an issue where after calling RestartCurrentWave that the LevelStarted callback advances the levelNum value to the next level. The actual level/wave being restarted seems to work fine, but the callback is telling me that the next level has started. I put some debug in the LevelStarted callback and when the level starts it's showing a value such as 2. Then I call RestartCurrentWave and I see LevelStarted gets called again and this time it's telling me the levelNum = 3.
A little more info. After the player's lives are completely gone I'm presenting a Continue Game option. If the player elects to continue then I reset the player lives to maximum and call the RestartCurrentWave function. In the first game level I kill the player off and elect to continue and it works fine, but if I then kill the player a second time and call RestartCurrentWave then this time it tells me the next level has started even though it's still restarting the correct level/wave. In my 3rd level, it only takes a single player kill to cause the issue to manifest.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 14, 2018 0:43:23 GMT
I'm working around this issue now by flagging it as a restart and ignoring the incorrect levelNum passed into LevelStarted if the flag is set. But definitely seems like something is wrong here.
|
|
|
Post by DarkTonic Dev on Jan 14, 2018 1:13:25 GMT
I'll see if I can reproduce it and let you know.
|
|
|
Post by DarkTonic Dev on Jan 14, 2018 2:26:58 GMT
I can't test this. It's an illegal condition unless you have left something out.
If the player has lost all lives (I'm assuming that's a game over condition), then calling RestartCurrentWave won't do anything because IsGameOver is still true. It will log this and exit "Cannot restart current wave because game is over for Core GameKit."
If you want to continue in the middle of the same wave, you can call LevelSettings.ContinueGame and it will re-initialize any World Variables (lives) that should be and take care of setting IsGameOver to false.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 14, 2018 2:40:48 GMT
I haven't checked the box for "Triggers Game Over?" so lives at 0 doesn't trigger game over. I specifically have it this way so that I can do the Continue Game feature. But maybe that's where the problem lies. I suppose I could trigger game over as you suggest and then run ContinueGame instead. I'll give that a try and let you know.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 14, 2018 2:41:50 GMT
Wait. If it resets world variables then it would reset the score as well, but I don't want that. I want a continue game to keep the score and let the player keep going.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 14, 2018 2:45:12 GMT
It seems to work. Not sure about the score part though as I am not managing the score or showing it yet, but I think this solution works. Better than what I was doing because it truly continues from the same spot instead of restarting a wave, which I didn't really want anyway.
|
|
|
Post by DarkTonic Dev on Jan 14, 2018 3:08:57 GMT
It doesn't reset all World Variables - it re-initializes them. You can choose what happens to each in the World Variable's Inspector. You probably already have them how you want.
Look at the Persistence Mode field for each. If you want it to reset, then "Reset to Starting Value", otherwise "Keep From Previous". Things like Experience Points or Currency should never go away.
I think this will work better for you overall.
|
|
magique
Full Member
 
Posts: 194
Posts: 194
|
Post by magique on Jan 14, 2018 4:44:49 GMT
Thanks. Yes, this will work great for me.
|
|
|
Post by DarkTonic Dev on Jan 14, 2018 5:45:50 GMT
No problem, this is actually a super old feature (doesn't mean that most people are using it though).
|
|