|
|
Line 7: |
Line 7: |
| Very nice site! | | Very nice site! |
| | | |
− | ==Script Files==
| + | Very nice site! |
− | 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:
| + | |
− | {|class="wikitable"
| + | |
− | ! 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.
| + | |
− | |}
| + | |
− | | + | |
− | ===Custom Parameters===
| + | |
− | Custom parameters are a way of making your script files easily configurable and reusable. Rather than hard-coding particular values into your script files (for example, the strength of a jump technique), you can insert identifiers surrounded by double exclamation marks in their place (for example, !!JUMP_STRENGTH!!). Then, whenever one of those scripts is referenced in ''hsmConfig'', you would also define an object of custom parameters, like:
| + | |
− | <nowiki>"mySpell": {
| + | |
− | "effectScript": "@spell_jump.ss",
| + | |
− | "effectScriptParams": { "JUMP_STRENGTH": "3.2" }
| + | |
− | }</nowiki>
| + | |
− | | + | |
− | Now for the spell mySpell, !!JUMP_STRENGTH!! will be replaced by the string specified in ''hsmConfig''! Pretty cool, eh?
| + | |
− | | + | |
− | Since it's simple string replacement, you can replace custom parameters with whatever snippets of code you desire. Suppose you wanted JUMP_STRENGTH to depend on strength in one spell, and dexterity in another-- you could do something like this:
| + | |
− | <nowiki>"mySpell": {
| + | |
− | "effectScript": "@spell_jump.ss",
| + | |
− | "effectScriptParams": { "JUMP_STRENGTH": "3 + caster.getStr() * .02" }
| + | |
− | },
| + | |
− | "anotherSpell": {
| + | |
− | "effectScript": "@spell_jump.ss",
| + | |
− | "effectScriptParams": { "JUMP_STRENGTH": "3 + caster.getDex() * .02" }
| + | |
− | }</nowiki>
| + | |
− | | + | |
− | Don't get too crazy though-- you want to be able to glance at a custom parameter's name and value and know exactly what it does, and depending on variables defined in another file can detract from this.
| + | |
Revision as of 01:48, 23 May 2014
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.
You'll definitely want to use a syntax-highlighted text editor like Sublime Text when customizing Hack/Mine. A Sublime package for Spellscript is also available here.
This web site really has all the information and facts I wanted about this subject and didn't know who to ask. cacadeaafkgfcddd
Very nice site!
Very nice site!