Skip to content

Commit 1bb74a4

Browse files
Documentation Updates (#584)
* Updating the Beginners Guide New images all around. Also made lot's of changes to the layout and phrasing. Added a short section about themes as well. * Update saving tutorial * Update Create Custom Events tut Changed it so the automated way is the only one described now. Also deleted unused images. * Add a updating guide for 1.3 * Updating the updating tutorial * making some edits to the documentation Co-authored-by: Emilio Coppola <[email protected]>
1 parent 40f81c2 commit 1bb74a4

32 files changed

+222
-268
lines changed

addons/dialogic/Documentation/Content/Events/Custom Events/CreateCustomEvents.md

+39-49
Original file line numberDiff line numberDiff line change
@@ -27,81 +27,76 @@ All of the files that are used for creating a custom Event Block and Handling Sc
2727
# Making your first custom event in 6 steps
2828
Let's now create a simple event that will print some text to the Output panel in Godot.
2929

30-
### You can avoid the manual copy-pasting part. Go to Dialogic's settings and use the Custom events section [new] button to create and rename an event for you. Make sure to read the guide so you know what is happening in the process.
30+
## Create the event
31+
Go to the `settings page` and in the `custom events section` hit the `New` button.
32+
Fill in a name for your event, a folder name and an id. For the id's I recommend using your name or a string unique to you followed by a number.
33+
**The id has to be different for every event!!!**
34+
This is why I recommend the unique string, because it will enable you to share the event with others without breaking their games.
35+
![Creating](./Images/CreationProcess.PNG)
3136

32-
## 1. Create the folder
33-
First you should create a new folder in `res://dialogic/custom-events` and give it a name that is descriptive and unique.
37+
When you are ready, hit `Create`. You will see the folder appear in the `FileSystem` under `res://dialogic/custom-events/`.
3438

35-
For this print event let's call it `print-event`.
39+
If you go to the `timeline editor` now, you should already be able to see your event in the event list.
3640

41+
### What happened
42+
This little menu already created a number of things for you:
43+
- The `EventBlock` (EventBlock.tscn)
44+
- An example `EventPart` (EventPart_Example.gd/.tscn)
45+
- The `event handling script` (event_+EVENTID+.gd)
46+
- A `stylebox` for your event (Stylebox.tres)
3747

38-
## 2. The folders content
39-
Now you should go to `res://addons/dialogic/Example Assets/CustomEvents` and copy all the files from there and paste them into your new folder (In this case: `res://dialogic/custom-events/print-event`)
4048

4149

42-
## 3. The EventBlock (EventBlock.tscn)
43-
This is a scene that inherits `res://addongs/dialogic/Editor/Events/Templates/EventTemplate.tscn`.
44-
When you open the scene you can see that all except the root node are grayed out.
50+
## What next
51+
The automatic process already setup a lot. But it didn't know the purpose of our event.
52+
So we will have to add that.
4553

46-
**IMPORTANT!!! This file needs to be named `EventBlock.tscn`!!! DO NOT RENAME**
54+
### | Adding the data
55+
First we want to open the `EventBlock.tscn` scene. (Do not rename this scene!)
4756

48-
### Setting the EventBlock values
49-
Now select the the root node of that scene. In the inspector you will see a couple of variables to set.
57+
Select its root node and look at it's exported variables in the inspector.
5058

51-
#### EventName and icon
52-
For now let's set the `Event Name`. I will set mine to `Print Event`.
59+
We will need to add all the data, that our event can have to the `event_data`.
60+
You can see, that it alread contains your event id. This needs to be there, do not delete it!
5361

54-
#### The Event Data
55-
Next you also need to think about the data that your event should save/handle.
62+
I want to be able to set a text that will be printed, when my event is activated, so I'll add an information slot for that:
63+
![EventData](./Images/EventBlock_EventData.PNG)
5664

57-
As said before it has to contain an `event_id`. These ids mostly consist of your "name" and a number. My event_id will be `rabloe_000`.
58-
*We decided to move away from the actual names so that renaming wouldn't cause lots of rework.*
59-
*Make sure your "name" is as unique as possible, so you can share custom events with others without trouble.*
65+
### | Icon and Stylebox
66+
You can also change your events icon in the inspector. Just drag an image into the `Event Icon`.
6067

61-
For the rest of the data I just want to store a string to print. Create the default data as a dictionary in the `event_data` in the inspector.
68+
Below that, you can open the Stylebox and change its background color, to give your event a unique look.
6269

63-
#### Style and Icon
64-
Now there is also already a stylebox. You can edit it (mainly the background color) to give it a unique style.
65-
You can also select an icon for your event. The default Dialogic icon size and format is: 22x22 `svg`. You can find the icons used for the built-in events here: `res://addons/dialogic/Images/Event Icons/Main Icons`
6670

6771

68-
69-
## 4. The Event Blocks Content (EventParts)
72+
### | The Event Blocks Content (EventParts)
7073
Right now your event block will be empty so let's change that (if you want to).
7174

7275
The content of an EventBlock is separated as `EventParts`. This allows for some reuse.
7376
There are two places EventParts can be in an EventBlock: The Header (always visible) and the Body (can be hidden).
74-
*EventParts can also contain other EventParts, but it wont be necessary for most custom events.*
7577

76-
*An EventBlock does not have to have a body nor a header EventPart.*
78+
*An EventBlock does not have to have a body nor a header EventPart. For example the End Branch event has none.*
7779

7880
There is already a simple example `EventPart` (Script and Scene) included. You can change it as much as you want.
7981

80-
### Loading the data
81-
In `load_data()` you will need to set the values of your control nodes.
82+
#### | Loading the data
83+
In `load_data()` you will need to set the values of your control nodes. This function is called when the event is added to the timeline editor.
8284

83-
### Saving changes to the data
85+
#### | Saving changes to the data
8486
When the values get changed (listen to it via signals) set the according value in the `event_data` dictionary and call `data_changed()`.
8587

8688
This is pretty much all you need to know.
8789
*If you want to find more examples you can go to `res://addons/dialogic/Editor/Events/Parts/` and look at the EventParts that shape Dialogic's default blocks.*
8890

89-
### Using the EventPart
91+
### | Using the EventPart
9092
Once you finished everything in your EventPart(s) you need to go into the `EventBlock` scene and set the `header`/`body` variable in the inspector to the new scene(s).
9193

92-
Here is how the EventBlock's settings look for me now:
93-
![EventPartAdded](./Images/EventBlockSettingsFilled.PNG)
94-
9594

9695

97-
## 5. The event handler script (event_yourname_000.gd)
96+
### | The event handler script (event_yourname_000.gd)
9897
Once you have your `EventBlock` finished, you need to add the event handling logic.
9998

100-
### The correct name
101-
Dialogic will search your handler script following the format `event_` + your event id.
102-
So in our case, since the `event_id` is `rabloe_000` the handler scripts needs to be called **exactly** `event_rabloe_000.gd`
103-
104-
### The handle_event() function
99+
#### | The handle_event() function
105100
If you open the script you will see, that there is only one function by default, the `handle_event()` function.
106101

107102
It comes with two usefull pieces of information: the `event_data` and a reference to the `dialog_node`.
@@ -112,21 +107,16 @@ there. But of course you can do a lot more.
112107

113108

114109
Some more stuff is already explained in the script:
115-
#### Continue
110+
##### Continue
116111
Use `dialog_node.load_next_event()` to continue with the next event.
117112

118-
#### Waiting
113+
##### Waiting
119114
If you don't want the player to interrupt your event, set `dialog_node.waiting` to `true` while your event is handled.
120115
Don't forget to set it back to `false`.
121116

122117

123118

124-
## 6. Using your event
125-
You are as good as done. Just enable custom events in dialogics settings menu.
126-
Then go into a timeline. Scroll down to the custom events section. There it should be, otherwise you should hit the refresh button.
127-
128-
*Go ahead and try it out!*
129-
130-
119+
## And done!
120+
Great, you've created your first custom event for dialogic.
131121

132122
*Make sure to check Emilio's Discord server just in case someone has already created the custom event that you need. They are super easy to [import](./ImportCustomEvents.md)!*
Loading
Loading

0 commit comments

Comments
 (0)