Looks like you're not logged in

Login or Register to continue

Lesson Q&A

Use this space for questions related to what you're learning. For any other type of support (website, learning platform, payments, etc...) please get in touch using the contact form.

  • Solution for BattleUnits not stopping execution on Combat End + some other tidbitsCarthorisI haven't been 100% following the code in the lessen, I've been changing things up to fit my preferences, plus I'm using Godot 4 which changed things up a bit, so maybe this was only a problem for me but in case someone else runs into it here's how I fixed the problem. When the Combat Results would appear the Battle Units weren't stopping the execution of their process causing them to continue with their turn bringing up the action menu and crashing when you chose an option since all the enemies were dead. Running through a couple of times with breakpoints I found the problem, **_on_battle_unit_action_finished** in the Turn Queue. After the **end_combat** func finished execution, setting all the Battle Units **_is_active** to False (or in my case **_is_paused** to True as I renamed it) the Battle Unit who's turn just finished would then emit the **action_finished** signal triggering **_on_battle_unit_action_finished** which would then proceed to reactivate (or unpause in my case) all the Battle Units. So the simple solution was just to nest that functions code in a **if _is_active** (or **if not _is_paused** for me) so it looks like this: ```gdscript func _on_battle_unit_action_finished(): if not _is_paused: for battle_unit in battle_units: if battle_unit.is_alive(): battle_unit.set_is_paused(false) ``` Two other things: My first attempt at solving this issue I changed Combat Demo to check for combat end on the **died** signal, emitted when the Battle Unit actually dies, rather then on the **hp_depleted** signal, emitted every time the Battle Unit takes damage. This didn't solve the issue above but still works and in my opinion it makes more since to check this on actual unit death rather then every instance of damage. Last thing, I've always been told when using Godot that it's good practice to **'signal up and call down'**. Meaning that since Combat Demo is at the top of the tree, it should never be emitting signals, only receiving. Thus rather then having Combat Demo emit **combat_ended** for UI to receive, I just moved the UI code into Combat Demo and had it instantiate the Combat Result Panel itself. Like this: ```gdscript func end_combat(victorious : bool): Queue.set_is_paused(true) for UI in $UI.get_children(): UI.hide() var message = "Defeat" if victorious: message = "Victory" var CombatResultPanel = UICombatResultPanel.instantiate() CombatResultPanel.text = message $UI.add_child(CombatResultPanel) ``` 1 0 Aug. 15, 2023
  • Lesson orderThePirateKingThe end of this lesson says: > In the next lesson, we’ll add the damage and miss labels so that the player can see the exact effect of their attacks and applied statuses. however, this is the last lesson listed on Mavenseed for the **JRPG: UI** chapter. 1 0 Jan. 12, 2021
Site is in BETA!found a bug?