• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

START HERE - The StarCraft II Editor FAQ!

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
This thread is designed to answer a number of repeating questions that constantly are getting raised over the course of this sections activity. Questions that are not related to those in this list should go in their own topics.

How do I make an Uberlisk or any compound unit (with different components attacking from it)?
Sadly there is no definitive solution to this due to the exact mechanics varying depending on the requirements of the implimentation. However it is definatly doable and is done via attaching actors to one another via an actor inhertance configuration and using effects to make the actors perform animations.

You can learn the basic principles behind this from the Livithan campaign unit (as seen in TValerian02B and TValerian03 missions). The actual unit base model has no tenticles attached to it as they are all attached and controled by actors. Further more each tenticle can function independintly from each other and attack at different times (controled by separate effects each) which is the exact functionality demonstated by the Uberlisk from Blizcon.

Be aware that the terratron is a special model made by blizzard that is included in the Wings of Liberty campaign (Lost Viking mini-game).

Where are the campaign units?
What are mods and how do I use them?

Starcraft II uses a mod based system to deliver all of its artistic content weather ordinary melee or custom. Campaign art and data come in the form of campaign mods, one with the in game content and one with all the cut scene content. Due to the structure of Starcraft II being a trilogy and each part allowing separate play, it can be assumed that particular campaign mods will not be present on everyone's installation. Mods are loaded sequentially from top to bottom and adding a mod will passivly add all its required mods if not present already.

To add mods to your map...
  1. Click on the "File" menu located normally at the top left of the terrain editor.
  2. Choose the "Dependencies..." option from the drop down menu.
  3. Click the "Add Standard..." (Campaign or melee) or "Add Other..." (User created mods downloaded from battle.net) buttons.
  4. Add Standard... - Tick the campaign or melee mods to add to the resources your map can use and click "Ok".
    Add Other... - Choose a single mod from either "Local Files" (local testing only, overwrites battle.net mods and not available when publishing) or from "Battle.net" (requires internet connection, publishing safe) and click "Ok".
  5. Click the "OK" button and let the mods load (may take a while especially for campaign mods).

WARNING - Published mods can only be used by maps published by the same publisher. A bug in the StarCraft II Editor means that mods do not always load correctly so assets that appear available might not mirror what will actually be available ingame.

My custom unit has no model!
Starcraft II uses a relationship based structure for all its game data. As such everything is derived from template (native) types unlike previous Blizzard games like Warcraft III where every object had its own unique template. This system permits more efficient and flexible custom data creation than previous games however it comes at the cost of being very hard to understand unless you have done a course on databases. The key thing to remember is that each derived piece of data has an origin template and that some fields of certain templates are keys to other pieces of data derived from templates. Some of them are not logical like the actor unit relationship where the actor assigns itself a unit rather than you giving a unit an actor which is what one guesses.

Actors interact with other data via actor events. Inorder for a unit to have a model ingame, a unit actor needs to be created and attached to the unit via actor events. It is very well possible to have 2 unit types using the same actor by giving the actor the appropiat events for both types. Ofcourse, actor events allow you to do much more than that such as compound units or even units which change their looks at certain conditions.

To create a minimum functioning placeable custom unit duplicate of an existing unit (not recommended but easiest way)...
  1. Press the F7 hotkey on your keyboard to bring up the Data window (or select "Data" from the "Modules" drop down menu) from any editor window.
  2. Select "Units" from the "Data Type" drop down list and let it load (might take a while).
  3. Choose a unit which you want to duplicate the properties of for a custom unit from the list of unit objects. Unit objects include some projectiles and all destructibles.
  4. Right click on the unit object in the list and select "Duplicate Object..." from the drop down menu.
  5. Tick the unit's main actor from the structured list that appears. This usually has the same name as the unit object it references. You may also want to tick other objects that you want to make uniquely reference the custom unit but be aware that any data referencing them will not be duplicated (can cause missing actors).
  6. Click the "OK" button.
  7. Edit field values to customize the unit as much as you want.

A more hands on approach is covered by this guide...

Why is my variable not working?

You are probably using a local variable when you want the data stored to it to persist between function calls. Local variables are mechanically different from global variables. In WarCraft III you only had access to global variables. Global variables are created at the same level triggers and action definitions are.

Why must I run all action definitions as new threads?

This was a practice that was spread by people at SC2Mapster who were mal-informed about how the StarCraft II Galaxy virtual machine operates. It was based on how StarCraft II creates trigger threads and that modern processors are capable of running multiple threads at the same time. The galaxy virtual machine scheduler does create multiple threads but it only allows one to execute at any given time and will not pre-empt it. This is to avoid the scripter having to deal with complications such as deadlock and race conditions that occur with using multiple operating system threads. It also is crucial for synchronization as the process manager of the operating system is not reliable so even with synchronization techniques in place different computers might run threads in a different order to produce different results.

The GUI action that is described like it has the behaviour of a mutex is a lie and has no special constructs or function calls. All it does is use a global boolean variable to prevent two threads from entering the same block of code at the same time. It functions by polling for no threads being in the code block every second unlike the behaviour of a true mutex which relies on the blocking thread to wake up blocked threads. The only purpose of the action is to run code that contains timing and is structured in a way that only one thread can use it at a time. It is of no use with code that contains no timing as it is impossible for two threads to run the block at the same time.

All events create a new thread. All action definitions that create new threads create a trigger. It is of no use running only an action definition in a new thread from a trigger that just fired and will waste processor resources. All action events should not make new threads unless absolutely necessary.

There are only a few cases where an action definition should create a new thread. If the action uses timing but must run in parallel. If the action is computationally intensive so prone to causing threads to hit the operation limit. If the action requires a lot of stack space and is prone to cause stack overflow.
 
Last edited:
Top