Tutorial / Tools > AI
NPC Relationships
Make NPCs friendly, hostile, neutral or afraid toward players, and save rules for this map.
What it does
NPC Relationships sets how NPCs feel about players. Pick an attitude, then click one NPC, every NPC in a radius, or one NPC toward you only.
The panel also keeps rules for the map. A rule says how one NPC type, or every NPC, feels toward players, admins, a job or another NPC type. Rules are put on NPCs when they spawn, when players join or change job, and when the rules change.
Classic NPCs only (Combine, zombies, citizens and so on). NextBots do not support relationships.
Where to find it
Q menu > KGX's Admin Toolbox > AI > NPC Relationships.
Admins can use it. Other players can use it only if they are given the tool in Settings > Player Access.
Given to a player (v3.6.11.3): Their own NPCs.
Controls
| Key | What it does |
|---|---|
| Left click | Apply the attitude to the NPC you aim at, toward every player |
| Right click | Apply the attitude to every NPC inside the area radius around the aimed spot |
| Reload | Apply the attitude to the aimed NPC toward you only |
Options
| Option | What it does | Default |
|---|---|---|
| Attitude | Friendly, Hostile, Neutral (ignore) or Afraid (run away) | Friendly |
| Area radius | Radius for right click (64-16384) | 1024 |
| Reset to defaults | Puts the two options above back |
Rules for this map
| Option | What it does |
|---|---|
| NPC type | Every NPC, or one NPC type from the spawn menu |
| Toward | Players, Admins, Job: <name> for each job, Job: Unemployed, or NPC: <type> |
| Attitude | Friendly (like), Hostile (attack), Neutral (ignore) or Afraid (run away) |
| Add rule | Adds the rule. A rule for the same NPC type and target replaces the old one. |
| Rules list | Columns NPC, Toward, Attitude. Right-click a rule for Remove rule. |
| Refresh (and job list) | Reloads the rules and the job names |
| Remove every rule | Removes all rules on this map after a confirmation |
How to use it
Calm down a hostile NPC
- Set Attitude to Friendly.
- Aim at the NPC and left click. It stops attacking players.
Turn a whole area hostile
- Set Attitude to Hostile and set Area radius.
- Aim at the middle of the area and right click. Every NPC in the radius now attacks players.
Make Combine soldiers side with the police job
- Under the rules, set NPC type to Combine Soldier.
- Set Toward to Job: Police and Attitude to Friendly (like).
- Click Add rule. Soldiers that exist now and soldiers that spawn later are friendly to players in that job.
Make zombies attack citizens
- Set NPC type to Zombie, Toward to NPC: Citizen, Attitude to Hostile (attack).
- Click Add rule.
Tips and limits
- Left and right click also cover players who join later.
- Click changes act on the NPCs that exist now. Only the rules list is saved for the map, in
data/kgx_admin_toolbox/ai_relations_<map>.json. - At most 100 rules per map.
- Rules are applied in order: Players first, then NPC types, then Admins and jobs. Admin and job rules win over player rules.
- Admins means toolbox admins.
- Player job and admin changes are checked every 3 seconds.
- A non-hostile attitude makes the NPC drop a player as its enemy.
- Right click is limited by
kgxat_cap_area_radius(default 512) for limited players. - Every change is written to the Action Log.