Tutorial: Anatomy of an Event
In the SMC server, we had a team competition called SMC's Funniest Home Skits to write up some humorous dialog for an event. This is the detailed breakdown of the event script used in the competition!
The Script
This is the event script the trusty captains had to work with:
"03112022/w sunny": "50s/-1000 -1000/Sam 79 95 2 Penny 75 93 3/skippable/viewport 79 95 true/move Penny 3 0 2/textAboveHead Penny \"Dialog line 1.\"/pause 500/speak Sam \"Dialog line 2.\"/emote Penny 28/speak Penny \"Dialog line 3.\"/speak Sam \"Dialog line 4.\"/speak Penny \"Dialog line 5.\"/jump Sam 3/pause 800/viewport -1000 -1000/end"
Unique ID and preconditions
The very first part is the unique ID and preconditions.
The ID in this case is 03112022
, which Lenne cleverly chose as the date they wrote the event script. It's often recommended to make this based on your nexus mod page key, to try and ensure it will be unique.
The precondition in this case is w sunny
, meaning the weather has to be sunny. The event will not play if it is raining or storming (technically it will play if it's snowing, but that's a topic for another time).
Music, viewport, and initial character positions
The next 3 sections (50s/-1000 -1000/Sam 79 95 2 Penny 75 93 3
) are: the music playing during the event 50s
, the initial viewport -1000 -1000
, and the positions of the "actors" during this scene, Sam 79 95 2 Penny 75 93 3
. These have to go in this order: music, viewport, NPC and player positions.
You can peruse the music choices from the great ID spreadsheet.
In this case, the initial viewport is set to -1000 -1000
, but you can change it afterwards, and we do! These are the X and Y coordinates the camera will center around. By making the initial viewport -1000 -1000
, the screen will be black when the event first starts.
For the positions of the actors, the intent was to have them stand in their usual places on the Town bridge, so it was necessary to scope out the map and NPC schedules. Checking the NPC schedules required unpacking the game files. Since Penny moves in the script, it was necessary to figure out where she would start and end.
The positions are set up as NPCName X-position Y-position Direction
.
Directions are 0 for up, 1 for right, 2 for down, and 3 for left.
For the example, Sam 79 95 2 Penny 75 93 3
, Sam is on X tile 79, Y tile 95, facing down. Penny is on X tile 75, Y tile 93, facing left.
Skippable command
We've noted the event can be skipped with skippable
, which is an optional field you can add. It's helpful for repeat playthroughs, but if you set important things in your event like Conversation Topics (not covered in this event), you want to be careful where you put the skippable
command in your code.
Changing viewport
Next, as mentioned earlier, the viewport is changed with viewport 79 95 true
. The 79 95
are the new X and Y coordinates the camera will center around. We've set the last field as true
to indicate the viewport is "clamped".
Move command
The next command is move Penny 3 0 2
. This is formatted as move NPCName X-tiles Y-tiles Direction
. This is Penny walking on the X axis 3 tiles to the right, none in the Y axis, and ending facing down.
The intent behind having her start the event moving a few tiles before getting into position was to give it some flow, especially since the rest of the event is her and Sam standing talking.
The move
command is meant to be used with characters only moving in 1 direction at a time, i.e. either the X axis or the Y axis. If you wanted to take a risk and get fancy, you could look into advancedMove
, and be sure to check out the main wiki's page on event modding. It features an in depth explanation on advancedMove
from our very own Calcite!
Moving can be a challenge with determining how many tiles the character needs to move to get to the desired location, and ensuring they are facing the correct direction when they're done.
You may find yourself repeatedly checking the Directions part of the event modding wiki, and that is a-ok!
textAboveHead command
The next few commands are the dialog text! First, we have textAboveHead Penny \"Dialog line 1.\"
This is how we get the little speech bubble over Penny's head.
Note that the directions of the \
are different when writing dialog text. Be very careful to have those facing the correct direction and in the correct place.
Pause command
The next command is pause 500
. This is here to give the speech bubble time to appear and start to fade before Sam says his line. Adding pauses in key places in events helps keep the flow feeling natural and not too rushed!
First speak (dialog) command
Then we get into Sam's first line, speak Sam \"Dialog line 2.\"
. Again notice the direction and placement of the \
, like we did for the textAboveHead
command.
Emote command and some dialog
Following Sam's first line, we have emote Penny 28
. This is where Penny uses the sweatdrop emote. Here is a list of the emote IDs with pictures.
The next 3 commands are the rest of the dialog, speak Penny \"Dialog line 3.\"/speak Sam \"Dialog line 4.\"/speak Penny \"Dialog line 5.\"
Jump command, a pause, and a viewport change
Then we have jump Sam 3
. This is where Sam jumps up in surprise. The number indicates the intensity of the jump. The default intensity is 8
, which is a super big jump into the air. By setting it to 3
, we have him do a little hop.
Our next 2 commands are another pause and setting the viewport back to a black screen, pause 800/viewport -1000 -1000
.
End command
The last command, end
, fades the event out and returns to the game. The player is at the same position where they entered the map before the event started playing.
Event script video
Here's a screen capture of what the event looks like!
See also
- Event modding wiki page
- Instructions on the modding wiki for unpacking your game files
- The dialog modding wiki page, specifically the section on Conversation Topics
- Emote ID list
- The Siv tutorial, which also contains a breakdown of an event
- Tips for Making Events by Arknir
- Tutorial: Creating an Event
- Tips for Making Events from a Novice by LenneDalben