-- An NPC has spawned somewhere in game. This includes heroes
function GameMode:OnNPCSpawned(keys)
DebugPrint("[BAREBONES] NPC Spawned")
DebugPrintTable(keys)
local npc = EntIndexToHScript(keys.entindex)
if npc:IsRealHero() then
local team = GetTeamName(npc:GetTeamNumber())
local playerID = npc:GetPlayerOwner():GetPlayerID()
if team == 'DOTA_TEAM_BADGUYS' then
PlayerResource:ReplaceHeroWith(playerID, "npc_dota_hero_pudge", 0, 0)
end
end
end

Друзья CG

-- An NPC has spawned somewhere in game. This includes heroes
function GameMode:OnNPCSpawned(keys)
DebugPrint("[BAREBONES] NPC Spawned")
DebugPrintTable(keys)
local npc = EntIndexToHScript(keys.entindex)
if npc:IsRealHero() then
local team = GetTeamName(npc:GetTeamNumber())
local playerID = npc:GetPlayerOwner():GetPlayerID()
if team == 'DOTA_TEAM_BADGUYS' then
PlayerResource:ReplaceHeroWith(playerID, "npc_dota_hero_pudge", 0, 0)
end
end
end

local npc = EntIndexToHScript(keys.entindex)
if npc:IsRealHero() then
local npc = player
local player = PlayerResource:GetPlayer(keys.PlayerID)
if player:GetTeam() == DOTA_TEAM_BADGUYS then
PlayerResource:ReplaceHeroWith(playerID, "npc_dota_hero_pudge", 0, 0)
end
end

local npc = EntIndexToHScript(keys.entindex)
if npc:IsHero() then
if npc:GetTeamNumber() == DOTA_TEAM_BADGUYS then
GameRules:GetGameModeEntity():SetContextThink("ReplaceHeroThink", function()
npc = PlayerResource:ReplaceHeroWith(npc:GetPlayerID(), "npc_dota_hero_pudge", 0, 0)
end, 0)
end
end
end