Wow, thanks man! Being the noob that I am I simply pasted that stuff into a trigger and ofc I got an error message. So this is a "library" huh? Would you mind briefly explaining what a library is?
Sure. A library allows you to use the
private
keyword, which prevents naming conflicts between multiple libraries - this allows you to use simple, short names for your variables and functions and reuse the same names in multiple libraries, which makes it a lot easier and faster to write (and read) code than if you had to type out long, unique names.
Another feature of libraries is that they can be declared to require other libraries, so if library B uses functions from library A then the compiler will make sure that library A is placed into the map script before library B (this is important because you can't call functions that are declared below the line you are calling from). This way, you can place individual libraries into individual "triggers", instead of having to add them all to the map header like you had to do before we had vJass. This helps a lot with code organisation.
I realize now I wrote a lot about how my example works, but I didn't write anything about how to make it work. Here's what you need to do:
First, you need an editor that can work with vJass, like the NewGen pack. I just assumed you have it but I guess not all people do, so I'm mentioning this first.
Then, you need to copy the spell library into your map, best place to put it is inside a GUI trigger converted to JASS.
You need to also include the libraries of all the systems that the spell uses. In the case of my example, I used SpellEvent and xe, I included the links to where you can get those libraries.
Some systems also require some setup and calibration before they're good to go. SpellEvent isn't one of them, you just need to copy the library into a trigger and you're done. xe, on the other hand, takes a few more steps to set up - besides the code, you need to also copy the custom dummy unit it uses and import the custom model for that dummy. Both those things can be found in the xe demo map attached in the linked thread. Once you have the dummy unit in the map, you must also set the appropriate constant in the xebasic library to the unit's rawcode.
Once you have all the needed libraries setup, you can save the map and it should do so without errors. Then, one last step is to edit the calibration constants in the spell library with your spell ability ids, and your spell should be good to go. Note that when you're using vJass, you always need to manually save the map before you test it, if you just click the test map button then the editor will try saving the map without processing the vJass so it won't work ingame.