• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[AI] Unit names in Jass AI

Status
Not open for further replies.
Level 10
Joined
Oct 28, 2012
Messages
228
Hey, so I am trying to get my campaign AI working via JASS and I am stuck at one thing - I understand the code and what it does, but I don't know how to get the unit's names.

F.e.

call SetBuildUnit ( 1, DRUID_CLAW )

It is DRUID_CLAW instead of DRUID_OF_THE_CLAW obviously and I figured out these names are stored in "common.ai" file.

How can I get this script working with my brand new unit? I want to have AI controlling a completely new race.

And one more thing, why there is

call CampaignAI(CHAOS_BURROW,null)
call CampaignAI(MOON_WELL,null)
call CampaignAI(ZIGGURAT_1,null)

How can I know what name to use when I have my own food-producing building with my own name in the new race?

Thanks in advance for your time! :)
 
Level 16
Joined
Apr 20, 2014
Messages
524
Each units has also a code, like h601.
In your World Editor, object editor, press ctrl+D to get the name in code formats.

Then you have to write :
call SetBuildUnit( 2, 'h601')
 
Level 12
Joined
Jun 15, 2016
Messages
472
Another thing, the unit names you saw are actually global variables created in the wc# common.ai file. These names are much easier to use rather then memorizing what each unit rawcode means. You can see the variable names here: http://jass.sourceforge.net/doc/api/common_ai-source.shtml/ . For example:


JASS:
   //--------------------------------------------------------------------
   //  HUMANS
   //--------------------------------------------------------------------

   // human heroes
    constant integer ARCHMAGE           = 'Hamg'
    constant integer PALADIN            = 'Hpal'
    constant integer MTN_KING           = 'Hmkg'
    constant integer BLOOD_MAGE         = 'Hblm'

   // human hero abilities
    constant integer AVATAR             = 'AHav'
    constant integer BASH               = 'AHbh'
    constant integer THUNDER_BOLT       = 'AHtb'
    constant integer THUNDER_CLAP       = 'AHtc'

    constant integer DEVOTION_AURA      = 'AHad'
    constant integer DIVINE_SHIELD      = 'AHds'
    constant integer HOLY_BOLT          = 'AHhb'
    constant integer RESURRECTION       = 'AHre'

    constant integer BLIZZARD           = 'AHbz'
    constant integer BRILLIANCE_AURA    = 'AHab'
    constant integer MASS_TELEPORT      = 'AHmt'
    constant integer WATER_ELEMENTAL    = 'AHwe'

    constant integer BANISH             = 'AHbn'
    constant integer FLAME_STRIKE       = 'AHfs'
    constant integer SUMMON_PHOENIX     = 'AHpx'
    constant integer SIPHON_MANA        = 'AHdr'

   // special human heroes
    constant integer JAINA              = 'Hjai'
    constant integer MURADIN            = 'Hmbr'
    constant integer GARITHOS           = 'Hlgr'
    constant integer KAEL               = 'Hkal'

   // human units
    constant integer COPTER             = 'hgyr'
    constant integer GYRO               =  COPTER
    constant integer ELEMENTAL          = 'hwat'
    constant integer FOOTMAN            = 'hfoo'
    constant integer FOOTMEN            =  FOOTMAN
    constant integer GRYPHON            = 'hgry'
    constant integer KNIGHT             = 'hkni'
    constant integer MORTAR             = 'hmtm'
    constant integer PEASANT            = 'hpea'
    constant integer PRIEST             = 'hmpr'
    constant integer RIFLEMAN           = 'hrif'
    constant integer RIFLEMEN           =  RIFLEMAN
    constant integer SORCERESS          = 'hsor'
    constant integer TANK               = 'hmtt'
    constant integer STEAM_TANK         =  TANK
    constant integer ROCKET_TANK        = 'hrtt'
    constant integer MILITIA            = 'hmil'
    constant integer SPELL_BREAKER      = 'hspt'
    constant integer HUMAN_DRAGON_HAWK  = 'hdhw'

   // special human units
    constant integer BLOOD_PRIEST       = 'hbep'
    constant integer BLOOD_SORCERESS    = 'hbes'
    constant integer BLOOD_PEASANT      = 'nhew'

   // human buildings
    constant integer AVIARY             = 'hgra'
    constant integer BARRACKS           = 'hbar'
    constant integer BLACKSMITH         = 'hbla'
    constant integer CANNON_TOWER       = 'hctw'
    constant integer CASTLE             = 'hcas'
    constant integer CHURCH             = 'htws'
    constant integer MAGE_TOWER         =  CHURCH
    constant integer GUARD_TOWER        = 'hgtw'
    constant integer HOUSE              = 'hhou'
    constant integer HUMAN_ALTAR        = 'halt'
    constant integer KEEP               = 'hkee'
    constant integer LUMBER_MILL        = 'hlum'
    constant integer SANCTUM            = 'hars'
    constant integer ARCANE_SANCTUM     =  SANCTUM
    constant integer TOWN_HALL          = 'htow'
    constant integer WATCH_TOWER        = 'hwtw'
    constant integer WORKSHOP           = 'harm'
    constant integer ARCANE_VAULT       = 'hvlt'
    constant integer ARCANE_TOWER       = 'hatw'

   // human upgrades
    constant integer UPG_MELEE          = 'Rhme'
    constant integer UPG_RANGED         = 'Rhra'
    constant integer UPG_ARTILLERY      = 'Rhaa'
    constant integer UPG_ARMOR          = 'Rhar'
    constant integer UPG_GOLD           = 'Rhmi'
    constant integer UPG_MASONRY        = 'Rhac'
    constant integer UPG_SIGHT          = 'Rhss'
    constant integer UPG_DEFEND         = 'Rhde'
    constant integer UPG_BREEDING       = 'Rhan'
    constant integer UPG_PRAYING        = 'Rhpt'
    constant integer UPG_SORCERY        = 'Rhst'
    constant integer UPG_LEATHER        = 'Rhla'
    constant integer UPG_GUN_RANGE      = 'Rhri'
    constant integer UPG_WOOD           = 'Rhlh'
    constant integer UPG_SENTINEL       = 'Rhse'
    constant integer UPG_SCATTER        = 'Rhsr'
    constant integer UPG_BOMBS          = 'Rhgb'
    constant integer UPG_HAMMERS        = 'Rhhb'
    constant integer UPG_CONT_MAGIC     = 'Rhss'
    constant integer UPG_FRAGS          = 'Rhfs'
    constant integer UPG_TANK           = 'Rhrt'
    constant integer UPG_FLAK           = 'Rhfc'
    constant integer UPG_CLOUD          = 'Rhcd'
 
Status
Not open for further replies.
Top