Skip to content

Overview NPCs in context to Custom scripts

Borja Sotomayor edited this page May 15, 2021 · 3 revisions

All links to the design of the NPC documents are at the bottom of this document.

The NPC team as of now, plans to divide NPCs into three major categories.
1. Hostile
2. Friendly
3. Merchant

implementations being planned by the NPC team:
1. Give/take NPCs – For example- giving a random number of gold coins
2. Heal/Harm NPCs – Increasing/decreasing a players health
3. Corpse of NPC – to be dropped when the health <=0

NPC Module overview:

Planned struct for NPC

typedef struct npc {
UT_hash_handle hh;
char *npc_id;
int health;
dialogue_tree_hash_t *dialogues;
item_hash_t *inventory;
} npc_t;

npc_t functions
• npc_new
• npc_init
• npc_free
• get_health and change_health (borrow from player.h?)
• get_inventory (borrow from player.h?)

The three components that I think are particularly relevant to custom scripts are :-
1. Health – Using custom scripts to modify the health levels of an NPC. For eg:- Killing of an NPC by making health = 0, or resurrect a character back to life by making health > 0. There could also potentially be a modification of health levels, lets say from 3 to 5. However, for this we would have to check further with the teams as they proceed.

2. Dialogue – Use custom scripts to modify the dialogue. A basic example being saying “Hi” instead of “Hello”. The NPC team plans to implement this using something called Branching dialogue, where the NPC provides a player with a few options to choose from. Once a player chooses an option, the dialogue tree advances and the NPC generates an appropriate follow-up question. Details of this are in a link at the ends of this document. Essentially, custom-scripts in this case could be used to modify the list of options available to the player at a particular level of the dialogue tree.

3. Custom-scripts could be used to modify the inventory given by an NPC, such as the number of gold coins

Below are some helpful links from the NPC team that I have referenced from for this document

1. Contains an overview of the NPC planning from team NPC
https://github.com/uchicago-cs/chiventure/wiki/NPC-Design-and-Planning

2. Contains overview for the branching dialogue, in which a player chooses from various dialogue options available
https://docs.google.com/document/d/1Spzbc8UwZFTfwSKW1F6798EveGqcn-vX-kmCl5YR6pU/edit

3. Possible NPC designs
https://docs.google.com/document/d/1g5NAXelgCi4JqmNQ2aAC_t-eAh8PnLgcUzSfG42Qmo4/edit

Clone this wiki locally