DocumentationThe purpose of this system is to provide a simple framework for the implementation of custom melee races. It accomplishes this by setting up key components Blizzard should have given since the beginning (at least in a more portable state): the race initialization and victory / defeat conditions.

The approach chosen was one discussed a long time ago, probably on the Power of Corruption boards: letting the user pick their race by means of choosing one of the standard races and setting the handicap to a given value, which would be translated by the system into a particular custom race.

"API"

You create a struct of type CustomRace, with the following constructor:staticmethodcreatetakesstring Name, race Race, real Handicap returns CustomRace

Each of the parameters are described below:

string Name - The name for your race

race Race - The standard race it will be based on (eg, RACE_HUMAN).

real Handicap - The handicap value users need to set so they can pick the race. Accpetable values are 0.5, 0.6, onwards up to 1.0 (which means you can overwrite the standard races too)

You can also create and register a custom race for all handicaps of a single race with:staticmethod createAll takesstring Name, race Race returns CustomRace

You can extend the registration of a custom race to more than one handicap with:method register takesrace Race, real Handicap returnsnothing

Once created, you still need to register its townhall, the workers types (you can have more than one type of worker) and hero(es). You can do it by using the following methods:

method setTownHall takesinteger TownHallId returnsnothing

integer TownHallId - The rawcode of the race's Townhall (eg 'ogre' for Orc Great Hall)

If you've got an AI ready to be implemented, then you've already done the hard part. All this takes is a string for the file path and it takes care of the rest. Custom races that were registered but don't have AI scripts cannot be played by the computer. Of course, you can circumvent this (for whatever silly reason) by using this with a string that doesn't refer to an .ai file ("poop" for example).

method setAIScript takesstring FilePath returnsnothing

string FilePath - The filepath of the .ai script, either in an MPQ or imported to the map

Finally, if your race needs extended initialization beyond the creation of worker units, you can do so by assigning a custom callback function that will run after all the initial units are created; this might be useful to replicate behaviour like the initial Haunted Goldmine the Undead start with, or the Entagled Goldmine for the Night Elves. For that you use the following method:

method setCallback takes CustomRaceCall callback returnsnothing

CustomRaceCall callback - A function that matches the CustomRaceCall function interface. More on that below.

The CustomRaceCall function interface is used for the aforementioned callback. It is defined as follows:

What's this site?

Here is the place where making your favorite games can be possible, with the support of a cordial and warm community. Here you will find resources that will help you develop your projects in an effective and agile way. In addition, you can show your projects, share your ideas or simply contribute with resources to establish bonds with a growing community, forming in the process the network of fanatic users to do Modding and mapping Warcraft 3.