HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Custom units in AI scripts...

06-02-2006, 03:53 PM#1
Sardius
Just wondering if I have custom units/heroes in my map, when I am building my AI scripts, do I just have to use their exact name to include them?

For example, looking at the official ROC campaign AI scripts, I see.

call CampaignDefenderEx( 1,1,1, MALGANIS )

So if I had a custom hero named Kulharin in my maps, would I just have to add a line like.

call CampaignDefenderEx( 1,1,1, KULHARIN )

or is there more I have to do for the script to reckonize the new custom hero?
06-02-2006, 04:03 PM#2
TaintedReality
MALGANIS is a constant integer variable, so no, you would have to use the rawcode for your Kulharin unit.
06-02-2006, 04:11 PM#3
The)TideHunter(
Collapse JASS:
constant integer MALGANIS           = 'Umal

The MALGANIS is just the units rawcode.

Collapse JASS:
function CampaignDefenderEx takes integer easy, integer med, integer hard, integer unitid returns nothing

Notice it takes integer unitid, which MALGANIS is pointing to, so MALGANIS just actually means 'Umal'

so this is what it actually says:
Collapse JASS:
call CampaignDefendEx(1, 1, 1, 'Umal')

You can never refer to a ingame name, they all have there own unique names in some way.

Otherwise, what would happen if you have 100 of the malganis units on the map? (rhetorical question)

To get your units rawcode (unitid), go to object editor, click "View", then Show values as raw data or something, it will say there rawcode next to there name.

Bewear! you must put the rawcode in '' brackets, like 'This', if its not 4 digit its not a rawcode, " for strings, ' for integers
06-03-2006, 01:28 AM#4
Sardius
There are two values that appear here beside the name.

E003:Eevi (Kulharin)

which is the correct value?

thanks.
06-03-2006, 01:43 AM#5
TaintedReality
E003. Eevi is the raw code of the unit he was based off of.
06-03-2006, 03:32 AM#6
Sardius
Thanks!