Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+9 votes

I want to emit a signal when an enemy dies but it just will not emit for some reason. I connected it in the node tab to the correct thing, there's a method to handle the emitted signal, and I'm calling died.emit() but it just won't emit. Is there anything else I should try?

asked in CSC380Jan2024 by (2.2k points)
+2

Whoops meant to hit answer

4 Answers

+4 votes

maybe try emit_signal(died)? if that doesn't work I'd probably need to see your code to help further

answered by (3.8k points)
+4 votes

...Weird question but you do have signal died in the "variable" part of the code right? That's the only thing I could think of as to why it's not working.

answered by (2k points)
0

Yes I do

+4 votes

I believe you want to call emit_signal(signal), but I could be wrong.

answered by (3.3k points)
+1

You can use signal.emit() as well. Both of them work, so the way he's calling it shouldn't be the issue.

+3 votes

Ensure that the signal is correctly connected in the Node tab, ensuring there are no typos or capitalization errors. Additionally, check that the receiving node is part of the scene and hasn't been removed or destroyed, as signals won't reach nodes outside the scene tree. Verify that the signal parameters match those expected by the connected method. Debug print statements before and after the emit call can help trace the signal's flow. Pay attention to case sensitivity in signal names, and be cautious of parent-child relationships that might interfere with signal propagation. Check for any script errors in the Godot Output panel, and ensure the scene updates after emitting the signal. If issues persist, providing relevant code snippets can aid in pinpointing the problem for more targeted assistance.

answered by (2.1k points)
+2

This helped me identify the problem, thank you!

...