How to pass an item from player 1 to player 2 when they collide?

I would create an actor tag for the pickup and use the begin on overlap/ end overlap event to do a collision test against an actor with the “pickup” tag.

When the item is picked up set a boolean for “hasPossession?” for the player. Default this boolean to false for both players. When the item is picked up set the bool to true and attach and display the item accordingly. When it switches possession change the bool value for each player and destroy the original item and create a new item and attached it to the new player. Just keep switching at each change of possession.

You could even create a scoring system and increment the value of an int over time based on the boolean being true for a player. Create a custom event for each player called “Scoring”. Create an int variable called “CurrentScore”. Then use a branch and check the value of the possession bool we created above. If the value is true for the player create a timer and take CurrentScore + Int value and update the score value.

The trick is you are not actually physically transfering the item. It just looks like you are to the players.

Hello,

So at the moment I have an item that acts as a simple collectable in a 2D platform game. I also have 2 players. If any of the player touches the item, it collects it, granting some points.
I would like that when the second player collides (tags / catches) the first player, he steals the item. And vice-versa. So it all comes down to how do I test which of the players has the item at any point in time, and how do I transfer the item from one player to another when they collide?
Thank you!

Hey,

Thanks for the prompt answer! I have created a bool and set it to true if player 1 or player 2 picks the item, although I’m no sure if what I’ve done is even correct.

(I’m a real noob so please bear with me)

I’m not really sure what do you mean by “attach and display” the item accordingly.
Also, “when it switches possession” how do I know if the item switched owners? or even better said, how do I make the the computer know that that event took place? The item has a ‘pickUp’ tag at the moment.
And if P2 collides with P1 (‘takes’ the item), how do I switch the bool value? Attach the newly created item to the player?

I do have a Scoring system, fairly simple I should add, that ‘OnPickUp’ by any player it increases a score int (Points) by 10. Although the ‘set timer by function name’ does not work; I would like to + the int by 10 each 3 seconds whilst the item is picked up.
Sorry for the large amount of questions. Your help is greatly appreciated.