Compare commits
3 Commits
1.0.0
...
work/onspa
| Author | SHA1 | Date | |
|---|---|---|---|
| 32966fac0e | |||
| 6333f2390b | |||
| a3cd160929 |
@@ -16,8 +16,12 @@ If you want your enemies to be more human, this mod will change all hostile NPC
|
|||||||
- Change the behavior of custom models NPCs from combine to citizen
|
- Change the behavior of custom models NPCs from combine to citizen
|
||||||
- Allows hostile to attack with melee weapons
|
- Allows hostile to attack with melee weapons
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
I'll make VJ version if i can
|
I'll make VJ version if i can
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
models used:
|
||||||
|
- Lenna https://steamcommunity.com/sharedfiles/filedetails/?id=3167885628
|
||||||
|
- Tomoko https://steamcommunity.com/sharedfiles/filedetails/?id=3133369749
|
||||||
|
|
||||||
Note: i couldn't find a mod similar to the one i made, so i don't know who made it first.
|
Note: i couldn't find a mod similar to the one i made, so i don't know who made it first.
|
||||||
@@ -1,17 +1,61 @@
|
|||||||
local npcs = list.Get("NPC")
|
local npcs = list.Get("NPC")
|
||||||
local citizenEnemy = npcs["npc_citizen_rebel_enemy"]
|
local citizenEnemy = npcs["npc_citizen_rebel_enemy"]
|
||||||
|
local originalListSet = list.Set
|
||||||
|
|
||||||
if citizenEnemy then
|
function list.Set(listType, class, npc)
|
||||||
for class, npc in pairs(npcs) do
|
if listType == "NPC" then
|
||||||
if npc["Class"] == "npc_combine_s" and npc["Category"] ~= "#spawnmenu.category.combine" then
|
if npc["Class"] == "npc_combine_s" and npc["Category"] ~= "#spawnmenu.category.combine" then
|
||||||
npc["Class"] = citizenEnemy["Class"]
|
if !npc["KeyValues"] then
|
||||||
npc["KeyValues"] = {
|
npc["KeyValues"] = {}
|
||||||
Hostile = 1,
|
end
|
||||||
SquadName = "overwatch",
|
npc["KeyValues"]["SquadName"] = "m_EnemyRebel"
|
||||||
citizentype = 4
|
end
|
||||||
}
|
end
|
||||||
|
originalListSet(listType, class, npc)
|
||||||
|
end
|
||||||
|
|
||||||
list.Set("NPC", class, npc)
|
hook.Add("OnEntityCreated", "ForceReplaceCombine", function(ent)
|
||||||
|
timer.Simple(0, function()
|
||||||
|
if !SERVER then return end
|
||||||
|
if not IsValid(ent) then return end
|
||||||
|
|
||||||
|
if ent:GetClass() == "npc_citizen" then
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ent:GetKeyValues()["squadname"] == "m_EnemyRebel" then
|
||||||
|
local pos = ent:GetPos()
|
||||||
|
local ang = ent:GetAngles()
|
||||||
|
local mdl = ent:GetModel()
|
||||||
|
local weps = ent:GetWeapons()
|
||||||
|
local health = ent:GetMaxHealth()
|
||||||
|
local keyValues = ent:GetKeyValues()
|
||||||
|
|
||||||
|
ent:Remove()
|
||||||
|
|
||||||
|
local npc = ents.Create("npc_citizen")
|
||||||
|
if not IsValid(npc) then return end
|
||||||
|
|
||||||
|
for key, value in pairs(keyValues) do
|
||||||
|
npc:SetKeyValue(key, tostring(value))
|
||||||
|
-- if value ~= "" then
|
||||||
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
npc:SetHealth(health)
|
||||||
|
npc:SetMaxHealth(health)
|
||||||
|
|
||||||
|
npc:SetKeyValue("hostile", 1)
|
||||||
|
npc:SetKeyValue("squadname", "overwatch")
|
||||||
|
npc:SetKeyValue("citizentype", 4)
|
||||||
|
|
||||||
|
for _, wep in ipairs(weps) do
|
||||||
|
npc:Give(wep:GetClass())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
npc:SetPos(pos)
|
||||||
|
npc:SetAngles(ang)
|
||||||
|
npc:SetModel(mdl)
|
||||||
|
npc:Spawn()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end)
|
||||||
Reference in New Issue
Block a user