gmod-replace-hostile-npc/lua/autorun/hostile_npcs_tocitizen.lua
2025-08-04 21:07:13 +07:00

32 lines
1.0 KiB
Lua

local npcs = list.Get("NPC")
local citizenEnemy = npcs["npc_citizen_rebel_enemy"]
local originalListSet = list.Set
function list.Set(listType, class, npc)
if listType == "NPC" then
if npc["Class"] == "npc_combine_s" and npc["Category"] ~= "#spawnmenu.category.combine" then
npc["Class"] = citizenEnemy["Class"]
npc["KeyValues"] = {
Hostile = 1,
SquadName = "overwatch",
citizentype = 4
}
end
end
originalListSet(listType, class, npc)
end
-- Second stage. idk if one of these necessary
timer.Simple(0, function ()
for class, npc in pairs(npcs) do
if npc["Class"] == "npc_combine_s" and npc["Category"] ~= "#spawnmenu.category.combine" then
npc["Class"] = citizenEnemy["Class"]
npc["KeyValues"] = {
Hostile = 1,
SquadName = "overwatch",
citizentype = 4
}
originalListSet("NPC", class, npc)
end
end
end)