|
Post by Heath Close on Aug 15, 2023 7:47:45 GMT
I added some debug to the level settings listener so I can trigger some game over screens.
insert code here /// <summary>
/// This method gets called when the player wins (last wave completed and game not over).
/// </summary>
public virtual void Win() {
// your code here.
Debug.Log("Win called on level settings listener");
}
/// <summary>
/// This method gets called when the player loses (game ended from lives = 0 or other game-ending trigger).
/// </summary>
public virtual void Lose() {
// your code here.
Debug.Log("Lose called on level settings listener");
}
/// <summary>
/// This method gets called when the player wins or loses.
/// </summary>
public virtual void GameOver(bool hasWon) {
// your code here.
Debug.Log("Gamer over called on level settings listener - hasWon: " + hasWon);
}
(if there is a better place to do that please let me know)
I have the Health world variable trigger game over with min=0 and max=0, and I get the game over and lose debugs, so that is working, but when I complete the one and only wave to test the win degug, I never get a win.
Last level completed is set to win. Every enemy spawns, the player kills all enemies, and then nothing happens.
What am I doing wrong?
|
|
|
Post by DarkTonic Dev on Aug 15, 2023 13:28:30 GMT
Is your last (only) wave a timed or elimination wave? I'll see what happens on my side if you let me know.
|
|
|
Post by Heath Close on Aug 16, 2023 10:34:19 GMT
Is your last (only) wave a timed or elimination wave? I'll see what happens on my side if you let me know. Elimination ![]() 
|
|
|
Post by DarkTonic Dev on Aug 16, 2023 13:30:01 GMT
I tried to reproduce on the example scene 1 with 1 wave in the only level (deleted the rest) and I get both game over and win to trigger when I finish the elimination wave. So I wasn't able to reproduce what you're seeing.
You are on the latest version?
Can you send me a scene (as a package) that I can try here to reproduce?
|
|
|
Post by Heath Close on Aug 16, 2023 16:11:12 GMT
I sent the scene in a private message
|
|
|
Post by DarkTonic Dev on Aug 16, 2023 16:48:55 GMT
Thanks. So I'm not sure how to normally beat your wave, controls or what.
I clicked the global skull and crossbones icon on Pool Boss to kill everything during play mode.
The Console then showed me both win and game over. So I didn't reproduce anything like you're saying.
|
|
|
Post by Heath Close on Aug 17, 2023 6:40:44 GMT
it's self playing. There are no controls, only upgrades to attack speed, power, range, etc., which I have not yet implemented.
if you just let it play, the wave will spawn, all the enemies will die, and that should be the end of the level.
I just tried kill all and that also worked for me and triggered a win condition.
Doing that revealed the real issue. Kill all also kills the 1 tower that spawns, which is what I want to be the killable player. That is why is I make the mobs for that wave harder (make the wave repeat endlessly for example), they eventually kill the tower and trigger the game over loss because Health world variable reaches zero.
The problem comes with health reaching zero on a killable that is not in pool boss. If the tower isn't spawned, the game doesn't trigger game over when Health WV reaches zero.
I am not sure how else to do it.
For example, if you pull the tower to be....
Hmmm. Actually I just tried all I was going to explain just to make sure and now it seems to be working. I spent days trying to make this trigger a game over before bothering you with this, and now in one conversation it works.
I don't know... I was having trouble getting a game over with the killable player not being spawned, but now I can see the debug for a loss. I should be able to write code now that stops movement on the mobs and pulls up a game over screen, and go from there with continues and whatnot. Hopefully I can reproduce this in the future as well.
Thanks so much for taking a look at it.
|
|
|
Post by Heath Close on Aug 17, 2023 6:56:46 GMT
right.. ok, here is what happens if I don't spawn the killable player and Health WV reaches zero. It's like the killable script requires it to be spawned.
which is why i had it set up to spawn, but then the wave can never be won unless the tower is killed as well as we see when using the kill all.
The Transform 'Tower' passed to Despawn is not in Pool Boss. Not despawning. If you want this to be allowed, check the Auto-Add Missing Items checkbox. UnityEngine.Debug:LogError (object) DarkTonic.CoreGameKit.LevelSettings:LogIfNew (string,bool) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Level/LevelSettings.cs:1418) DarkTonic.CoreGameKit.PoolBoss:Despawn (UnityEngine.Transform,bool) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:1283) DarkTonic.CoreGameKit.Killable:DespawnPrefab () (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:1727) DarkTonic.CoreGameKit.Killable:DespawnThis () (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:1902) DarkTonic.CoreGameKit.Killable:DespawnOrRespawn () (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:1855) DarkTonic.CoreGameKit.Killable:Despawn (DarkTonic.CoreGameKit.TriggeredSpawner/EventType) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:1829) DarkTonic.CoreGameKit.Killable:PerformDeath (string,bool) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:1239) DarkTonic.CoreGameKit.Killable:LateUpdate () (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/Combat/Killable.cs:636)
|
|
|
Post by DarkTonic Dev on Aug 17, 2023 13:09:53 GMT
I think you can just add that Killable to Pool Boss. I'm not sure why it isn't in there.
|
|
|
Post by Heath Close on Aug 17, 2023 13:55:55 GMT
I think you can just add that Killable to Pool Boss. I'm not sure why it isn't in there. I guess I didn't understand. Even after looking at all the documentation, setting it up that way didn't reveal itself until you sounded puzzled by why it wasn't like that. I swear I even tried this and when I got the error to auto add, that didn't make sense either. But, now if I create the pool boss item for the tower, and set it to spawn 0, and after getting the error to auto add the item on despawn, I get a game over and a player despawn. Maybe there was a more obvious way to set this up for what I wanted and how I set it up was obscuring a more basic solution. Thanks for your help and if you have advice on a better way to set this up, I'd love to hear it.
|
|
|
Post by DarkTonic Dev on Aug 17, 2023 18:29:31 GMT
Glad it's working now.
Well, everything needs to be in Pool Boss if it uses Killable. If you see a place I should clarify in the docs, let me know. Happy to add.
The Killable Inspector does have a big prominent error section near the top that says "This prefab is not configured in Pool Boss", and controls to add it. I thought that would be sufficient?
|
|
|
Post by Heath Close on Aug 18, 2023 8:07:31 GMT
yes the error to add it is super obvious, but when I did, and had it spawn the player like the enemies, I never got a win from the wave because the tower was still alive, which is why we only got a win from the kill all. So that had me looking for a different way to set it up, and since spawning the tower was not an option, that where the confusion started setting in for me.
I guess I didn't have a clear understanding that if the player is not spawned by pool boss so it isn't part of the wave (which if it was I would never get a win), yet the error says I need to add it to pool boss, and the killable requires it to be in pool boss, how do I get the wave to complete if I don't want pool boss to spawn it.
If this isn't a confusion others have come across, it must just be me. Thanks again for your help.
|
|
|
Post by DarkTonic Dev on Aug 18, 2023 16:01:56 GMT
Yeah, let me clarify.
Just because it's in Pool Boss doesn't mean it has to spawn from it. It can be already in the Scene. The reason is was broken was because Killable needs to despawn into Pool Boss. It broke at that point (console error right?) and didn't continue to do the other parts.
|
|