Cavestory Mod API
CaveEditor 2 Overview

CaveEditor 2 is a fork of Wistil's CaveEditor, made specifically for Cavestory Multiplayer.

This article will be going over new features.

New TextScript commands

'Calling' events is now a feature. When an event is 'called', the game runs that specific event until it reaches <END, then returns execution back to the previous event. New textscript commands have been provided to accomodate new CSMP-specific features. Here they are:

NetPlay Commands
<CFNXXXX | Set the given npc's client focus to the current text script executor.
<NDIXXXX:YYYY | Set the player's death position to (X, Y). If the client isn't dead, then kill them.
<NPJXXXX | Jump to X if this a net play session.
<SPJXXXX | Jump to X if this a single player session.
<TARXXXX | Set the target that should be effected by events. [0 = Everyone, 1 = Event Starter, 2 = Event Starter's Team]
<USE | Use an inventory item.
<LOB | Go back to the server lobby.
Branch Commands (Generic)
<CEVXXXX | Call event X (non-conditional)
<FLCXXXX:YYYY | Call event Y if flag X is set.
<NFCXXXX:YYYY | Call event Y if flag X is NOT set.
<RNDXXXX:YYYY:ZZZZ:WWWW | Jump to event W if a random number between X and Y is equal to Z.
<RNJXXXX:YYYY | Jump to a random event # between X and Y.
<SV1XXXX | If there is only 1 save slot in this mod, jump to event X.
<SVJXXXX | Open the 'save game' prompt. Jumps to event X if the player doesn't save the game.
Branch Commands (Players)
<AMCXXXX:YYYY | Call event Y if player has weapon X.
<ITCXXXX:YYYY | Call event Y if player has item X.
<NAJXXXX:YYYY | Jump to event Y if player does NOT have weapon X.
<NIJXXXX:YYYY | Jump to event Y if player does NOT have item X.
Branch Commands (Flags)
<NFLXXXX:YYYY | Jump to event Y if flag X is NOT set.
Branch Commands (NPCs)
<EQJXXXX:YYYY | Jump to event Y if equip flag X is set.
<ECJXXXX:YYYY | Jump to event Y if npc with event ID X exists.
<NNJXXXX:YYYY | Jump to event Y if no NPCs of type X exist.
Team Commands
<TECXXXX:YYYY:ZZZZ | Create a team with ID X and a color of RGB(Y, Z, W).
<TEAXXXX:YYYY | Add the player to the specified team.
<TEJXXXX:YYYY | Jump to event Y if the event executor is apart of team X.
Message Commands
<WANXXXX:YYYY | Pause script until npc with event X's 'act_no' equals Y.
<WAS | Pause script until player touches the ground.
Booster Commands
<BFR | Refuel the booster reserves instantly.
<BFSXXXX | Set booster fuel to X.
Image Commands
<IMC | Unloads the current screen image.
<IMFXXXX:YYYY | Loads image from '(ModFolder)/Images/XXXX/YYYY.png' and displays it, covering the entire screen. Recommended image size is 426x240.
<IMGXXXX | Loads image from '(ModFolder)/XXXX.png' and displays it, covering the entire screen. Recommended image size is 426x240.
Gamestate Commands
<LDI | Load the internally saved gamestate from <SVI.
<SVI | Saves the current game state internally.
Collectable Commands
<SCO | Show collectables in the top-left corner.
<HCO | Hide collectables from the HUD.
<CO+XXXX | Collectable count increases by X
<CO-XXXX | Collectable count decreases by X
<COJXXXX:YYYY | Jump to event Y if the player has exactly (or more than) X amount of collectables.
GameDemo Commands
<ARD | Automatically start recording a pxdemo.
<DMS | Use after <ARD. Stops the current recording and saves it to '(ModFolder)/Demos/(date and time).pxdemo'
NPCs Commands
<NPPXXXX:YYYY | Set the pNpc of the NPC with event X to the NPC with event Y.
<SNEXXXX:YYYY:ZZZZ:WWWW | Create npc of type X at coord Y:Z with event W.
<SNAXXXX:YYYY:ZZZZ:WWWW | Perform action Y on npc X with arguments Z and W. Here's a list of actions:
0000: Set code event to Y.
0001: Set flag Y.
0002: Clear flag Y.
0003: Set health to Y.
0004: Set direction to Y.
0005: Set x velocity to Y.
0006: Set y velocity to Y.
Player Commands
<TMTXXXX | Teleport the player to an NPC with event X.
<TRNXXXX:YYYY:ZZZZ | Transport to map X, run event Y and place player at npc with event Z.
<TTMXXXX | Transports the npc with event X to the player.
<MTNXXXX | Moves player to NPC with event X.
<LI-XXXX | Lose X health.
<LI=XXXX | Set health to X.
<ML+XXXX | Maximum health increases by X.
<ML-XXXX | Maximum health decreases by X.
<ML=XXXX | Set maximum health to X.
<PHYXXXX:YYYY | Change physics variable X to value Y. See below for all possible variables.
<AMZ | Lose all weapons.
<REF | Reset all equip flags.
<CNM | Outputs the player's character name as text.
<FSH | Player begins fishing immediately. Does not require the player to have a fishing pole.
Timer Commands
<STFXXXX | Saves the current Nikumaru timer to '(ModFolder)/XXXX.rec'.
<RDSXXXX | Outputs record time from '(ModFolder)/XXXX.rec' as text. If it doesn't exist, outputs '0'.
Miscellaneous Commands
<SIS | Stop the intro sequence.
<SPT | Show a menu displaying speedrun times.
<SSO | Set the display offset for stage selection.

Here's a list of variable indices for <PHY:

0000: max_dash
0001: max_move
0002: gravity1
0003: gravity2
0004: dash1
0005: dash2
0006: resist
0007: jump
0008: max_dash
0009: max_move
0010: underwater gravity1
0011: underwater gravity2
0012: underwater dash1
0013: underwater dash2
0014: underwater resist
0015: underwater jump
0016: ignore_water

Main View

This is the main dialog of CaveEditor 2, and is where you can access many of its features.

Here's a list of new features:

  • Setting up a mod to automatically open on startup.
  • Playing .ORG music in-editor.
  • Playing .PXT sounds in-editor.
  • Splitting maps up into 'areas'. This is used to determine what map to use while waiting in the NetPlay Lobby. The game uses the currently targeted savefile's map to determine which area to use.
  • Importing stage.tbl / .pxm / mrmap.bin (via 'Import Map...' - You need to select it in the file extension dropdown box). This will also import the necessary assets. You'll have to manually setup the music, though.

Mod Settings

This menu allows you to describe your mod & setup various restrictions.

  • 'Mod Version' is shown on the title screen when the mod is loaded.
  • Specify event numbers for global events, such as 'Core Drown Event', 'Everyone Died Event', 'Drown Event', etc.
  • Choose what music track you want to play on the NetPlay menu.
  • Choose what music trakc you want to play on the title screen.
  • Disable certain HUD elements

NPC Editor

  • Select specific NPCs using a list instead of scrolling a scrollbar!
  • Import an existing 'npc.tbl' file.
  • Specify NPC names. These names are used to display 'killed by' messages in multiplayer. Ex: "Clay Hanson was killed by <NPC Name>!"
  • Setup preview info for NPCs.
  • Setup default map properties for NPCs.
  • Setup a category name + shorthand names for NPCs! Shorthand names are displayed in the map editor overtop the NPC.
  • Setup 'transmit nodes' for NPCs, which controls what data gets sent over the network during a NetPlay session. Just another way to limit bandwidth!
  • Setup 'nodes' for NPCs, which specifies what NPC fields need to change before the NPC gets marked as 'Dirty'. Dirty NPCs are re-sent to all clients on the next server tick, and then unmarked as 'dirty'.
  • Add custom text for option flags! This will replace 'Option 1', 'Option 2', etc. in the map editor's 'Flag Details' dialog.
  • Add different 'transmit nodes' setups for different act_no's – This is marked as 'Networking Acts'. Basically, if an NPC's 'act_no' is set to a certain Networking Act's 'Act #', it will use the set 'transmit nodes' for that Networking Act instead of the default 'transmit nodes'.

Bullet Editor

You can edit bullet data in this menu.

Weapon Editor

You can edit weapon data in this menu. You can also preview how weapons look by loading a custom character here!

Map Editor

You'll be editing maps in this menu.

You might notice a few new features over CaveEditor 1, such as:

  • The ability to open multiple maps at once.
  • Changed confusing 'Entity ID' text to 'Flag #'.
  • NPC properties, which can be referenced using custom NPC code.
  • A zone editor (More on that below).

Here's some stuff to check out related to entity properties:

See also
CSM_EntProp_GetFieldValue_String
CSM_EntProp_GetFieldValue_Int
CSM_EntProp_GetFieldValue_Float
CSM_EntProp_GetFieldValue_Boolean
CSM_EntProp_GetFieldValue_Color
CSM_EntProp_GetFieldValue_Point
CSM_EntProp_GetFieldValue_Rect

Map Properties

You can modify the properties of a map here. Some new features include being able to force the camera to the center of the map & being able to enable heart / EXP / missile pickup sharing across all clients!

Text Script Editor

  • The ability to preview message formatting like it will appear in-game.
  • A specific dialog has been added to help select command arguments for <TRA.
    The textbox previewer.
    The new <TRA command helper.

Map Zones

Map zones are meant to be used in large maps with a ton of NPCs to help mitigate bandwidth usage. The idea is very simple:

  • When a player (or their screen view) is within a map zone, they'll be sent updates for all NPCs in that same map zone.
  • When a player CANNOT see a zone, they are NOT sent updates for those NPCs / players, saving on bandwidth! The total bandwidth saved may be negligible, but every saved bit counts. It all adds up!

Getting Started

To begin creating a mod, click on 'File' in the top-left corner of the main window & click on 'New'. From there, follow the instructions & fill out the information, and CaveEditor 2 will create your very own mod folder!