Simple Mod "Cho'gall Simulator"

Hi,

I have never made a game mod before but I think this one would be pretty simple. I often play 2-player multiplayer with my friend and I would like to make it so that I attach to my friend just like in Heroes of the Storm, playing as Cho’gall. The idea is that my friend would control the character and play soldier etc., but I would just move with him and play arcanist, and all damage would be redirected to him and I would cast spells from him as a turret. I think I could script this in with Lua as a simple potion I would drink. I am not certain how to do this in Lua with the game’s pre-defined code, so I am wondering if anyone could help me with this part.

The mod would have the exact following attributes:

  1. I drink a consumable which triggers the following attributes:
  • Player 2 is invincible
  • The while loop which is triggered by the consumable would check Player 2’s health, and thus be constantly in effect until a second potion is used which ends the while loop.
  • Player 1’s world location is found every .1 seconds or every .01 seconds, as fast as the game reasonably allows
  • Player 2’s world location is set to be exactly Player 1’s location every time the while loop iterates
  • Since Player 2 is invincible during the potion’s effect, the while loop never ends.
  1. There’s a second consumable Player 2 could drink to “detach” from Player 1 which ends the while loop and cease vulnerability. I would imagine we’d have to do that every time Player 1 wants to move to a new dungeon or teleport to another part of the game world.

Eventually it would be cool to modify skills which only affect Player 2, which could be modified to affect Player 1, but I think that’s further down the road. I would just like to get these attributes working. Can anyone help? I tried ChatGPT but there is no way to verify which lines of code are real and which have completely nonsense functions which don’t exist.