Skip to content
chansey97 edited this page Mar 4, 2018 · 13 revisions

Welcome to the sc2-project-template wiki!

Motivation

When creating maps, sometimes we want to refer to other people's maps. Especially in the development of more complex Campaign/Mod, may even go to the official Campaign/Mod. Official data organization is well organized, but due to the amount of data is too large, it is easy to get lost in the ocean of these data.

For example: when you create a catalog entry "CActorUnit - Marine" in StarCraft Data Editor:

<Catalog>
    <CActorUnit id="Marine">
    </CActorUnit>
</Catalog>

How do you find the parent of this entry?

One very inefficient way is:

  1. Open ActorData.xml in your map, search and close
  2. Open ActorData.xml in mod Swarm, search and close
  3. Open ActorData.xml in mod Liberty, search and close
  4. Open ActorData.xml in mod Core, search and close

This project providing some XQuery/XPath scripts to help you analyze entry hierarchy and locate entry. For the example above, we can get the following result view automatically:

oxygenxml-xpath-result-view.PNG

The first line is current entry, the second is parent entry of current entry, and so on. You can click the result record to locate that entry.

How to use it

Install Oxygen XML Editor.

Use MPQEditor or CASCExplorer to unpack SC2 (The SC2 version not necessary 2.0.6.25180, it can be the latest). Make sure the unpacked directory structure like this:

D:\starcraft2-2.0.6.25180-extracted\mods  
D:\starcraft2-2.0.6.25180-extracted\mods\Core.SC2Mod  
D:\starcraft2-2.0.6.25180-extracted\mods\Liberty.SC2Mod
D:\starcraft2-2.0.6.25180-extracted\mods\Swarm.SC2Mod

Download and unzip sc2-project-template-master.zip to arbitrary folder. Double click sc2-project-template.xpr in that folder to open Oxygen XML Editor.

Add your map and mods folders to the project, and then the project view will be like this:

oxygenxml-project-view.png

Edit the configuration.xml

<configuration>
   <mod href="file:/D:/starcraft2-2.0.6.25180-extracted/mods/Core.SC2Mod/"/>
   <mod href="file:/D:/starcraft2-2.0.6.25180-extracted/mods/Liberty.SC2Mod/"/>
   <mod href="file:/D:/starcraft2-2.0.6.25180-extracted/mods/Swarm.SC2Mod/"/>
   <mod href="file:/D:/TestMap.SC2Map/"/>
</configuration>

The mod above represents parent mod, the mod below represents sub mod, the last mod are the map currently developing. (Note: The order is important)

Open XPath Builder View, select XPath 3.0

oxygenxml-open-xpath-builder.PNG

In xquery folder there are three XQuery scripts:

.xquery description
entry-ancestor-or-self.xquery Find ancestor-or-self of current entry
entry-children.xquery Find children of current entry
entry-descendant.xquery Find descendant of current entry

Because we want to calculate the parent level of the entry <CActorUnit id = "Marine">, open entry-ancestor-or-self.xquery.

Copy all lines except the line beginning with declare namespace *** to XPath Builder View.

oxygenxml-xpath-builder.PNG

Open the file which you want to analyze, eg: D:/TestMap.SC2Map/Base.SC2Data/GameData/ActorData.xml, select <CActorUnit id = "Marine"> (Note: Must select XML element, not attribute)

oxygenxml-select-cactorunit.PNG

Click the Execute XPath button on the XPath Builder View.

Result:

oxygenxml-xpath-result-view.PNG

Clone this wiki locally