I'm attempting to change a player's team using PlayerResource:SetCustomTeamAssignment(), and then their hero's team using target:SetTeam().
The following code worked in the Workshop Tools Alpha, where the variable "i" corresponds with the first unoccupied team between DOTA_TEAM_CUSTOM_1 and DOTA_TEAM_CUSTOM_8 (ints 6-13):
However, now when this code is called, the player whose team was changed does not get his team vision updated, but loses sight of his hero since it is now on a new team. In other words, he still receives vision from every unit that was on his original team, and does not receive vision from anything on his new team.
Changing a player's team to a non-custom team seems to work fine. PlayerResource:SetCustomTeamAssignment(target_pid, 3) sets the unit's team to Dire, and this correctly changes the player's vision to match their new status of being on Dire's team. This makes me think there is a bug with SetCustomTeamAssignment() itself, not with my code. Someone on IRC mentioned Game.PlayerJoinTeam( teamId ); in Javascript; maybe SetCustomTeamAssignment() should interact with this new function behind the scenes.
I've tried playing with PlayerResource:ReplaceHeroWith() and PlayerResource:UpdateTeamSlot(), but neither of these seemed to help.
In the past, errors with vision when changing a unit's team have been related to "TeamCount" in addoninfo.txt, so I've copied my current addoninfo.txt below:
The following code worked in the Workshop Tools Alpha, where the variable "i" corresponds with the first unoccupied team between DOTA_TEAM_CUSTOM_1 and DOTA_TEAM_CUSTOM_8 (ints 6-13):
Code:
PlayerResource:SetCustomTeamAssignment(target_pid, i) keys.target:SetTeam(i)
Changing a player's team to a non-custom team seems to work fine. PlayerResource:SetCustomTeamAssignment(target_pid, 3) sets the unit's team to Dire, and this correctly changes the player's vision to match their new status of being on Dire's team. This makes me think there is a bug with SetCustomTeamAssignment() itself, not with my code. Someone on IRC mentioned Game.PlayerJoinTeam( teamId ); in Javascript; maybe SetCustomTeamAssignment() should interact with this new function behind the scenes.
I've tried playing with PlayerResource:ReplaceHeroWith() and PlayerResource:UpdateTeamSlot(), but neither of these seemed to help.
In the past, errors with vision when changing a unit's team have been related to "TeamCount" in addoninfo.txt, so I've copied my current addoninfo.txt below:
Code:
"AddonInfo" { "addontitle" "Retro Dota" "addonversion" "1.00" "addontagline" "Retro Dota" "addonDescription" "Play as 27-Spell Invoker and Gambler!" "TeamCount" "10" "maps" "retrodota_arena_skirmish_map" "IsPlayable" "1" "retrodota_arena_skirmish_map" { "MaxPlayers" "10" } }
Comment