open your map and save it as a SC2Components file.
locate the folder "MAP_NAME.SC2Map" in your C: drive and open it.
Locate and open the file MapScript.galaxy.
override the "actual" map script.
The "actual" map script will expose the InitMap() function which is not shown by the editor.
Note, the commands "data->compile all" and "data->View Script" do not detect scripts created in this manner. The editor will allow you to save despite syntax errors. The best way to test your script is to actually play your map.
If you mean "How to put a galaxy script into a library," then you need to realize that there's the GUI/XML library and there's the actual library folder created by the modder in the "MAP_NAME.SC2Map" folder.
Yup, to create the GUI/XML library just use trigger module; doing it by hand is too prone to glitches.
launch the trigger module
right-click on a white space under the library area
select Library->New Library
Right-click on the new library. Select New->New Custom Script.
If your library requires an init function to be called, you can set the init function in the "Initialization function (optional)." Select your script/code to see it.
It's probably best to write the script with a third-party tool, then copy&past it into the library.
The other "library" is a folder that's created by modders under the S2MAP folder (you get the folder when you save your map as a component list).
Open your MAP_NAME.SC2Map folder
Create a folder called Library (or whatever you want)
Create whatever .galaxy file you desire in that folder
You can now reference that galaxy file in your script using the include command.
For example, i would type include "Library/PhysicsEngine" to include the file "PhysicsEngine.galaxy" in my MapScript.
It's obvious that the word library in SC2 is not completely analogous to what a library is in C plusplus. A library that's packaged as an XML is completely retarded, but hey so is Blizzard.
Not sure if I can be of some help, but i guess trying wouldn't hurt.
I'm not quite sure what you're asking.
If you mean it literally, then
The "actual" map script will expose the InitMap() function which is not shown by the editor.
Note, the commands "data->compile all" and "data->View Script" do not detect scripts created in this manner. The editor will allow you to save despite syntax errors. The best way to test your script is to actually play your map.
If you mean "How to put a galaxy script into a library," then you need to realize that there's the GUI/XML library and there's the actual library folder created by the modder in the "MAP_NAME.SC2Map" folder.
Yup, to create the GUI/XML library just use trigger module; doing it by hand is too prone to glitches.
If your library requires an init function to be called, you can set the init function in the "Initialization function (optional)." Select your script/code to see it.
It's probably best to write the script with a third-party tool, then copy&past it into the library.
The other "library" is a folder that's created by modders under the S2MAP folder (you get the folder when you save your map as a component list).
You can now reference that galaxy file in your script using the include command.
For example, i would type include "Library/PhysicsEngine" to include the file "PhysicsEngine.galaxy" in my MapScript.
It's obvious that the word library in SC2 is not completely analogous to what a library is in C plusplus. A library that's packaged as an XML is completely retarded, but hey so is Blizzard.