How do I fix this error in the code? #346
-
|
So after I restart the game and Sonic goes in the ring again, this error shows up: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
|
If you really want to delete the player, add this to the if You could also just make focusPlayer invisible and use the animation state to make them look like they dissapeared. Maybe check what special stage rings do in the base framework? |
Beta Was this translation helpful? Give feedback.
-
|
Can you be specific? What part needs clarification? |
Beta Was this translation helpful? Give feedback.
-
|
The first thing is relevant because this code wasn't designed to handle the
player being suddenly freed. Freeing objects in Godot doesn't remove any
pointers to them, so Global.players.size() isn't 0, and the code tries to
read the rings of a player that doesn't exist anymore. The snippet i put
will return false if the player it tries accessing doesn't exist. It's a
hacky fix in the framework code, and you'll probably have to fix more in
this same way to make it not crash, but it is a way.
…On Sat, Apr 4, 2026, 7:27 PM ImmaStikboi ***@***.***> wrote:
im not rlly sure how the first idea would fix the error as the line where
the error apparently is is (from what i understand) the code that tracks
the players rings ig
also sorry for not replyin for a while i was very busy today
—
Reply to this email directly, view it on GitHub
<#346 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4JOMPMBUKDUJ2P5TDPRKNT4UGK5NAVCNFSM6AAAAACXL564PCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMNBVGA3TINA>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.



Keep the original condition as well. Should be (Global.players.size() > 0 and is_instace_valid(Global.players[focusPlayer]))