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.
Battlers not processing after first act() callCueBallJamalAfter the first call to act() by the player and the enemy, the game hangs because neither battler is processing. I just wanted to know if there was something I was missing and that their is_active or set_process is set to true again somewhere10Feb. 13, 2025
Proper OutputLebblThis is just a short question. Are both battlers supposed to be taking 0 damage? If not, might there be a common mistake that would be causing this?
Here is a google drive link to my project at this point(Godot 4):
https://drive.google.com/file/d/1gNuNFLCVDAl7hXkzQho71irNmsUR5OC3/view?usp=sharing20Nov. 08, 2023
Feedback for run scene testgodoterfrAs far as I am concerned, I made a small modification to the code to be able to run the test scene. I commented out the return that will work in when the code is complete and I put in my personal return.
In Battler.gd
```gdscript
func is_player_controlled() -> bool:
# return ai_scene == null
return is_party_member
```
As both battlers do not have an AI script, this piece of code :
In ActiveTurnQueue.gd
```gdscript
func _ready() -> void:
for battler in battlers:
battler.connect("ready_to_act", self, "_on_Battler_ready_to_act", [battler])
if battler.is_player_controlled():
_party_members.append(battler)
else:
_opponents.append(battler)
```
integrated the two battlers in _party_members (the player and the enemy) and I ended up with zero opponents.
In ActiveTurnQueue.gd
```gdscript
func _play_turn(battler: Battler) -> void:
#...
var opponents := _opponents if battler.is_party_member else _party_members
#...
```
As a result, this code returns "opponents = \[\]".
In ActiveTurnQueue.gd
```gdscript
func _player_select_targets_async(_action: ActionData, opponents: Array) -> Array:
yield(get_tree(), "idle_frame")
return [opponents[0]]
```
And selecting index 0 of an empty array crashes the run scene.
Now it works. Of course, until the player sets the enemy's health to zero, it's normal.
 10Mar. 30, 2023
3.5 stable: Affinity in screen shots has changedBleedingEdgeWhen setting the Affinity field of the player_stats or enemy_stats.tres resources, in 3.5 stable, the drop down is the case-adjusted enum value (e.g. "Art") rather than numeric index (3).
Further, for the Weaknesses list, you have to click the small pencil to inform the Inspector that the values are of type int. 30Aug. 27, 2022
Getting around lack of code completion for exported Battler stats varZivixHey! Just thought I’d share how I’m getting around the lack of code completion/strict typing for exported Resources for now:
**The Problem:**
You have to do `export var stats: Resources` because `export var stats: BattlerStats` leads to **error(12,1): Invalid export type. Only built-in and native resource types can be exported**. As a result, stats lack type hints/code completion.
**The Solution:**
I updated my code with a new typed **stats** variable and changed the exported variable name to **stats_resource**. **stats** is then initialized in **_ready()** assigned to the result of **stats_resource.duplicate()**
**Updated Code:**
export var stats_resource: Resource
var stats: BattlerStats
func _ready() -> void:
assert(stats_resource is BattlerStats)
stats = stats_resource.duplicate()
stats.reinitialize()00Aug. 07, 2022
No yield in the setters in ActiveTurnQueue?ryanrom5Hello,
I learned from your tutorials that setters get called when objects enter the tree, which happens before ready/onready signals. On the ActiveTurnQueue you have two setters that iterate over 'battlers' which is an array created in the onready function. But for some reason it isn't throwing an error even though you aren't yielding until ready, so I think I'm missing something.
How are you able to iterate over 'battlers' in a setter function, when battlers aren't defined until ready is called?
Thank you10Aug. 06, 2022
debugging questionpamlarI've been tracing this back through the various scripts and haven't been able to figure out where I've gone wrong. I'd appreciate any ideas on where to look and/or what to look for. Thanks!
40Jul. 09, 2022
Invalid get index 'is_targeting_self' gd:53cbpas
Having problems testing the game. Not sure if it's affected by me putting all the scripts in different folders?10Jun. 03, 2022
Why not typing in some variables?amaI noticed you don't use typing in some variables, for example in
> ```gdscript
> # BattlerStats.gd
> export var actions: Array
> ```
You could use typing in that as
```gdscript
export(Array, Resource) var actions
```
And also in Battler.gd same thing
> ```gdscript
> export var actions = []
> ```
Could be turned into
```gdscript
export(Array, Resource) var actions
```
Those don't help a lot but still less clicking in editor, but then came in mind if there is something in Godot preventing to use typing in those? 30Nov. 27, 2021
First screenshot of the lesson not placed correctlyGrominetHello, just to point out that the first screenshot should be placed (as I understand it) next to the 4th one. I don't see a reason for it to be just after the section title. 10Jul. 15, 2021
bypassing setter function?Lemmilyin Battler.gd in the act() function
you have
if is_active:
set_process(true)
But isn't this already being handled in the set_is_active() function? Just curious if this is on purpose or not! (and why if so!)10Jun. 20, 2021
final ActiveTurnQueue's _readyopyateHey :)
In the final ActiveTurnQueue (at the end of the section) in the _ready, you have:
```gdscript
if battler.is_player_controlled():
```
I'm wondering if it ought to be:
```gdscript
if battler.is_party_member:
```
Or even
```gdscript
if battler.is_party_member || battler.is_player_controlled():
```20Mar. 08, 2021
how to testopyateHey :)
The section where "we test like the pros" might benefit from a reminder on how to test, e.g. which scene to run and what to do/click. 20Mar. 08, 2021
Partial commentopyateHey :)
There's a partial comment in one of the code blocks:
```gdscript
# We shouldn't set process back to true if the
```10Mar. 08, 2021
Use Gd file instead of Tres Filebserveready-gmail-comHello! May I know isit possible to use BattlerStats.gd, instead of PlayerStates.tres in the battler parameter? Since the BattlerStats.gd is extended from Resource, and Battler need resource input type as its export variable, why cant BattlerStats.gd used directly as a stats variable in BattlerStats.stats? 10Feb. 08, 2021
Parse Error: The first argument of "yield()" must be an object.bserveready-gmail-comHi. Under the battler act method, I am unsure about how the cyclic dependency issues can be created. I managed to add Action Type hint inside the parameter as followed:
func act(action:Action)->void:
but now I have an error message in the editor saying:
"Parse Error: The first argument of "yield()" must be an object."
which tell me that action.apply_sync() is not returning an object. This issues can be ignore only if I displaced the type hint Action over the function parameter.
My question is, why during run time the system allow apply_async (which returning a bool) as its first parameter, but not allowed when I declare it inside the editor mode before run the game. 30Jan. 29, 2021
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.