Guide

Script errors on 3.0: names that clash with new natives

If a map worked on 2.0 and refuses to load on 3.0, check this first. It is the most mechanical 3.0 break, and it is safe to fix on a copy.

What you see

  • A map that worked on 2.0 does not load on 3.0.x, or returns to the menu.
  • Saving it in the editor shows a pjass or JassHelper error that a name is defined twice.
  • Code written for 3.0.0 later fails with an undeclared function for names such as GetEquippedItem.
Symbol IsItemEquipped multiply defined

Why it happens

Patch 3.0.0 added natives to common.j with plain names such as IsItemEquipped, GetItemTag and UnitEquipItem. Any map that already had its own function or global with one of those names now collides with the game's, and the script no longer compiles.

Patch 3.0.1 then added Blz-prefixed versions of the same natives and announced that the plain names will be removed, without a date. Code that adopted the plain names will break again when they go.

The game also refuses to start a script that declares a native it does not have.

How to fix it

  1. Rename the map's own function, for example IsItemEquipped to MyMap_IsItemEquipped, and every call to it.
  2. In code that uses the new natives, switch to their Blz names.
  3. Compile against the target build's own common.j and Blizzard.j with pjass before you publish.
  4. Library authors: prefix public names so the next patch cannot collide with them.

How WC3 Map Doctor detects it

Rules that look for this
  • Errors
    The map declares a function with the same name as a native added in 3.0.0, so it fails to compile or load.
    BRK-native-name-clash · auto-fix: native-clash-rename
  • Errors
    A function, global or local in the map has the name of a native in the target build's prelude.
    BRK-prelude-name-clash
  • Warnings
    The call uses an unprefixed 3.0.0 native whose removal is announced, so the map stops compiling once it goes.
    BRK-unprefixed-300-call · auto-fix: blz-301-rename
  • Errors
    pjass rejects the script against this build's common.j and Blizzard.j, so the map does not compile.
    GATE-pjass

Operations that fix it on a copy

  • fix.doctor Apply the map doctor's targeted fixes

fix.doctor renames a clashing function to MD_ plus its name and updates every call. It refuses when the name also appears inside a string. The example report shows this exact fix.

Sources

Written in our own words from our lab notes; these are the pages behind them.