Inventaverse is pretty big. It's got a ton of features, mountains of code and lots of artwork. In the midst of all that creation is one feature that I'm particularly fond of.
The Incantations API
"What's the Incantations API Precious?", you ask? Close your eyes and imagine three (not one, not two, but three), unimaginably powerful books, that when found in game, grant the player access to a toolkit for building their own custom spells. That's right, you can write your own spells and further customize your play style in Inventaverse using PLAIN OLD JAVASCRIPT."Why would I ever want to do that?", you calmly ask? Well, allow me to explain to you, my naive reader, why you would want to wield such an incredibly powerful force in a video game. (by way of list)
1. Because it gives you an advantage over the game, and other players.
2. By writing incantations the skills available to you are massively increased.
3. The incantations you write complement your favorite skills and your artifacts.
4. Because learning and understanding the three books of magic and the Incantations API, is very interesting.
Each of the three books contains a set of abilities related to one of the three types of magic in Inventaverse.
- The Compendium of Physical Magics will allow you to spend your collected weapon ranks to add or remove physical matter from the game world.
- The Grimoire of Eldritch Forces allows you to sacrifice your health to teleport or deal damage to enemies.
- The Tome of Unifying and Dividing Energies lets you spend your gold to heal wounds, or improve your speed and jump capabilities.
Spells and Wards
When any of the three spell books are combined with each other and the common API, some very complex and interesting custom spells are able to be created.For example, the following Ward:
if(API.Affectable(API.Target())) { API.Reveal(API.Target()); } let row = API.Environment.Physical.length; let cells = []; while(row --> 0) { let col = API.Environment.Physical[row].length; while(col --> 0) { if(API.Environment.Physical[row][col] != 0) cells.push(new Point(col, row)); } } API.Reveal(cells);
This Ward makes use of the Common API, and the methods exposed by The Compendium of Physical Magics, to reveal blocks that are physical to the player, and to highlight the block under the mouse cursor, only if it is within the area of effect of the player's incantations. Simply put, it shows you what is physical and the areas that your custom spells can affect. Because it's ward, it will run continuously after the player presses the key it's bound to (either the R, F or V keys).
A ward is an incantation that continues running all the time, a spell is an incantation that runs only once, have a look at this Spell:
API.Self.Sacrifice(5); let loc = API.Target(); API.Self.Teleport(loc); API.Finish(0);
Let's break this one down. The first line sacrifices 5 health in exchange for enough magic to do something interesting.
Next, we create a variable with the let statement, called loc. After the = sign, we're getting the result of a function called API.Target(), this gives us the location under the mouse cursor.
After that we run the function API.Self.Teleport(loc). This function relocates our player to the location in the loc variable.
Take note of the API.Finish(0) command on the last line. This is the command that instructs the API to only run the incantation one time. If this line were missing, the incantation would continue to run, sacrificing 5 health every time the game cycle updates. In addition to that, the 0 in parenthesis is specific to which incantation should be finished. 0, 1, or 2, the index for each of the incantations bound to the player's R, F and V keys.
And there you have it. Some sample incantations, a little background on potentially the most powerful feature in Inventaverse. Use it wisely.
Until next time...
No comments:
Post a Comment