- Login or register to hide this ad -

Musical instruments

From AdventureCraft

Jump to: navigation, search

There are 3 instruments currently available in Adventure Craft: harp, snare drum, and guitar. Using the instrument brings up a music GUI: A red musical staff (treble). Using the number keys 1 to 0, you can play a series of notes. Pressing shift + numbers will make the note a sharp. With this system, you can play many different kinds of songs.

In past versions, the only way to actually use instruments was to right click on signs with them. Then, the instrument would play whatever notes were on the sign. If this is done now, the instrument will play whatever notes are on the sign, as well as bring up the music GUI.

Scripting has been incorporated into instruments. When you play a certain song (Which the map creator adds) a script is triggered. Scripts can do just about everything, from healing the player to lighting him on fire. In order to make an instrument run a script, you need a single file, as well as another file for every musical script. The first file, named "musicScripts", holds information about:

The below is an example of a simple "musicScripts" file. Make sure yours is also in .txt format, and that it is inside your map's folder.

54321, healsong.js, The Song of Healing
123123, stunsong.js, The Song of Stuns

Then, you need to go ahead and create the script files. Place them in the "scripts" sub-folder of your map. Save them as a .js file (js stands for JavaScript), and you are ready to go! The below is an example of a song's script. It is really simple, all it does is heal the player whichever amount there is in the brackets (10 is used as an example).

player.heal(10);

Once both files are saved and are in place, playing the notes "54321" on any instrument would cause the player to gain 10 health points.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox