HPL3/SOMA/Getting Started/Add Your First Script
< HPL3 | SOMA | Getting Started
Jump to navigation
Jump to search
Every map can have a map script. For the sample map, it is sample_map.hps beside sample_map.hpm.
Add a visible script change
- Open
MyFirstMod/maps/sample_map/sample_map.hpsin your text editor. - Find
void OnStart()inside thecScrMapclass. - Add the debug-message call between its braces:
void OnStart()
{
cLux_AddDebugMessage("Hello World!");
}
- Save the script.
- Launch the mod. If the map was already running in development mode, press
F5to reload it.
The text Hello World! should appear at the lower-left of the screen when the map starts.
cScrMap : iScrMap declaration, and the surrounding callback structure. This tutorial changes only the body of OnStart().Checkpoint
Continue when the message appears in-game after a fresh map start.
If it does not work
- Confirm the script has the same base name and folder as the map:
sample_map.hpmandsample_map.hps. - Confirm the line ends with a semicolon and uses straight quotation marks.
- Confirm you edited the script inside your copied mod.
- Press
F1in development mode, then use Show Error List or Show HPL Log.
Read Scripting Workflow and Structure for the generated map-script layout and Hello World for the focused scripting lesson.