How to spawn a buddy?
-
@iTap-Development Have you even figured out how to think conceptually?
-
@iTap-Development Or how to add links, or how to discuss sensibly, or how to explain yourself, or how to not act like a smug little runt?
-
@Deeeds š¤£š¤£š¤£
If you mean like open url........um, if I can use a location and weather api to make a weather app. Letās just say....what the heck? -
@Deeeds What sort of properties? Objects can always Get and Set properties of each other, and for detecting its collision, just have the buddy selected as the first collision target. Iām guessing you know how to select targets with behaviours that target objects?
-
@Aidan-Oxley I think you're missing the part that's problematic, for me.
I'm spawning the buddy.
Therefore I don't have a reference to him. So I can't get anything from him, or set anything on him, nor can he know who I am.
-
@Deeeds Ohhh I see. Ok there is a way to do this, but itās pretty ridiculous and shouldnāt have to happen. This is where dynamic object targeting would be awesome. The only way to do this at the moment is to either broadcast messages n stuff or put the buddy in a tag and have the spawned object collide with that tag and underneath the collision behaviour have all the stuff you want to do to the object. Either way itās not gonna be easy I think.
-
@Deeeds I used collisions in my 3D project, where points would collide with triangle faces once, and then run a timer on a get position behaviour that ran under the collided behaviour. It was pretty annoying and messy to get this to work, also I didnāt have dynamic broadcasts when I made that. But I think for your case it might be better to use broadcasts messages. Hereās how Iād do it:
I donāt know how many buddies youāre gonna have, but for simplicity Iām gonna say just 1.
Instead of the buddies spawner changing the properties, the buddy will change its own properties. Each property will be given its own broadcast/receive key.
When the main object wants to change a buddyās property, it simply broadcasts a certain message and includes in it the data of the new property you want (e.g, I want to change its mass to 5, broadcast key is say MASS, value is 5). The buddy then receives the message with key MASS, and changes itās own mass to the value given, 5.This can work too if there are more than 1 buddy. How easy it is to make depends on how many buddies there are.
-
@Aidan-Oxley Here's my "fix", that's not working.
Each buddy has a Channel_ID that he listens on. These are the numbers, 1 through 9.
Each "mate" of a buddy stores a variable with the Channel_ID of his buddy.
When "mate" wants to send a message to his buddy, he's using that variable... which holds his number for his buddy.
But, for some reason, this isn't working.
Is there a rule against broadcasting with an Event key that's the contents of a variable and as simple as the number 1, 2, 3, etc..
-
@Aidan-Oxley for buddy one just have it be āmass1ā for buddy two āmass2ā etc. just increase a number by 1 each time you spawn a new buddy and combine it to the āmassā key. then You can have unlimited buddies. Then @Deeeds wonāt be so lonely!
-
This post is deleted! -
@iTap-Development Each buddy has a receive message, and looks to his variable (which should be unique) to see what "channel" he should be listening on.
This variable is set when he's spawned.
That part works
Him listening on the variable channel doesn't work.
-
@Deeeds are you willing to give a project to look at?
-
@iTap-Development No, I'm deep into something, and simply need to know... can a receiver use a variable as the Event Key?
That is the part that's not working.
-
@Deeeds as far as I know, yes. Thatās why I suggested a project.
-
@iTap-Development Are you SURE it works? Have you ever done this?
Spawn and object. Let's call him Mate
Spawn an object to be Mate's Buddy
Mate sends a channelID to Buddy
Buddy sets that variable in his local storage.
Buddy's got a Receiver with an Event Key that's set to that locally stored variable.
Everything works except Buddy's receiver.
-
@iTap-Development @Aidan-Oxley I found the problem.
Buddy's Receiver is set by creating a copy of what's in the variable for itself, it's not a reference to the variable's contents (nor is looking contents via a pointer etc). So once it gets a value from the variable, it's got its own copy and isn't actually looking at the variable's contents to know what it's listening to.
In the initial Spawning, he's getting a null as the receiving channel because the variable hasn't yet been initialised.
And that never changes, even when the variable's value changes.
A very slight delay before activating the receiver forces it to set itself with that variable after the variable has been initialised with the value of the previously received ChannelID from his Mate.
This goes back to my other point, somewhere else, that I think broadcasting might be quite efficient, and that @hamed is setting up fast lookup tables for messaging and been a clever fella about how he's done messaging, even if nobody has bothered to describe how/why it works the way it does.
-
@Deeeds thatās why I suggested sharing a project! Glad you figured it out!
-
@iTap-Development How would that help to share a project for that?
This is why I asked you about conceptual thinking.
The question contains the problem.
-
@Deeeds because I could have looked at it and potentially found the problem, especially since Iāve built similar before.
-
@iTap-Development I'll say this once again:
The problem is CONCEPTUAL!
How does one do this kind of thing in this engine with its limited sense of relationships?
That is the question and the problem.
This is not about one specific effort, this is about understanding the limitations of this engine and its approaches to relationships.
Is it making sense what I'm asking, now?