I'm trying to make it so when a unit is built, a different player (a team mate in this case) gets to control that unit instead. From what I understand I need to first create a new unit, then convert the old one into it. But I can't seem to understand how InitUnit works. The line that is giving me problems is this:
EDIT: Solved it, there were a few parameters that I couldn't get directly from SerialEventUnitCreated unlike what I assumed. This is what worked:
EDIT: Solved it, there were a few parameters that I couldn't get directly from SerialEventUnitCreated unlike what I assumed. This is what worked:
local pUnit = Players[pPlayer]:GetUnitByID(pUnitID)
local pPlot = pUnit:GetPlot();
local pType = pUnit:GetUnitType();
pNew = pFinal:InitUnit(pType, pPlot:GetX(), pPlot:GetY());
Last edited: