Dialog¶
NPCs use the game's own dialog window. Point dialog_id in the NPC's npc_info at any dialog in dialogs.xml.
NPC Utilities adds one action type and one requirement type, both called DSDNpc. Vanilla actions and requirements
(AddItem, AddBuff, AddQuest, CVar checks...) work in the same dialogs.
Ready-made: dsdNpcCompanion¶
Hire, orders (follow / stay / guard), gear (give weapon, give ammo, take weapon back) and dismiss, each option shown only when it applies. Use it as is, or copy it as a starting point.
Actions¶
<action type="DSDNpc, DSD_NPCUtilities" id="..."/> on a response.
Keep the , DSD_NPCUtilities part on every type: the game only finds dialog classes in other mods when the type
names the mod's DLL. Without it, dialogs.xml fails to load with "No action class 'DSDNpc found!".
| id | Does |
|---|---|
hire |
Takes the NPC's price in Dukes and hires them. Refunded if the server refuses. |
dismiss |
Ends the job. Weapon and ammo go back to the player. |
follow / stay / guard / wander |
Orders. |
give_weapon |
Hands over the item the player holds (melee or gun). |
give_ammo |
Hands over ammo for the NPC's gun, up to 300. |
take_weapon |
Gives back the NPC's weapon and remaining ammo. |
Requirements¶
<requirement type="DSDNpc, DSD_NPCUtilities" id="..." requirementtype="Hide"/>
| id | value | True when |
|---|---|---|
hired_mine |
The NPC works for this player. | |
not_hired |
Nobody has hired the NPC. | |
hireable |
Not hired and has a price. | |
can_hire |
Hireable, and the player has the Dukes, the standing and a free follower slot. | |
has_weapon |
The NPC carries a weapon someone gave it. | |
ranged |
That weapon is a gun. | |
rep_at_least |
600 |
The player's standing with the NPC's faction is at least the value. |
Example: a mercenary with a secret¶
<configs>
<append xpath="/dialogs">
<dialog id="myMercDialog" startstatementid="start">
<statement id="start" text="myMerc_hello">
<response_entry id="hire"/>
<response_entry id="cant"/>
<response_entry id="orders"/>
<response_entry id="secret"/>
<response_entry id="bye"/>
</statement>
<statement id="orders" text="myMerc_orders">
<response_entry id="follow"/>
<response_entry id="guard"/>
<response_entry id="back"/>
</statement>
<statement id="secret_text" text="myMerc_secret" nextstatementid="start"/>
<response id="hire" text="myMerc_hire">
<requirement type="DSDNpc, DSD_NPCUtilities" id="can_hire" requirementtype="Hide"/>
<action type="DSDNpc, DSD_NPCUtilities" id="hire"/>
</response>
<response id="cant" text="myMerc_cant" nextstatementid="start">
<requirement type="DSDNpc, DSD_NPCUtilities" id="hireable" requirementtype="Hide"/>
</response>
<response id="orders" text="myMerc_ordersAsk" nextstatementid="orders">
<requirement type="DSDNpc, DSD_NPCUtilities" id="hired_mine" requirementtype="Hide"/>
</response>
<response id="follow" text="myMerc_follow"><action type="DSDNpc, DSD_NPCUtilities" id="follow"/></response>
<response id="guard" text="myMerc_guard"><action type="DSDNpc, DSD_NPCUtilities" id="guard"/></response>
<response id="secret" text="myMerc_ask" nextstatementid="secret_text">
<requirement type="DSDNpc, DSD_NPCUtilities" id="rep_at_least" value="800" requirementtype="Hide"/>
</response>
<response id="back" text="myMerc_back" nextstatementid="start"/>
<response id="bye" text="myMerc_bye"/>
</dialog>
</append>
</configs>
Every text is a Localization key:
Key,File,Type,UsedInMainMenu,NoTranslate,english
myMerc_hello,dialogs,Dialog,,,"You look like you need a gun hand."
myMerc_hire,dialogs,Dialog,,,"You're hired. (5,000 Dukes)"
myMerc_cant,dialogs,Dialog,,,"What would it take to hire you?"
myMerc_ask,dialogs,Dialog,,,"You said you knew something."
myMerc_secret,dialogs,Dialog,,,"There's a cache under the water tower. Don't tell anyone."
Note
Actions run on the talking player's machine and the server checks every request again, so a player can't hire without paying or give orders to someone else's NPC.