SC2Mapster Forums

Development > Triggers

[Libraries]What exactly do they do?

  • 5 posts
    #1 Apr 16, 2012 at 03:45 UTC - 0 likes

    I was under the impression that a trigger library was simply a bunch of triggers that you could use for several different maps. For example, say you create a map with triggers for a defense game. You create triggers for spawns, levels, timers, dialog windows, dialog buttons, score/leader boards and a life counter. You then create a new library and move all the triggers to said library and export the library. You create a new map and import the library and all the triggers in the library will occur in the new map.

    However, I was sorely mistaken and it leaves me completely in the dark about what a library actually does. I have used a few libraries for testing purposes and noticed you can do things like create custom talent trees, level spawning for defense maps....and even on a major scale, you can add entire mechanics like they cortex rp library.

    I did a search and couldn't find anything (tutorial wise) for how to create and work with a library. So, can someone explain to me what a library does and give me a quick example?

    #2 Apr 16, 2012 at 04:24 UTC - 0 likes

    A libary is a collection of triggers and/ or code that can be reused and imported into other maps or mods. This could contain triggers, custom scripts, functions, event/ condition/ action definitions, preset types, records, variables, etc. Basically any code can be stored in a library.

    It is usually written to be re-usable and self contained, so that if you drop it into a new map or mod it should be relatively easy to setup. The complexity varies for each library as well.

    After it is written, the library can be exported and imported into other maps. Instead of having to copy the folder of code, you just import the library package.

    For example, If you were to write game systems, such as reading and writing to a bank, dialog setup and styling, waves and spawning, custom triggered abilities, etc., it would be best to save them in libraries. That way you can export it to a library which can be imported into any map or mod easily. This allows you to reuse the code in a different map, or share it with others.

    Last edited Apr 16, 2012 by VoidPotato: Fixed example and grammar.
    #3 Apr 16, 2012 at 17:28 UTC - 0 likes

    So basically it's the same thing as simply copy/pasting triggers from one map to another?And do libraries count towards the trigger limit?

    #4 Apr 16, 2012 at 17:39 UTC - 0 likes

    Please note that libraries can also define custom data sets, custom event/condition/action definition, among other things normally unavailale by just standard triggering.

    And yes, every little code related stuff counts towards the script limit.

    #5 Apr 16, 2012 at 18:03 UTC - 0 likes
    Quote from bulletbutter: Go

    So basically it's the same thing as simply copy/pasting triggers from one map to another?

    That's obvious. Any library in any computer language could simply be copy pasted in code form. Point is to have it as sort of extension. Also as bonus libraries can hide their internal variables and functions so all you get is an clean API to work with.
    Tho in galaxy libraries are fairly limited as there's no class support, not even struct parameters/return so in the end you will still work with Strings, Integers etc

  • 5 posts

You must login to post a comment. Don't have an account? Register to get one!