NPC Music Player for Rust Oxide/Umod - $25 US

What is this?

Remod.org's first paid plugin!

Requires: HumanNPC from Remod.org. NPCs will also likely need the Kits plugin from umod.org.

Current version: 1.1.8

Playback converted midi files in ToneJs format. Ability to assign NPCs to each track including a single NPC on multiple tracks per song. NPCs are associated with a song by their band number and the type of instrument.

The NPCs must be assigned to a band number (1 - XX), and must have a kit with either a held instrument or positioned within 1.5m of a mountable instrument and with allowsit set to true.

The ToneJs format converts midi to json format with information for track, notes and octave for each track along with other information. We can't yet use all of what the ToneJs format and MIDI provide such as control changes for pitch bending. This is not currently implemented into Rust instruments as far as we know.

You may optionally spawn a band on the Outpost stage.  This will be band 99.

NEW:

Fixed missing playback of the note A.  Thanks, zero.  Also, the Outpost band will now face the front of the stage.

Demos

Playback

 GUI

Converter

You will need to convert your midi files to ToneJs format using our converter. There are other examples out there as well.

  1. Load NPCPlay onto your server (oxide/plugins directory).
  2. Open the converter link above.
  3. Drag and drop or select a multitrack MIDI file for conversion.
  4. The contents of a JSON-formatted song file will appear in the box below the upload button.
    1. You can preview the file in your browser if you like.  However, this is nothing like the sound in-game.
    2. Copy this text and paste into a text editor.
    3. Save the file as songname.json.  It is recommended that the name not contain spaces but it can contain underscores like "Back_in_Black.json"
    4. You may need to select All Files in the text editor when saving so that a txt extension is not added to the filename.
  5. Copy or move your new json song file to your Rust server into the oxide/data/NPCPlay/songs folder.
  6. Type /song list in game.  If you do not see the file in this list, reload the plugin.

Permissions

The following permissions are used by NPC Music Player:

  • npcplay.use => Allow user to run the /song and /band commands.

Configuration

{
  "AutoSpawn Outpost Song: ": "SONGNAME",
  "AutoSpawn Outpost: ": true,
  "Outpost Band Trigger Start: ": true,
  "Outpost Band Trigger Stop: ": true
}

The config file is currently only necessary for spawning the band at Outpost.

The SONGNAME should be the name of a ToneJs song file in the data/NPCPlay/songs directory without the .json extension.

The trigger start/stop settings determine whether the band will start playing when a player is in range or stop when they leave.

Commands

  • /song list = List songs in the data/NPCPlay/songs subdirectory

  • /song load ID = Load a song (for use in previewing, showing info, etc.

  • /song info = Show track info for loaded song

  • /band list = List configured bands (group of NPCs and a song)

  • /band add = Create a new band (numbers will increment from 1-99)

  • /band ID info = Show info for a particular band

  • /band ID play = Start band number ID

  • /band ID stop = Stop band number ID

  • /band ID song ID = Add song with ID from song list to a band

  • /band ID assign NPCID TRACKNUM = Add an existing npc with NPCID to a band, assigning to a specific track

  • /band ID drum TRACKNUM = Setup a single track to be the drum track. There is special handling for octave on this track.

  • /band ID tstart (true/false) = Allow trigger start (NPC Enter, etc.)

  • /band ID tstop (true/false) = Allow trigger stop (NPC Leave, etc.)

  • /band ID gui = A graphical user interface for editing song track assignments for a band.

  • /band ID hire = Start or stop the hiring process. When active, you can select NPCs for your band by pressing "E" in front of each NPC.

  • /band ID fetch = Relocate all band NPCs to your present location, e.g. after a server wipe. (version 1.1.6 and above)

Band Setup (with GUI)

  • Type /band new and then /band list. You should see a new BANDID number.
  • Type /song list and note the SONGID of the song you wish to have this band play.
  • Type /band BANDID song SONGID
  • You will need to create NPCs using HumanNPC (remod.org version). Place them in position on a stage setup or wherever you like.
  • For NPCs to be seated at drums or piano, etc., /npc_edit NPCNAME and then type /npc allowsit true. If they are close enough, they should sit down.
  • Place your guitar and bass NPCs wherever you like. You will need to, using the Kits plugin, create kits that include the desired instrument. Do not include more than one held instrument in the tool belt of the kit.
  • Type /band BANDID hire.
  • Walk up to each NPC and press "E" to add them to your band.
  • When done hiring band members, type /band BANDID hire. This will end the hiring process.
  • Once you have all your new NPCs in place, type /band BANDID gui to open the assignments gui:NPC GUI
  • The track listing for your song will show in rows from top to bottom.
  • Your NPCs will be listed left to right at the top. They will also appear at the bottom in red. This means that they have not been assigned.
  • At the far left you can select a drum track. Hopefully, the names of the tracks just to the right will work as a guide.
  • At any time you can push play, stop, or close.
  • To select the drum track or to assign NPCs to a track, find the track number and look for the button on that line under drum track or under the NPC name.
  • Change assignments while playing if you wish.

Band Setup (old, no-GUI)

  1. Type /band new and then /band list.  You should see a new BANDID number.  This will need to be assigned to your NPCs.
  2. You will need to create NPCs using HumanNPC (remod.org version).  Place them in position on a stage setup or wherever you like.
  3. For NPCs to be seated at drums or piano, etc., /npc_edit NPCNAME and then type /npc allowsit true.  If they are close enough, they should sit down.
  4. Place your guitar and bass NPCs wherever you like.  You will need to, using the Kits plugin, create kits that include the desired instrument.  Do not include more than one held instrument in the tool belt of the kit.
  5. Set the band for each NPC to match the BANDID number, e.g. /npc_edit NPCNAME and then /npc band 1.
  6. Once you have all your new NPCs in place, record the ID numbers assigned to them.
  7. Type /band new
  8. Type /song list and note the SONGID of the song you wish to have this band play.
  9. Type /band BANDID song SONGID
  10. For each band member NPC:
    1. Decide which track or tracks they should play.
    2. For example, track 1 is listed as bass.
    3. /band BANDID assign NPCIDofBASSNPC 1.
  11. If you have a drummer and a drum track, you will need to assign the drum track for the song in addition to assigning an NPC.
    1. /band BANDID drum TRACKNUM (default will be 0, which may or may not be the right track.
  12. You can assign a single NPC to multiple tracks if you like.  Just repeat such as:
    1. /band 1 assign 784132124 2
    2. /band 1 assign 784132124 4
  13. Once you have your band setup, you can type /band BANDID play
  14. Type /band BANDID stop to stop playback.

Requirements and Limitations

  • FIXED Performance currently limits to one actively playing band per server at a time.  Work is in progress to fix this, if possible.
  • Some MIDI files may include notes that are out of the range of some Rust instruments.  Piano has the most range but others are limited to typically 1-2 octaves.
    • Correction for this currently must be done in the MIDI file itself.  Or, for the brave, you can edit octaves for each note in the json file.  This is NOT recommended but can be done.
    • We do currently correct drum tracks.
  • Works only for the HumanNPC from Remod.org
  • NPCs using a held instrument such as guitar or bass will need a kit via the Kits plugin which includes the desired instrument and no other held instruments.
  • NPCs playing piano, drums, or xylophone must be positioned close to the instrument and have the allowsit variable set to true.  They need to be closer to the desired instrument than any other seated instrument or chair, etc.
  • The default server maxtickspersecond of 300 should work - lower or higher values may not.

For Developers

Hooks were implemented to allow other plugins to interact with this one. None of them have return values.

Start band playback. tstart for band must be set to true.

 BandPlay(int bandnum)

Stop band playback. tstop for band must be set to true.

 BandStop(int bandnum)

TODO

  • Auto assigning of NPCs based on held instrument, etc.
  • Repeat
  • Multiple songs per band
  • Spawning of bands based on the chosen song.
  • Performance tweaks to allow multiple bands - this of course depends on the number of actively playing notes in each active band.  If 2 bands are playing something simple, then they might be able to coexist.
  • Allow for NPC removal.  For now you can assign them to an unused or non-existent track to shut them up.
  • A GUI would be nice.

Sample songs available at https://remod.org/songs.

$25 US

Once payment is received via the link below, you should receive a temporary download link via email from desolationoutpostpve@gmail.com, usually within 24 hours.  Please email us with your Steam ID and Discord ID if available so that we can track who actually bought the plugin.  The emailed link will be available for 24 hours and can only be used once.  All sales final.