#Signal connection on parallel scenes
1 messages · Page 1 of 1 (latest)
I thank you
what are you using the signal for?
but more or less 5yo explanation is: I change state, then cursor changes to sprite, sprite must reach area2d of fountain, fountain emits "materials" it has, on area exit it doesn't, or rather emits nothing
sounds like utter bullshit but I'll make it exist first with thoughts and prayers
How did this break with a global signal?
I didn't figure out how to wire everything like it was before
I added it to global and then had ape cymbals gif
Well for starters make your autoload script and define your signals
did that, and that's about all I did
Can I have a looksee at the script?
indeed, would help lol
there's like, signal definition and nothing else
because I never connected anything before with just code
Does it include things you'd like to pass with the signal?
so don't have reflex on how to
you'd need to connect the signal to the callback function you want to run when the signal is emitted
i know how to do this with C# events, but i kinda forgor how to do this in GDS lol
what's callback here? function without parents?
but as an example in C# you'd connect your event on _ready(), to the function you wanna run when it gets emitted
Just do GlobalSignal.signalname.connect()
like line 51 (for parameters) or line 52 (functions without params)
(ignore everything else in the image lol)
i assume a similar principle is used with Godot Signals
so function without parents
nods
would you also happen to know how to make a collection of unique elements?
as in an array of a class? (like an array of class_name player for example)
or a dictionary?
just something that only takes in unique values, or at le
wait
you're genius thanks
I can just track quantity of material and subtract if it goes away
instead of fucking
readding and reremoving it back and forth
how did I not think of that 🤦♂️
you're wonderful person
lol
Context is important.
explaining something you're working on sometimes helps you solve the problem yourself
see, if you hover over 2 fountains, you get two water material, and if done wrong, you can get in a limbo where you either have all water or none, which is bollocks
In this lesson, we will look at signals. They are messages that nodes emit when something specific happens to them, like a button being pressed. Other nodes can connect to that signal and call a fu...
nah, I tried many times for weeks
it flashed only now
and before you nobody was too willing to listen anyway
get a reference to the autoload node with the global signal script and connect to the signals
well glad i could help lol
oh you fucking did
way more than you think actually
so...
is there a caveat on disconnecting signals from stuff that's gone?
i don't think so
in a modern engine like Godot it should just clean it up for you if you delete a node with an event (signal) that isn't disconnected
yea no i don't think there is
but how to connect signal to newborns then
newborns? lol
you mean nodes that are instanced (created) at runtime (while the game is running)?
you'd do something like this
on their _ready() function
which is called when they're instanced and ready to be used
nay
you connect from global script which always exists no?
but things that change are ones you connect to
how would you "request" global to connect to you on your ready 
no, you don't have global connect to your node
you have your node connect to global
you'd define the signal you wanna connect to in the global script
it's a warning in editor then
In your other scripts, like area or player, you'd connect them.
here's where I don't get it again
Which part?
connect where from/to
Say we have a global "damage" function.
GlobalSignal.gd (autoload)
signal damaged(Hurt: CharacterBody3D, Source : CharacterBody3D, DamageTaken : float)
func _ready():
GlobalSignal.damaged.connect(_on_damaged)
func _on_damaged(Hurt: CharacterBody3D, Source : CharacterBody3D, DamageTaken : float):
pass
So the signal is sent out to all nodes, you just need to tell them to listen for the signal.
Sending the signal is as easy as GlobalSignals.damaged.emit()
(don't forget to pass variables needed)
yeah I thankfully know how to send, as I mentioned it was working alright
just never been connecting via code
Also no promises that the code functions as is I don't have access to Godot atm so syntax might be slightly off
But that's the general idea.
What about em
I've been there, I've given my player class_name and called it a day, since I don't know what else I'm supposed to do with it
I mean you don't have to do anything
how so
Classes are useful when you want to define additional functions
which I do
Like your player might have things that regular CharacterBodies don't have
wish I knew what they have to begin with...
It's all in the documentation
So this is the general chain of inheritance
adding a class name to your script like:
class_name Player
extends CharacterBody3D
Just adds another chain in the link
stupid question?
go ahead
why not Unity at this point in your case
lmao
well in my case i don't tend to use signals, i usually use C# events
but to answer your question...
1st: Godot is open-source, Unity is not
if Godot suddenly decided to ruin their engine, i could just yoink the source code and fork it
2nd: Godot has a much better user experience than Unity
as if many people care (ie can benefit from it)
i still remember having the Unity editor crash on me 3 times a day, haven't had Godot crash on me once in 2 years
3rd: Unity is *Free™ (* free until you pass a certain treshold), Godot is just free
They do, in fact. Care. For example look at the 'Runtime fee" fiasco. Even though Unity backtracked that decision. A lot of dev jumpship just from that alone.
yea
not to mention you don't know what kind of spyware telemetry they potentially have packaged in there, with that whole "oh we will know if you meet our requirements to pay install fees" talk
with Godot that isn't an issue, you can pull apart the source code and analyse it yourself
not to mention yea, 4th: you can modify the engine code if you need to
i actually did this in a project, to add engine support for FFB
Not to mention follow along with development when you have engine issues 
SDL input implementation my beloved
i followed that github pull request for months lmao (https://github.com/godotengine/godot/pull/106218)

hmmm but Unity has better uh encryption?
what, of the game files?
you can also do that in Godot
The export dialog gives you the option to encrypt your PCK file with a 256-bit AES key when releasing your project. This will make sure your scenes, scripts and other resources are not stored in pl...
word is on the street it's barely enough
not that I'm zealous about it, but so I've heard
as well as it's possible to extract that key with reversing like ghidra
maybe, i'm not a security expert
but sure, let's assume so, why should i care as an indie dev lol?
my projects are small singleplayer games, they don't exactly need top notch asset security
because people might resell your stuff or use your brilliant code to make stuff they sell under own name
yada
wait what were we talking about

I wanted to make a game
then something happened and we ended up with this encryption talk, as if someone needs to encrypt something right now
well if you're worried about code theft don't worry, if someone is smart enough to decrypt & decompile binaries into usable source code (that's the tricky part) then they're smart enough to make their own game code
you asked if you could ask a question
I really need to get thoughts straight ||or gay||
didn't tell me much for some reason
at 9am? okay
thanks for being of this much help
not my timezone lol, different hour for me