|
1 | 1 | --- |
2 | 2 | description: | |
3 | | - Register an Action |
| 3 | + Register a Character |
4 | 4 | --- |
5 | 5 |
|
6 | | -TODO |
| 6 | +As the name suggests, Characters are resources in Parley used to define |
| 7 | +characters within a Dialogue Sequence. |
7 | 8 |
|
8 | | -Actions are resources in Parley used to: TODO. |
| 9 | +Characters are stored in a Character Store which can be configured in the Parley |
| 10 | +settings. |
9 | 11 |
|
10 | | -<!-- For example, one might want to display different dialogue |
11 | | -depending on whether Alice gave a coffee or not. |
12 | | -
|
13 | | -Facts are stored in a fact store which can be configured in the Parley settings. |
14 | | -
|
15 | | -In this guide, we will create a fact that can be used to create a Condition Node |
16 | | -in the corresponding |
17 | | -[create a Condition Node guide](./create-condition-node.md). |
| 12 | +In this guide, we will create a character that can be used to create |
| 13 | +[Dialogue](../nodes/dialogue-node.md) and |
| 14 | +[Dialogue Option](../nodes/dialogue-option-node.md) nodes. |
18 | 15 |
|
19 | 16 | ## Pre-requisites |
20 | 17 |
|
21 | 18 | - Ensure you have familiarised yourself with the |
22 | | - [Condition Node](../nodes/condition-node.md) docs. |
| 19 | + [Character Node](../nodes/character.md) docs. |
23 | 20 | - Parley is [installed](./installation.md) and running in your Godot Editor. |
24 | 21 | - You have created a basic Dialogue Sequence before. Consult the |
25 | | - [getting started guide](./create-dialogue-sequence.md) for more info. --> |
26 | | - |
27 | | -<!-- TODO: update when Parley supports creation of Fact --> |
28 | | - |
29 | | -<!-- ## Instructions |
30 | | -
|
31 | | -> **Note:** it is assumed that the default Parley settings are used for the fact |
32 | | -> store and it is stored at: `res://facts/fact_store_main.tres` |
33 | | -
|
34 | | -- Create a Fact script (ensure that it extends the `FactInterface` class) at: |
35 | | - `res://facts/alice_gave_coffee_fact.gd` |
36 | | -
|
37 | | -```gdscript |
38 | | -extends FactInterface |
39 | | -
|
40 | | -func execute(_ctx: Dictionary, _values: Array) -> bool: |
41 | | - print('Alice did indeed give coffee') |
42 | | - # Note, you can return any value here, it doesn't |
43 | | - # necessarily have to be a bool |
44 | | - return true |
45 | | -``` |
46 | | -
|
47 | | -- [OPTIONAL] If the return type of your fact, is **not** of type `bool`, it is |
48 | | - recommended to return well-known values of the fact (for example, when using a |
49 | | - [Match Node](../nodes/match-node.md)). For example: |
50 | | -
|
51 | | -```gdscript |
52 | | -extends FactInterface |
53 | | -
|
54 | | -enum Ball { |
55 | | - RED = 1, |
56 | | - YELLOW = 2, |
57 | | - PINK = 6, |
58 | | - BLUE = 5, |
59 | | -} |
60 | | -
|
61 | | -func execute(ctx: Dictionary, _values: Array) -> int: |
62 | | - return ctx.get('ball', 0) |
63 | | -
|
64 | | -func available_values() -> Array[Ball]: |
65 | | - return [ |
66 | | - Ball.RED, |
67 | | - Ball.YELLOW, |
68 | | - Ball.PINK, |
69 | | - Ball.BLUE, |
70 | | - ] |
71 | | -``` |
72 | | -
|
73 | | -- Open up the inspector for `res://facts/fact_store_main.tres` in the Godot |
74 | | - Editor and click `Add Element`: |
75 | | -
|
76 | | - |
77 | | -
|
78 | | -- Then, click the empty element and choose `New Fact`: |
79 | | -
|
80 | | - |
81 | | -
|
82 | | -- Now populate the fact ID by using the same element ID (recommended but not |
83 | | - essential) and choose a sensible name for the Fact in the store: |
84 | | -
|
85 | | - |
86 | | -
|
87 | | -- Then, drag the fact script created earlier to the `<empty>` ref field: |
88 | | -
|
89 | | - |
90 | | -
|
91 | | -<!-- TODO: change/remove this when supported Parley --> |
92 | | - |
93 | | -<!-- - Finally, reload the Godot project and the new fact should be available to use |
94 | | - in Parley! |
95 | | -
|
96 | | - --> |
| 22 | + [getting started guide](./create-dialogue-sequence.md) for more info. |
| 23 | + |
| 24 | +## Instructions |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +> [info]: it is assumed that the default Parley settings are used for the |
| 29 | +> character store and it is stored at: |
| 30 | +> `res://characters/character_store_main.tres`. You can find more information on |
| 31 | +> changing the default Parley settings [here](../reference/parley-settings.md). |
| 32 | +
|
| 33 | +1. Open up the `ParleyStores` dock in the Godot Editor and open the `Character` |
| 34 | + tab. |
| 35 | +2. Click `Add Character`. |
| 36 | +3. Give your new character an ID. In our example, we use: `frankie`. |
| 37 | +4. Give your new character a name. In our example, we use: `Frankie`. |
| 38 | + |
| 39 | +> [tip]: You can use the resource editors in `ParleyStores` to quickly navigate |
| 40 | +> to the relevant resource for editing. You can also add resources using the |
| 41 | +> resource editor dropdown field instead of dragging. |
| 42 | +
|
| 43 | +5. You should now see that the Character is available in the Dialogue node |
| 44 | + dropdown options for the associated character. Select `Frankie` in the |
| 45 | + options to associate it with the selected Dialogue Node. |
| 46 | +6. Test out your new Character within the Dialogue Sequence by clicking the Test |
| 47 | + Dialogue Sequence from start button. |
| 48 | + |
| 49 | +> [tip]: You may want to define a custom character rather than using the Parley |
| 50 | +> Character so you can add custom attributes. ATM, Parley does not support |
| 51 | +> adding this via the `ParleyStores` editor but you can do by adding to the raw |
| 52 | +> character store resource in the Godot editor. When doing this, it is **vital** |
| 53 | +> to ensure that you include `@tool` at the top of the your custom character |
| 54 | +> definition. |
0 commit comments