HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

use common ai functions

08-04-2006, 11:54 PM#1
Doomhammer
I need to use some of the functions of the common ai, such as
SetUpgrade, GetUpgradeGoldCost...just a few to make things work.
How do I get them to work in my map without importing the whole bulge of common.ai functions?
08-05-2006, 12:03 AM#2
masda70
You will need to import a custom common.j into your map.
For each common.ai native you need, copy its declaration in a new common.j line (preferably at the end of the file).

Example: For GetUpgradeGoldCost use the following line.

Collapse JASS:
native GetUpgradeGoldCost   takes integer id                            returns integer
08-05-2006, 12:15 AM#3
Doomhammer
ok, thanks.

Collapse JASS:
native GetUpgradeGoldCost takes integer id returns integer
native SetUpgrade takes integer id returns boolean
native GetUpgradeLevel takes integer id returns integer
I saved the functions in a new file in JSP called common.j and imported that file into WE.
I still get error messages when saving the map.
08-05-2006, 12:37 AM#4
Naakaloh
I'm not sure what's wrong, but a few suggestions/questions... Does WE load an imported common.j? Did you import it as scripts\common.j? Have tried saving your common.j in a scripts folder in your Warcraft 3 folder? Does importing into an mpq work?
08-05-2006, 01:27 AM#5
masda70
Save your map then reopen it again so that WE can store the new common.j in memory and do not report script errors.
08-05-2006, 01:31 AM#6
Vexorian
I was never able to figure if custom common.j has problems in multiplayer