Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.

In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.

All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

[Bug] PlayerResource:SetCustomTeamAssignment() and custom teams

  • Filter
  • Time
  • Show
Clear All
new posts

  • pie4all88
    I'd like to mention that the above code works if placed into InitGameMode(), but that also allows players to join any custom team at the beginning of the game.

    I'm trying to limit players to joining Radiant or Dire, but still be able to move them to another team while in-game. If I run that SetCustomGameTeamMaxPlayers() loop after the first player picks their hero, it seems to work but I get the following console error when I switch someone's team:

    !! (s2r://panorama/scripts/custom_game/team_select.vjs_c, line:156, col:17) - TypeError: Cannot read property 'GetChildCount' of null

    Leave a comment:

  • ToraxXx
    This happens due to the custom teams not having their max players set. Doing so will make it work.

    for team = 0, (DOTA_TEAM_COUNT-1) do
        GameRules:SetCustomGameTeamMaxPlayers(team, 10)

    Leave a comment:

  • ToraxXx
    I experience the same bug. Also the event "player_team" does not get triggered when assigning one of the custom teams (it does work when assigning GoodGuys / BadGuys though).

    Leave a comment:

  • pie4all88
    Similarly, PlayerResource:GetNthPlayerIDOnTeam(i, 1) returns -1 (meaning there are no player IDs on that team) even after I run PlayerResource:SetCustomTeamAssignment(target_pid, i). PlayerResource:GetPlayerCountForTeam(i) also returns 0.

    This indicates to me that PlayerResource:SetCustomTeamAssignment() is not changing the team associated with the player's ID.

    Leave a comment:

  • [Bug] PlayerResource:SetCustomTeamAssignment() and custom teams

    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):
    PlayerResource:SetCustomTeamAssignment(target_pid, i)
    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:

    	"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"
    		"MaxPlayers"	"10"
    Last edited by pie4all88; 06-19-2015, 02:08 AM.