For the first question, I use a handy function that makes my npcs love me and my allies, but hate everyone else.
[lua]local function MakeFriendly(ply,npc)
for ,v in ipairs(ents.FindByClass("npc*")) do if v:Disposition(ply) == 3 then
else npc:AddEntityRelationship(v,1,99) end
And you can modify that however you want.
For the second question, you would just make a button entity with the ENT:Use() function doing NPC:SetHealth().
For the money system, it depends on how you want to do it. For most money systems, people use networked integers; i.e. player:SetNWInt(“Cash”,1000)
Then to check whether someone could buy something it would be:
if ply:GetNWInt(“Cash”) < amt then return false
else return true
And one last thing: if you want the NPCs to attack a specific point or NPC (if they’re combine or rebel), use npc:Fire(“Assault”,“point of interest”,0).
For example, I have a function that makes an npc assault the enemy they’re already attacking after a given amount of time:
[lua]local function DoAssault(time)
if npc:IsValid() and npc:GetEnemy() then
However, using Assault effectively requires NPCs be in the same squad. To do this, you use npc:SetKeyValue(“squadname”,“combinesquad”) or “rebelsquad” or whatever you want.
For more info on the inputs/outputs of combine/rebel NPCs, refer here:
npc_combine_s is the combine guard, soldier, and super soldier (use npc_metropolice for the metrocops).
npc_citizen is pretty much every human NPC except the special characters (alyx, kleiner, barney, etc).