Peer to Peer Chess Issue

Hi! So I’ll be straightforward. I’m making a chess game and have a problem. How can I communicate to the other screen that a piece was eaten and that it has to be deleted? The last thing I tried is getting the name of the piece (with GetObject(), and it worked), but because you can’t delete “Variable(BPD)” because it’s not an object per-se si it didn’t work and I’m stuck there. Do I have the right aproach here? Thanks in advance!

You’ll need to have a unique id on each playing piece. The id must be the same on both clients (this is easy if the playing pieces are set in the editor, where you can allocate ids as part of the object’s properties).

  • Put all the playing pieces into an object group.
  • Pass the id to the other client/screen.
  • Using the group name, search for the object with that id.

But I have 13 pieces in a set, 26 in total. I’d have to make 26 events sending or getting the ID, right?

No, one event sending the id.

Alright I’m sorry if I’m being annoying but I have a few questions;

  • How do you asign an ID through the editor? Is it an “instance variable”?
  • Do I have to make an ID for every piece (blacks and whites) or repeat the same one with the same piece in each set? (For example, the ID of a white piece is 10 and the same piece but black piece is also 10)
  • So it’s like this: If Ps collides with Ps (group of all pieces),
    then variable “PID” = Ps.GetObject() + Trigger event “PID” with extra data (Variable(“PID”)).
    And from there I’m stuck since I have the name but nothing else.

PS: I realized the problem lies in the fact that I can’t use the variable (with the name of the piece collided with) to get the ID. The variable is a string containing a name, I can’t get that name’s ID. Also screenshots of how “Eating” group and events works, in case needed (tell me if it needs or can use some improvement):

(“Score” group had “Add 1 to ___ variable” with the variable that was overwritten.

Ok so I got the ID of the piece and could send it to the other player, and finally understood, but I don’t know what’s wrong with my events, so I’m posting a screenshot of the final changes:

PS: I don’t know why the received events are in the “Score” group, but it should still work.

I would change this :




I think, but don’t quote me on it, the reason for the condition in the first screen snip not working is because the condition only returns true or false and doesn’t filter the list of Whites objects. Whereas the second screen snip filters the Whites objects.

The group the events are in won’t affect how they behave. It’s more a cosmetic thing and helps with debugging processor usage.

Thanks! It works perfectly! There were a few problems but I finally have the eating mechanism working.