Customization

From Hack/Mine Wiki
(Difference between revisions)
Jump to: navigation, search
m (Class)
(hsmConfig Layout)
Line 20: Line 20:
 
At the highest level, ''hsmConfig'' is an object with several expected objects within it, including "classes" and "spells".  Every object within the "classes" object will be added to Hack/Mine as a selectable class, whereas every object within "spells" will be added to the set of all possible spells that classes may have assigned to them.  A description of all possible pairs for objects contained by ''classes'' and ''spells'' is now given.
 
At the highest level, ''hsmConfig'' is an object with several expected objects within it, including "classes" and "spells".  Every object within the "classes" object will be added to Hack/Mine as a selectable class, whereas every object within "spells" will be added to the set of all possible spells that classes may have assigned to them.  A description of all possible pairs for objects contained by ''classes'' and ''spells'' is now given.
  
Note: "LString" and "Script" refer to a strings that, if beginning '@', will be used to retrieve a value from the user's selected language files, or a script from the ''spells'' directory, respectively.  Also, "Number" refers to any real number, whereas "Integer" refers to an integer.  "Boolean" refers to values of either ''true'' or ''false.
+
Note: "LString" and "Script" refer to a strings that, if beginning '@', will be used to retrieve a value from the user's selected language files, or a script from the ''spells'' directory, respectively.  Also, "Number" refers to any real number, whereas "Integer" refers to an integer.  "Boolean" refers to values of either ''true'' or ''false''.  Finally, note that block and item IDs should be [[Block and Item IDs|display IDs]], which are consistent with the vanilla Minecraft IDs but differ from the ones you'd be using within [[Spellscript]].
  
 
===Class===
 
===Class===

Revision as of 22:07, 6 March 2013

The long-term goal of Hack/Mine is to be thoroughly customizable, such that users can create their own content and share it with the community. As of version 0.6.4, this is starting to become a reality, as users can create their own spells via Spellscript and create their own classes and skill-sets through a configuration file (hsmConfig.JSON) located in the <.minecraft>/spells/ directory. This information propagates over the network automatically, meaning each Hack/Mine server can offer its own unique RPG experience.

Contents

The JSON Data Format

To customize hsmConfig.JSON, you first need to understand the JSON data format. You'll also probably want a syntax-highlighted text editor like Sublime Text. A .JSON file is simply a text file, except its text must be organized according to a set of rules. If you're a programmer, you can probably understand the precise definition given here, but otherwise, read on.

JSON has three basic textual components: values, objects, and arrays. A value is either a string of characters enclosed in quotation marks, a real number, an array, an object, true, false, or null. An array is simply a comma-separated list of values enclosed by square brackets. And finally, an object is a comma-separated list of pairs enclosed by curly braces, where a pair is simply a string and a value separated by a colon. That's it! Here's some example JSON data:

{
    "someNumber" : 34,
    "anotherNumber" : 21.4,
    "aString" : "yo dawg",
    "anArray" : [2, 3, 5.2, null, "hi!"]
    "anotherObject" : { "this" : 0, "is": 1, "cool" : 2 }
    "jsonIsCool" : true,
    "jsonIsComplicated" : false
}

Now you're ready to customize hsmConfig.JSON...

hsmConfig Layout

At the highest level, hsmConfig is an object with several expected objects within it, including "classes" and "spells". Every object within the "classes" object will be added to Hack/Mine as a selectable class, whereas every object within "spells" will be added to the set of all possible spells that classes may have assigned to them. A description of all possible pairs for objects contained by classes and spells is now given.

Note: "LString" and "Script" refer to a strings that, if beginning '@', will be used to retrieve a value from the user's selected language files, or a script from the spells directory, respectively. Also, "Number" refers to any real number, whereas "Integer" refers to an integer. "Boolean" refers to values of either true or false. Finally, note that block and item IDs should be display IDs, which are consistent with the vanilla Minecraft IDs but differ from the ones you'd be using within Spellscript.

Class

To add a class to H/M, add a pair <className> : <classObject> to the classes object. <classObject> may consist of the following pairs:

Key Type Description
"climbableBlocks" Array of Integers A list of block IDs that the player may freely climb, much like a ladder.
"description" LString The flavor-text presented on the character-rolling GUI when the class is moused over.
"displayColor" String The hexcode for the class's color, used through various GUIs for flavor. Should be formatted RRGGBB.
"healthPerFortitude" Integer How much health the player receives per point of fortitude (default is 10).
"relativeIndex" Number Must be non-negative. Used to decide in what order to present the classes on GUIs.
"startingItems" Array of Integers or Strings A list of itemIDs that the player receives when the class is selected. A stack of multiple items may be specified by appending a ':' followed by the desired stack size (e.g. "20:64" is a stack of 64 glass).
"startingSpells" Array of Strings A list of spells, referenced from the spells object by name, that the player begins with.

Spell

To add a spell to H/M, add a pair <spellName> : <spellObject> to the spells object. You'll also need to reference it from a class under the classes object via the "startingSpells" key (Additional methods of incorporating spells, such as in a talent tree, are planned.) <spellObject> may consist of the following pairs:

Key Type Description
"activeManaCost" Number The base mana required each tick the spell is cast.
"activeManaCostPerStat" Number The additional mana required per stat each tick the spell is cast (see "stat"),
"activeScript" Script The script to execute each tick the spell is being cast.
"coolDown" Integer The number of ticks before the spell may be cast again.
"delayCast" Boolean If true, does not expend the initial mana cost or begin the cool down when initially cast, on the assumption the Spellscript method SpellInstance.delayedCast will be called from within "effectScript" later.
"description" LString The description of the spell provided in its mouseover tooltip.
"displayName" LString The name of the spell as presented throughout various GUIs.
"effectScript" Script The script to execute when the spell is first cast.
"manaCost" Number The base mana required to initially cast the spell.
"manaCostPerStat" Number The additional mana required per stat to initially cast the spell (see "stat").
"stat" String The stat used to calculate additional initial or active mana cost. Case-insensitive, may be "str", "strength", "dex", etc.
"textureID" Integer The texture index of the icon to use for the spell in various GUIs (calculated as x + y * 16)

Script Files

Script files can be placed in and referenced from the spells directory, and are interpreted as Spellscript scripts. For both "activeScript" and "effectScript", a return type of bool is expected, indicating whether the spell is successfully cast. The scripts also have the following variables in scope:

Type Name Description
World world The world (e.g. the Surface, the Nether, the End) in which the spell is being cast.
SpellInstance spellInstance The instance of the spell being cast.
Living caster The Living casting the spell (most likely a Player)
Entity targetEntity ("effectScript" only) The Entity the spell is cast on, if any.
Block targetBlock ("effectScript" only) The Block the spell is cast on, if any.
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox