#Any suggestions for pulling specific players towards each other?

1 messages · Page 1 of 1 (latest)

fading zinc
#

I'm trying to make a datapack that mimics the game Chained Together, but I'm running into a few hurdles.

My current idea is to have a /link command that applies matching/mirrored tags to two players. I want players to be able to have multiple partners as well. Then on every tick I want to pull each pair of players together, with the strength of the pull being stronger the further they are from each other. For the pulling I found the player motion library (https://modrinth.com/datapack/player_motion) which seems to fit my use case pretty well. I don't really care too much about there being visible chains or ropes between players, but if possible I would like to maybe add this at the end.

I got my /link and /unlink commands to work properly; they basically just add player 1's name as a tag on player 2 and vice versa. The problem I'm trying to solve now is figuring out how I can select a pair to then apply the pull effect. I was initially thinking about something along the lines of
execute as @a run function pullfunction {tag:NAME} where pullfunction would pull all players with the tag NAME towards the executor, but I can't find a way to actually get the proper tag into the command since it's not static. I've tried using player names as tags, as well as ids stored in the scoreboard as tags, but both have the same issue. I'm not really sure how I can either solve or circumvent this issue.

I also wanted to see if my logic for the pulling part is sound. I was thinking of using the positions of player1 and player2 to obtain a vector from player2 to player1, scaling it by some factor, and then adding the resulting vector to player2's velocity using the player motion library. Then repeat for all pairs of linked players. I assume that I would have to store the intermediate calculations in the scoreboard somehow, but there might be a better method.

I'm a beginner at making datapacks so I'm not really sure if this is a feasible idea in general. Any help is appreciated, thanks!

sudden otterBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1743679819:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

misty shore
#

For visuals, you could have two leashed mobs that are continuously teleported to each player, maybe armor stands with Marker:1b

#

As for the scoreboards and vectors, you can create a singular motion scoreboard and add fake players to it as variables

#

And for individual co-ordinates of players, you can get those using data get entity <selector> Pos[0 for x, 1 for y, 2 for z]

#

Just make sure to scale them up, since scoreboards can only store integers

sudden otterBOT
#
Question Closed

Your question, #1357308728465948754 (Any suggestions for pulling specific players towards each other?), was resolved!

Original Message

#1357308728465948754 message

Duration open

11h2m

fading zinc
#

Thanks, I'll try those suggestions out

sudden otterBOT
#
Question Closed

Your question, #1357308728465948754 (Any suggestions for pulling specific players towards each other?), was resolved!

Original Message

#1357308728465948754 message

Duration open

11h3m

sudden otterBOT
#
Closed for inactivity

This question has been inactive for some time, so it's going to be closed for inactivity. If you still need it, please disregard this message.