1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  5. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  8. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Ultimate Hero Pick System 2.0.0.4 (vJass)

Submitted by -Kobas-
This bundle is marked as approved. It works and satisfies the submission rules.
Ultimate Hero Pick System 2.0.0.4 (vJass)
Created by -Kobas-
Link to GUI version
-------------------------------------------------------------------------
Please if you find any errors or bugs report them to me so I can fix them

Screenshot
[​IMG]

Features:
- Easy to understand/edit/import/use.
- Can be mixed with multiboard together.
- Small file size.
- Unique idea, perfect way to show people something new.
- Can support all players.


Code
Code (vJASS):
/************************************************************************
*         Ultimate Hero Pick System
*           version: 2.0.0.4 vJass
*
* Created by: -Kobas-
* Credits: ap0calypse (custom interface models)
*          maghteridon96 (code optimization)
*          Maker (code optimization)
*          PurgeandFire111 (http://www.hiveworkshop.com/forums/jass-resources-412/system-track-205760/)
************************************************************************/


library UltimateHeroPickSystem initializer Init
   
    globals
    /* ---------- core system globals ---------- */
        private hashtable          HASH               = InitHashtable()
        private trigger            TRIG_CLICK_HERO    = CreateTrigger()
        private trigger            TRIG_CLICK_OK      = CreateTrigger()
        private trigger            TRIG_CLICK_RND     = CreateTrigger()
        private trigger            TRIG_RUN_SYSTEM    = CreateTrigger()
        private timer              CAMERA_TIMER       = CreateTimer()
        private camerasetup        CAMERA             = null
       
        /* Special Effect string shown when we click on hero icon */
        private string             SFX_CLICK          = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
        /* Special Effect string shown when we create hero unit */
        private string             SFX_PICK           = "Abilities\\Spells\\Other\\Awaken\\Awaken.mdl"
        /* If set to TRUE it will allow players to pick more than 1 hero */
        private boolean            ALLOW_MULTI_PICK   = false
        /* Number of heroes we can pick in case ALLOW_MULTI_PICK = false */
        private integer            ALLOWED_HERO_NUMBER = 1
        /* Show selection to Enemies */
        private boolean            SHOW_MSG_E          = true
        /* Show selection to Allies */
        private boolean            SHOW_MSG_A          = true
        /* Msg shown when picked */
        private string             P_PICK             = " has choosen "
        /* Msg shown when randomed */
        private string             P_RND              = " has randomed "
       
        private integer      array HEROES_CREATED
        private boolean      array SYSTEM_ENABLED
        private real         array HERO_SPAWN_X
        private real         array HERO_SPAWN_Y
        private integer      array HERO_SELECTED
        private string       array COLOR
       
    /* ---------- end core system globals ---------- */
       
    /* ---------- hero ---------- */
        private integer array      HERO_ID
        private integer            HERO_COUNTER   = 0
           
        private destructable array HERO_MODEL
    /* ---------- end hero ---------- */
       
    /* ---------- stats ---------- */
        private integer      array STATS_ID
        private integer            STATS_COUNTER  = 0
           
        private texttag      array TT_NAME
        private real         array TT_NAME_X
        private real         array TT_NAME_Y
           
        private texttag      array TT_VALUE
        private real         array TT_VALUE_X
        private real         array TT_VALUE_Y
       
        private constant integer STAT_HERONAME      = 1
        private constant integer STAT_HEROCLASS     = 2
        private constant integer STAT_ATTRIBUTES    = 3
        private constant integer STAT_AGILITY       = 4
        private constant integer STAT_INTELLIGENCE  = 5
        private constant integer STAT_STRENGTH      = 6
        private constant integer STAT_STATS         = 7
        private constant integer STAT_ATTACKSPEED   = 8
        private constant integer STAT_ATTACKRANGE   = 9
        private constant integer STAT_ATTACKDAMAGE  = 10
        private constant integer STAT_ARMOR         = 11
        private constant integer STAT_MOVEMENTSPEED = 12
        private constant integer STAT_DESCRIPTION   = 13
    /* ---------- end stats ---------- */
    endglobals
   
    private function GetRealSize takes real size returns real
        return size * 0.023 / 10
    endfunction
   
    function ShowDest takes nothing returns nothing
        call ShowDestructable(GetEnumDestructable(), true)
    endfunction
   
    function HideDest takes nothing returns nothing
        call ShowDestructable(GetEnumDestructable(), false)
    endfunction

    private function ShowSystem takes player p, boolean flag returns nothing
        local integer i = 0
        if GetLocalPlayer() == p then
            if flag then
                call EnumDestructablesInRect(gg_rct_SystemRegion, null, function ShowDest)
                loop
                    exitwhen i > STATS_COUNTER
                    call SetTextTagVisibility(TT_NAME[STATS_ID[i]], true)
                    call SetTextTagVisibility(TT_VALUE[STATS_ID[i]], true)
                    call SetTextTagText(TT_VALUE[STATS_ID[i]], " ", 25.00)
                    set i = i + 1
                endloop
                set i = 0
                loop
                    exitwhen i > HERO_COUNTER
                    call ShowDestructable(HERO_MODEL[HERO_ID[i]], false)
                    set i = i + 1
                endloop
            else
                call EnumDestructablesInRect(gg_rct_SystemRegion, null, function HideDest)
                loop
                    exitwhen i > STATS_COUNTER
                    call SetTextTagVisibility(TT_NAME[STATS_ID[i]], false)
                    call SetTextTagVisibility(TT_VALUE[STATS_ID[i]], false)
                    set i = i + 1
                endloop
            endif
        endif
    endfunction
   
    private function SelectHero takes nothing returns nothing
        local integer fake_id = GetHandleId(GetTriggeringTrackable())
        local integer id = LoadInteger(HASH, fake_id, 0)
        local integer i = 0
        local integer counter = 0
        local real x = LoadReal(HASH, fake_id, 1)
        local real y = LoadReal(HASH, fake_id, 2)
        local string s = ""
       
        loop
            exitwhen counter >12
            if SYSTEM_ENABLED[counter] then
                if GetLocalPlayer() == Player(counter) then
                    set HERO_SELECTED[counter] = id
                    set s = SFX_CLICK
   
                    loop
                        exitwhen i > HERO_COUNTER
                        call ShowDestructable(HERO_MODEL[HERO_ID[i]], false)
                        set i = i + 1
                    endloop
                    call ShowDestructable(HERO_MODEL[id], true)
                   
                    set i = 0
                    loop
                        exitwhen i > STATS_COUNTER
                        call SetTextTagVisibility(TT_VALUE[STATS_ID[i]], true)
                        call SetTextTagText(TT_VALUE[STATS_ID[i]], LoadStr(HASH, id, STATS_ID[i]), GetRealSize(10))
                        set i = i + 1
                    endloop
                endif
                call DestroyEffect(AddSpecialEffect(s,x,y))
            endif
            set counter = counter + 1
        endloop
    endfunction
   
    private function RegisterTrack takes player p, integer id, real x, real y, trigger trig returns nothing
        local trackable tr
        local integer hid
        local string s
        if GetLocalPlayer() == p then
            set s = "war3mapImported\\128x128Track.mdx"
        else
            set s = ""
        endif
        set tr = CreateTrackable(s, x, y, 0.00)
        set hid = GetHandleId(tr)
       
        call SaveInteger(     HASH, hid, 0, id)
        call SaveReal(        HASH, hid, 1, x )
        call SaveReal(        HASH, hid, 2, y )
        call SavePlayerHandle(HASH, hid, 3, p )
       
        call TriggerRegisterTrackableHitEvent(trig, tr)
        set tr = null
    endfunction
   
    private function RegisterHeroStat takes integer hid, integer sid, string value returns nothing
        call SaveStr(HASH, hid, sid, value)
    endfunction
   
    private function RegisterHeroUnit takes integer hid, integer uid returns nothing
        call SaveInteger(HASH, hid, -666, uid)
    endfunction
   
    private function RegisterHero takes integer id, real x, real y, destructable model, integer uid returns nothing
        local integer i = 0
       
        debug if HERO_MODEL[id] != null then
            debug call BJDebugMsg("UltimateHeroPickSystem_RegisterHero [id is already used!]")
            debug return
        debug endif
       
        set HERO_ID[HERO_COUNTER] = id
        set HERO_COUNTER = HERO_COUNTER + 1
       
        set HERO_MODEL[id] = model
       
        loop
            exitwhen i>12
            call RegisterTrack(Player(i), id, x, y, TRIG_CLICK_HERO)
            set i = i + 1
        endloop
        call RegisterHeroUnit(id, uid)
       
        call ShowDestructable(model, false)
    endfunction
   
    private function RegisterStat takes integer id, string name, real x1, real y1, real size1, string value, real x2, real y2, real size2 returns nothing
        debug if TT_NAME[id] != null or TT_VALUE[id] != null then
            debug call BJDebugMsg("UltimateHeroPickSystem_RegisterStat [id is already used!]")
            debug return
        debug endif
       
        set STATS_ID[STATS_COUNTER] = id
        set STATS_COUNTER = STATS_COUNTER + 1

        if name != "" then
            set TT_NAME[id] = CreateTextTag()
            set TT_NAME_X[id] = x1
            set TT_NAME_Y[id] = y1
            call SetTextTagPos(TT_NAME[id], x1, y1, 25.00)
            call SetTextTagText(TT_NAME[id], name, GetRealSize(size1))
            call SetTextTagVisibility(TT_NAME[id], false)
        endif
         
        if value != "" then
            set TT_VALUE[id] = CreateTextTag()
            set TT_VALUE_X[id] = x2
            set TT_VALUE_Y[id] = y2
            call SetTextTagPos(TT_VALUE[id], x2, y2, 25.00)
            call SetTextTagText(TT_VALUE[id], value, GetRealSize(size2))
            call SetTextTagVisibility(TT_VALUE[id], false)
        endif
    endfunction
   
    private function PanCamera takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen i > 12
            if SYSTEM_ENABLED[i] then
               
                if GetLocalPlayer() == Player(i) then
                    call CameraSetupApply(CAMERA, true, true)
                endif
               
            endif
            set i = i + 1
        endloop
    endfunction
   
    private function RunSystem takes nothing returns nothing
        local integer id = GetPlayerId(GetTriggerPlayer())
        if HEROES_CREATED[id] >= ALLOWED_HERO_NUMBER then
            if ALLOW_MULTI_PICK then
                set SYSTEM_ENABLED[id] = true
                call ShowSystem(GetTriggerPlayer(), true)
                call TimerStart(CAMERA_TIMER, 0.03, true, function PanCamera)
            endif
        else
            set SYSTEM_ENABLED[id] = true
            call ShowSystem(GetTriggerPlayer(), true)
            call TimerStart(CAMERA_TIMER, 0.03, true, function PanCamera)
        endif
    endfunction
   
    private function CreateHero takes string hs, player p, integer id returns nothing
        local integer pid = GetPlayerId(p)
        local integer i = 0
        local real x = HERO_SPAWN_X[pid]
        local real y = HERO_SPAWN_Y[pid]
        local string s = ""
        local unit u = null
       
        if HERO_SELECTED[pid] == 0 then
            return
        endif
       
        if HEROES_CREATED[pid] < ALLOWED_HERO_NUMBER then
            set u = CreateUnit(p, LoadInteger(HASH, id, -666), x, y, 0.00)
            set HEROES_CREATED[pid] = HEROES_CREATED[pid] + 1
        endif

        if GetLocalPlayer() == p then
            call ResetToGameCamera(0.00)
            call PanCameraToTimed(x, y, 0.00)
            set s = SFX_PICK
            call SelectUnit(u, true)
        endif
       
        call DestroyEffect(AddSpecialEffect(s,x,y))
        set HERO_SELECTED[pid] = 0
        set SYSTEM_ENABLED[pid] = false

        loop
            exitwhen i > 12
               
            if IsPlayerEnemy(p, Player(i)) and SHOW_MSG_E  then
                call DisplayTimedTextToPlayer(Player(i), 0,0, 5, COLOR[i] + GetPlayerName(p) + "|r" + hs + GetUnitName(u))
            endif
           
            if IsPlayerAlly(p, Player(i)) and SHOW_MSG_A then
                call DisplayTimedTextToPlayer(Player(i), 0,0, 5, COLOR[i] + GetPlayerName(p) + "|r" + hs + GetUnitName(u))
            endif
               
            set i = i + 1
        endloop
       
        call ShowSystem(p, false)
        set u = null
    endfunction
   
    private function HitOk takes nothing returns nothing
        call CreateHero(P_PICK, LoadPlayerHandle(HASH, GetHandleId(GetTriggeringTrackable()), 3), HERO_SELECTED[GetPlayerId(LoadPlayerHandle(HASH, GetHandleId(GetTriggeringTrackable()), 3))])
    endfunction
   
    private function HitRandom takes nothing returns nothing
        call CreateHero(P_RND, LoadPlayerHandle(HASH, GetHandleId(GetTriggeringTrackable()), 3), HERO_ID[GetRandomInt(0, HERO_COUNTER)])
    endfunction
   
    private function Init takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen i > 12
            call TriggerRegisterPlayerEvent(TRIG_RUN_SYSTEM, Player(i), EVENT_PLAYER_END_CINEMATIC)
           
            call ShowSystem(Player(i), false)
            set HERO_SPAWN_X[i] = -1408.00 //X Coordinate, it's value is shown in WE bottom left corner
            set HERO_SPAWN_Y[i] = -1728.00 //Y Coordinate, it's value is shown in WE bottom left corner
           
            call RegisterTrack(Player(i), 666, -2048.00,  1536.00, TRIG_CLICK_OK)
            call RegisterTrack(Player(i), 999, -2560.00,  1536.00, TRIG_CLICK_RND)
           
            set i = i + 1
        endloop
        call TriggerAddAction(TRIG_RUN_SYSTEM, function RunSystem)
        call TriggerAddAction(TRIG_CLICK_HERO, function SelectHero)
        call TriggerAddAction(TRIG_CLICK_RND , function HitRandom)
        call TriggerAddAction(TRIG_CLICK_OK  , function HitOk)
       
        /* system camera */
        set CAMERA = gg_cam_CAMERA    
       
        /* register color codes */
        set COLOR[ 0] = "|c00FF0000" // Red Color Code
        set COLOR[ 1] = "|c000042FF" // Blue Color Code
        set COLOR[ 2] = "|c001CE6B9" // Teal Color Code
        set COLOR[ 3] = "|c00540081" // Purple Color Code
        set COLOR[ 4] = "|c00FFFC01" // Yellow Color Code
        set COLOR[ 5] = "|c00FEBA0E" // Orange Color Code
        set COLOR[ 6] = "|c0020C000" // Green Color Code
        set COLOR[ 7] = "|c00E55BB0" // Pink Color Code
        set COLOR[ 8] = "|c00959697" // Gray Color Code
        set COLOR[ 9] = "|c00FFFFBB" // Light Blue Color Code
        set COLOR[10] = "|c00FF00FF" // Dark Green Color Code
        set COLOR[11] = "|c004E2A04" // Brown Color Code
       
        /* register stats: id     name                n_x      n_y       n_s      value       v_x      v_y      v_s   */
        call RegisterStat( STAT_HERONAME      , "Hero Name:"       , -2592.00, 2368.00,  12.00, "/"        ,  -2304.00, 2368.00, 15.00)
        call RegisterStat( STAT_HEROCLASS     , "Hero Class:"      , -2592.00, 2304.00,  12.00, "/"        ,  -2304.00, 2304.00, 15.00)
       
        call RegisterStat( STAT_ATTRIBUTES    , "Attributes:"      , -2624.00, 2240.00,  12.00, ""         ,      0.00,    0.00,  0.00)
        call RegisterStat( STAT_AGILITY       , "- Agility"        , -2560.00, 2176.00,  10.00, "/"        ,  -2304.00, 2176.00, 10.00)
        call RegisterStat( STAT_INTELLIGENCE  , "- Intelligence"   , -2560.00, 2112.00,  10.00, "/"        ,  -2304.00, 2112.00, 10.00)
        call RegisterStat( STAT_STRENGTH      , "- Strength"       , -2560.00, 2048.00,  10.00, "/"        ,  -2304.00, 2048.00, 10.00)
       
        call RegisterStat( STAT_STATS         , "Stats:"           , -2624.00, 1984.00,  12.00, ""         ,      0.00,    0.00,  0.00)
        call RegisterStat( STAT_ATTACKSPEED   , "- Attack Speed"   , -2560.00, 1920.00,  10.00, "/"        ,  -2304.00, 1920.00, 10.00)
        call RegisterStat( STAT_ATTACKRANGE   , "- Attack Range"   , -2560.00, 1856.00,  10.00, "/"        ,  -2304.00, 1856.00, 10.00)
        call RegisterStat( STAT_ATTACKDAMAGE  , "- Attack Damage"  , -2560.00, 1792.00,  10.00, "/"        ,  -2304.00, 1792.00, 10.00)
        call RegisterStat( STAT_ARMOR         , "- Armor"          , -2560.00, 1728.00,  10.00, "/"        ,  -2304.00, 1728.00, 10.00)
        call RegisterStat( STAT_MOVEMENTSPEED , "- Movement Speed" , -2560.00, 1664.00,  10.00, "/"        ,  -2304.00, 1664.00, 10.00)
       
        call RegisterStat( STAT_DESCRIPTION   , "Description:"     , -1792.00, 1888.00,  12.00, "/"        ,  -1792.00, 1536.00, 10.00)
       
        /* register heroes: id   icon_x    icon_y      model        unit_raw_code  */
        call RegisterHero(  1, -3200.00 , 2432.00, gg_dest_B00D_1022, 'Hamg') // Archmage
        call RegisterHero(  2, -3072.00 , 2432.00, gg_dest_B00J_1299, 'Hblm') // Blood Mage
        call RegisterHero(  3, -2944.00 , 2432.00, gg_dest_B00C_1301, 'Hmkg') // Mountain King
        call RegisterHero(  4, -2816.00 , 2432.00, gg_dest_B00R_1302, 'Hpal') // Paladin
        call RegisterHero(  5, -3200.00 , 2304.00, gg_dest_B00U_1303, 'Obla') // Blademaster
        call RegisterHero(  6, -3072.00 , 2304.00, gg_dest_B00K_1304, 'Ofar') // Far Seer
        call RegisterHero(  7, -2944.00 , 2304.00, gg_dest_B009_1305, 'Oshd') // Shadow Hunter
        call RegisterHero(  8, -2816.00 , 2304.00, gg_dest_B00Q_1307, 'Oshd') // Tauren Chieftain
        call RegisterHero(  9, -3200.00 , 2176.00, gg_dest_B00T_1308, 'Ucrl') // Crypt Lord
        call RegisterHero( 10, -3072.00 , 2176.00, gg_dest_B00S_1309, 'Udea') // Death Knight
        call RegisterHero( 11, -2944.00 , 2176.00, gg_dest_B00P_1310, 'Udre') // Dreadlord
        call RegisterHero( 12, -2816.00 , 2176.00, gg_dest_B00G_1306, 'Ulic') // Lich
        call RegisterHero( 13, -3200.00 , 2048.00, gg_dest_B01H_1314, 'Edem') // Demon Hunter
        call RegisterHero( 14, -3072.00 , 2048.00, gg_dest_B01Y_1313, 'Ekee') // Keeper of the Grove
        call RegisterHero( 15, -2944.00 , 2048.00, gg_dest_B01Z_1312, 'Emoo') // Pristress of the Moon
        call RegisterHero( 16, -2816.00 , 2048.00, gg_dest_B020_1311, 'Ewar') // Warden
       
        /* register hero stat: hero_id, stat_id, stat_value */
        call RegisterHeroStat( 1, STAT_HERONAME      , "|cffc3dbffTenn Flamecaster")
        call RegisterHeroStat( 1, STAT_HEROCLASS     , "|cffc3dbffArchmage")
        call RegisterHeroStat( 1, STAT_AGILITY       , "|cffc3dbff17 + 1.00")
        call RegisterHeroStat( 1, STAT_INTELLIGENCE  , "|cffffcc0019 + 3.20|r")
        call RegisterHeroStat( 1, STAT_STRENGTH      , "|cffc3dbff14 + 1.80")
        call RegisterHeroStat( 1, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 1, STAT_ATTACKRANGE   , "|cffc3dbff600.00")
        call RegisterHeroStat( 1, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 1, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 1, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat( 1, STAT_DESCRIPTION   , "|cffc3dbffMystical Hero, adept at ranged assaults. Can learn Blizzard, Summon Water Elemental, Brilliance Aura and Mass Teleport. |n|n|cffffcc00Attacks land and air units.|r")
       
        call RegisterHeroStat( 2, STAT_HERONAME      , "|cffc3dbffEldin Sunstrider")
        call RegisterHeroStat( 2, STAT_HEROCLASS     , "|cffc3dbffBlood Mage")
        call RegisterHeroStat( 2, STAT_AGILITY       , "|cffc3dbff14 + 1.00")
        call RegisterHeroStat( 2, STAT_INTELLIGENCE  , "|cffffcc0019 + 3.00|r")
        call RegisterHeroStat( 2, STAT_STRENGTH      , "|cffc3dbff18 + 2.00")
        call RegisterHeroStat( 2, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 2, STAT_ATTACKRANGE   , "|cffc3dbff600.00")
        call RegisterHeroStat( 2, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 2, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 2, STAT_MOVEMENTSPEED , "|cffc3dbff300.00")
        call RegisterHeroStat( 2, STAT_DESCRIPTION   , "|cffc3dbffMystical Hero, adept at controlling magic and ranged assaults. Can learn Flame Strike, Banish, Siphon Mana and Phoenix. |n|n|cffffcc00Attacks land and air units.|r")
       
        call RegisterHeroStat( 3, STAT_HERONAME      , "|cffc3dbffBor Stonebreaker")
        call RegisterHeroStat( 3, STAT_HEROCLASS     , "|cffc3dbffMountain King")
        call RegisterHeroStat( 3, STAT_AGILITY       , "|cffc3dbff11 + 1.50")
        call RegisterHeroStat( 3, STAT_INTELLIGENCE  , "|cffc3dbff15 + 1.50|r")
        call RegisterHeroStat( 3, STAT_STRENGTH      , "|cffffcc0024 + 3.00")
        call RegisterHeroStat( 3, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 3, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat( 3, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 3, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 3, STAT_MOVEMENTSPEED , "|cffc3dbff270.00")
        call RegisterHeroStat( 3, STAT_DESCRIPTION   , "|cffc3dbffWarrior Hero, adept at offensive combat and disrupting enemy troops. Can learn Storm Bolt, Thunder Clap, Bash and Avatar. |n|n|cffffcc00Attacks land units.|r")
       
        call RegisterHeroStat( 4, STAT_HERONAME      , "|cffc3dbffGranis Darkhammer")
        call RegisterHeroStat( 4, STAT_HEROCLASS     , "|cffc3dbffPaladin")
        call RegisterHeroStat( 4, STAT_AGILITY       , "|cffc3dbff13 + 1.50")
        call RegisterHeroStat( 4, STAT_INTELLIGENCE  , "|cffc3dbff17 + 1.80|r")
        call RegisterHeroStat( 4, STAT_STRENGTH      , "|cffffcc0022 + 2.70")
        call RegisterHeroStat( 4, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 4, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat( 4, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 4, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 4, STAT_MOVEMENTSPEED , "|cffc3dbff270.00")
        call RegisterHeroStat( 4, STAT_DESCRIPTION   , "|cffc3dbffWarrior Hero, exceptional at defense and augmenting nearby friendly troops. Can learn Holy Light, Divine Shield, Devotion Aura and Resurrection. |n|n|cffffcc00Attacks land units.|r")
       
        call RegisterHeroStat( 5, STAT_HERONAME      , "|cffc3dbffTojara")
        call RegisterHeroStat( 5, STAT_HEROCLASS     , "|cffc3dbffBlademaster")
        call RegisterHeroStat( 5, STAT_AGILITY       , "|cffc3dbff23 + 1.75")
        call RegisterHeroStat( 5, STAT_INTELLIGENCE  , "|cffffcc0016 + 2.25|r")
        call RegisterHeroStat( 5, STAT_STRENGTH      , "|cffc3dbff18 + 2.00")
        call RegisterHeroStat( 5, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 5, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat( 5, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 5, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 5, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat( 5, STAT_DESCRIPTION   , "|cffc3dbffCunning Hero, adept at quickly killing individual units and creating confusion among enemies. Can learn Mirror Image, Wind Walk, Critical Strike and Bladestorm. |n|n|cffffcc00Attacks land units.|r")
       
        call RegisterHeroStat( 6, STAT_HERONAME      , "|cffc3dbffGar'dal Grimsight")
        call RegisterHeroStat( 6, STAT_HEROCLASS     , "|cffc3dbffFar Seer")
        call RegisterHeroStat( 6, STAT_AGILITY       , "|cffc3dbff18 + 1.00")
        call RegisterHeroStat( 6, STAT_INTELLIGENCE  , "|cffffcc0019 + 3.00|r")
        call RegisterHeroStat( 6, STAT_STRENGTH      , "|cffc3dbff15 + 2.00")
        call RegisterHeroStat( 6, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 6, STAT_ATTACKRANGE   , "|cffc3dbff600.00")
        call RegisterHeroStat( 6, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 6, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 6, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat( 6, STAT_DESCRIPTION   , "|cffc3dbffMystical Hero, effective at ranged attacks and scouting. Can learn Chain Lightning, Far Sight, Feral Spirit and Earthquake. |n|n|cffffcc00Attacks land and air units.|r")
       
        call RegisterHeroStat( 7, STAT_HERONAME      , "|cffc3dbffZul'kis")
        call RegisterHeroStat( 7, STAT_HEROCLASS     , "|cffc3dbffShadow Hunter")
        call RegisterHeroStat( 7, STAT_AGILITY       , "|cffffcc0017 + 1.00")
        call RegisterHeroStat( 7, STAT_INTELLIGENCE  , "|cffc3dbff19 + 3.20|r")
        call RegisterHeroStat( 7, STAT_STRENGTH      , "|cffc3dbff14 + 1.80")
        call RegisterHeroStat( 7, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 7, STAT_ATTACKRANGE   , "|cffc3dbff600.00")
        call RegisterHeroStat( 7, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 7, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 7, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat( 7, STAT_DESCRIPTION   , "|cffc3dbffCunning Hero, adept at healing magics and voodoo curses. Can learn Healing Wave, Hex, Serpent Ward and Big Bad Voodoo. |n|n|cffffcc00Attacks land and air units.|r")
       
        call RegisterHeroStat( 8, STAT_HERONAME      , "|cffc3dbffMarn Thunderhorn")
        call RegisterHeroStat( 8, STAT_HEROCLASS     , "|cffc3dbffTauren Chieftain")
        call RegisterHeroStat( 8, STAT_AGILITY       , "|cffc3dbff17 + 1.00")
        call RegisterHeroStat( 8, STAT_INTELLIGENCE  , "|cffc3dbff19 + 3.20|r")
        call RegisterHeroStat( 8, STAT_STRENGTH      , "|cffffcc0014 + 1.80")
        call RegisterHeroStat( 8, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 8, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat( 8, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 8, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 8, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat( 8, STAT_DESCRIPTION   , "|cffc3dbffWarrior Hero, exceptional at absorbing damage and melee combat. Can learn Shockwave, War Stomp, Endurance Aura and Reincarnation. |n|n|cffffcc00Attacks land units.|r")
       
        call RegisterHeroStat( 9, STAT_HERONAME      , "|cffc3dbffThebis-Ra")
        call RegisterHeroStat( 9, STAT_HEROCLASS     , "|cffc3dbffCrypt Lord")
        call RegisterHeroStat( 9, STAT_AGILITY       , "|cffffcc0017 + 1.00")
        call RegisterHeroStat( 9, STAT_INTELLIGENCE  , "|cffc3dbff19 + 3.20|r")
        call RegisterHeroStat( 9, STAT_STRENGTH      , "|cffc3dbff14 + 1.80")
        call RegisterHeroStat( 9, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat( 9, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat( 9, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat( 9, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat( 9, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat( 9, STAT_DESCRIPTION   , "|cffc3dbffWarrior Hero, adept at summoning insect minions and crushing enemies. Can learn Impale, Spiked Carapace, Carrion Beetles and Locust Swarm. |n|n|cffffcc00Attacks land units.|r")
       
        call RegisterHeroStat(10, STAT_HERONAME      , "|cffc3dbffLord Nightsorrow")
        call RegisterHeroStat(10, STAT_HEROCLASS     , "|cffc3dbffDeath Knight")
        call RegisterHeroStat(10, STAT_AGILITY       , "|cffc3dbff17 + 1.00")
        call RegisterHeroStat(10, STAT_INTELLIGENCE  , "|cffc3dbff19 + 3.20|r")
        call RegisterHeroStat(10, STAT_STRENGTH      , "|cffffcc0014 + 1.80")
        call RegisterHeroStat(10, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat(10, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat(10, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat(10, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat(10, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat(10, STAT_DESCRIPTION   , "|cffc3dbffWarrior Hero, evil counterpart to the Human Paladin. Can learn Death Coil, Death Pact, Unholy Aura, and Animate Dead. |n|n|cffffcc00Attacks land units.|r")
       
        call RegisterHeroStat(11, STAT_HERONAME      , "|cffc3dbffTerrordar")
        call RegisterHeroStat(11, STAT_HEROCLASS     , "|cffc3dbffDreadlord")
        call RegisterHeroStat(11, STAT_AGILITY       , "|cffc3dbff17 + 1.00")
        call RegisterHeroStat(11, STAT_INTELLIGENCE  , "|cffc3dbff19 + 3.20|r")
        call RegisterHeroStat(11, STAT_STRENGTH      , "|cffffcc0014 + 1.80")
        call RegisterHeroStat(11, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat(11, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat(11, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat(11, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat(11, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat(11, STAT_DESCRIPTION   , "|cffc3dbffCunning Hero, adept at controlling combat. Can learn Carrion Swarm, Sleep, Vampiric Aura, and Inferno. |n|n|cffffcc00Attacks land units.|r")
       
        call RegisterHeroStat(12, STAT_HERONAME      , "|cffc3dbffOrdin Frostbane")
        call RegisterHeroStat(12, STAT_HEROCLASS     , "|cffc3dbffLich")
        call RegisterHeroStat(12, STAT_AGILITY       , "|cffc3dbff17 + 1.00")
        call RegisterHeroStat(12, STAT_INTELLIGENCE  , "|cffffcc0019 + 3.20|r")
        call RegisterHeroStat(12, STAT_STRENGTH      , "|cffc3dbff14 + 1.80")
        call RegisterHeroStat(12, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat(12, STAT_ATTACKRANGE   , "|cffc3dbff600.00")
        call RegisterHeroStat(12, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat(12, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat(12, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat(12, STAT_DESCRIPTION   , "|cffc3dbffMystical Hero, particularly adept at cold magic. Can learn Frost Armor, Frost Nova, Dark Ritual and Death And Decay. |n|n|cffffcc00Attacks land and air units.|r")
       
        call RegisterHeroStat(13, STAT_HERONAME      , "|cffc3dbffShadowsong")
        call RegisterHeroStat(13, STAT_HEROCLASS     , "|cffc3dbffDemon Hunter")
        call RegisterHeroStat(13, STAT_AGILITY       , "|cffffcc0017 + 1.00")
        call RegisterHeroStat(13, STAT_INTELLIGENCE  , "|cffc3dbff19 + 3.20|r")
        call RegisterHeroStat(13, STAT_STRENGTH      , "|cffc3dbff14 + 1.80")
        call RegisterHeroStat(13, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat(13, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat(13, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat(13, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat(13, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat(13, STAT_DESCRIPTION   , "|cffc3dbffCunning Hero, adept at maneuvering through battles. Can learn Immolation, Evasion, Mana Burn, and Metamorphosis. |n|n|cffffcc00Attacks land units.|r")
       
        call RegisterHeroStat(14, STAT_HERONAME      , "|cffc3dbffLarodar")
        call RegisterHeroStat(14, STAT_HEROCLASS     , "|cffc3dbffKeeper of the Grove")
        call RegisterHeroStat(14, STAT_AGILITY       , "|cffc3dbff17 + 1.00")
        call RegisterHeroStat(14, STAT_INTELLIGENCE  , "|cffffcc0019 + 3.20|r")
        call RegisterHeroStat(14, STAT_STRENGTH      , "|cffc3dbff14 + 1.80")
        call RegisterHeroStat(14, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat(14, STAT_ATTACKRANGE   , "|cffc3dbff600.00")
        call RegisterHeroStat(14, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat(14, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat(14, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat(14, STAT_DESCRIPTION   , "|cffc3dbffMystical Hero, adept at using nature spells. Can learn Entangling Roots, Force of Nature, Thorns Aura, and Tranquility. |n|n|cffffcc00Attacks land and air units.|r")
       
        call RegisterHeroStat(15, STAT_HERONAME      , "|cffc3dbffKathris Starsong")
        call RegisterHeroStat(15, STAT_HEROCLASS     , "|cffc3dbffPristress of the Moon")
        call RegisterHeroStat(15, STAT_AGILITY       , "|cffffcc0017 + 1.00")
        call RegisterHeroStat(15, STAT_INTELLIGENCE  , "|cffc3dbff19 + 3.20|r")
        call RegisterHeroStat(15, STAT_STRENGTH      , "|cffc3dbff14 + 1.80")
        call RegisterHeroStat(15, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat(15, STAT_ATTACKRANGE   , "|cffc3dbff600.00")
        call RegisterHeroStat(15, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat(15, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat(15, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat(15, STAT_DESCRIPTION   , "|cffc3dbffWarrior Hero, adept at enhancing ranged attacks and slaying enemies from afar. Can learn Scout, Searing Arrows, Trueshot Aura, and Starfall. |n|n|cffffcc00Attacks land and air units.|r")
       
        call RegisterHeroStat(16, STAT_HERONAME      , "|cffc3dbffAlsa Iron-cell")
        call RegisterHeroStat(16, STAT_HEROCLASS     , "|cffc3dbffWarden")
        call RegisterHeroStat(16, STAT_AGILITY       , "|cffffcc0017 + 1.00")
        call RegisterHeroStat(16, STAT_INTELLIGENCE  , "|cffc3dbff19 + 3.20|r")
        call RegisterHeroStat(16, STAT_STRENGTH      , "|cffc3dbff14 + 1.80")
        call RegisterHeroStat(16, STAT_ATTACKSPEED   , "|cffc3dbff2.13")
        call RegisterHeroStat(16, STAT_ATTACKRANGE   , "|cffc3dbff128.00 |cffffcc00(melee)")
        call RegisterHeroStat(16, STAT_ATTACKDAMAGE  , "|cffc3dbff21 - 27 |cffffcc00(Hero)")
        call RegisterHeroStat(16, STAT_ARMOR         , "|cffc3dbff3 |cffffcc00(Hero)")
        call RegisterHeroStat(16, STAT_MOVEMENTSPEED , "|cffc3dbff320.00")
        call RegisterHeroStat(16, STAT_DESCRIPTION   , "|cffc3dbffCunning Hero, adept at entering and escaping combat. Can learn Blink, Fan of Knives, Shadow Strike and Vengeance. |n|n|cffffcc00Attacks land units.|r")
    endfunction
endlibrary


Change Log

Version 1.0
- Uploaded Spell
Version 1.1
- Removed some useless variables
- Added some more documentation
Version 1.2
- Replaced vJass Globals with User Defined Globals (udg)
- Added some more documentation
Version 1.3
- Fixed bug with fast clicking and choosing few heroes at once
- Replaced location variables with coordinates (X and Y)
- Removed some useless lines of code
- Added 3 new Icons (Heroes) to pick (Tauren Chieftain, Dreadlord, Far Seer)
- Few more small changes
Version 1.4
- Fixed that Settings trigger
Version 1.5
- Some optimization
Version 2.0.0.0
- Jass -> vJass
- Replaced huge and bad code with fast and optimized one
- Works for all players
Version 2.0.0.1
- Added Magtheridon96 suggestion for constant globals
Version 2.0.0.2
- Some basic optimization
- globals are now all UPERCASE
- Added MSG display
Version 2.0.0.3
- You can now enable disable multi hero pick
Version 2.0.0.4
- Fixed: If I select Pick hero when no hero has been selected, a special effect is still created.
- Fixed: I can get two heroes if I click random really quickly


Keywords:
Advanced, vJass, Hero, Pick, System, -Kobas-, Interface, Triggers
Contents

Ultimate Hero Pick System (Map)

Reviews
Moderator
23:43 Dec 7, 2012 Magtheridon96: Approved. Wonderful. =) If you would like an extended review, feel free to PM me.
  1. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    The goodness of using units instead of trackables... awesome...
     
  2. Undeadducky

    Undeadducky

    Joined:
    Oct 27, 2011
    Messages:
    13
    Resources:
    0
    Resources:
    0
    Awesome I will test This Out Looks Epic 100000/5
     
  3. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,193
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    You could disable entering the selection screen if the player already has a hero. You could consider repick option.

    I'm not a fan of using a terrain type for the black. It limits the number of tiles available. Instead, try:
    Code (vJASS):

    local image i = CreateImage("Textures\\Black32.blp", 2000, 2000, 0, -3300, 1400, 0, 0, 0, 0, 2)
    call SetImageRenderAlways(i , true)
     


    And then show/hide it locally.

    The 2000, 2000 is the width (x) and height (y). The -3300 and 1400 are the coordinates of the lower left corner of the image. 2 is image type. Don't use 1, since that gets drawn over effects I believe. You can test 3 and 4 also, but I believe 2 should work.

    I can select the unit in the screen are, when not in the screen mode. I can get more heroes.

    gg_trg_UHPS_Camera_Setup trigger loops even when no units are in the screen. That is a no-no.

    Add
    call CameraSetupApplyForceDuration(udg_UHPSCamera, true, 0)
    to
    function Trig_UHPS_Progress_Actions
    so the camera pans instantly, and not over 0.1 seconds when the player enter the screen.

    If I select Pick hero when no hero has been selected, a special effect is still created.

    That's all for now, I'll take a look at the coding some more later. Keep on improving this, it is a great system.
     
  4. Marcos DAB

    Marcos DAB

    Joined:
    Mar 26, 2011
    Messages:
    1,041
    Resources:
    218
    Models:
    1
    Icons:
    214
    Spells:
    2
    Tutorials:
    1
    Resources:
    218
    Its too hard to implement...
     
  5. Apheraz Lucent

    Apheraz Lucent

    Joined:
    Jan 31, 2010
    Messages:
    3,312
    Resources:
    4
    Tutorials:
    4
    Resources:
    4
    Subscribing. I am looking forward to see this in LW. Keep up the good work, -Kobas-!

    Anyways, make the interface change icon removable in the code (True, False boolean). Not all of us needs it. Usage of five different fonts is just... Ugh.
     
  6. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,894
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    Well you can remove whole trigger and that button with few trigger actions in setup trigger and that's it :)

    But I will try to optimize this completely, for now you are free to experiment with it.
     
  7. Apheraz Lucent

    Apheraz Lucent

    Joined:
    Jan 31, 2010
    Messages:
    3,312
    Resources:
    4
    Tutorials:
    4
    Resources:
    4
    Try to use some polishing in here, too. Rather than a spam of a single effect, wonders can be performed with few different.
     
  8. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,894
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    Hmmmmm I started working on this once again, because lately a lot of people asked from me edited GUI version.

    New one will be coded in vJass and so far code looks far more easier and faster than this one.
    In just 1 day I re-coded 90% of whole system, simple library replaced all those triggers and shits.
    Hmmm only thing left is to setup each hero, store stats and other values into variables and so on, but it should be finished in no time.
    I will create GUI trigger as well so you can easily edit this even if you don't know jass.

    It has 16 heroes, 1 interface for all players, you can still use multiboard with this, basic setup and so on...
     
  9. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Lovely, gimme a call if you need any help :)
     
  10. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,894
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    I will share code tomorrow before I actually update resource :)
    Any help is appreciated :)
     
  11. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Post a link in VM when you do and I'll check it out for sure.
     
  12. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,894
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    Code (vJASS):
    /*--------------------------------------------------------------------
    /         Ultimate Hero Pick System
    /           version: 2.0.0.0 vJass
    /
    / Created by: -Kobas-
    / Credits: ap0calypse (custom interface models)
    /          maghteridon96 (code optimization)
    /          Maker (code optimization)
    /          PurgeandFire111 ([url]http://www.hiveworkshop.com/forums/jass-resources-412/system-track-205760/[/url])
    /--------------------------------------------------------------------*/


    library UltimateHeroPickSystem initializer Init
       
        globals
        /* core system globals */
            private hashtable          hash            = InitHashtable()
            private trigger            trig_click_hero = CreateTrigger()
            private trigger            trig_click_ok   = CreateTrigger()
            private trigger            trig_click_rnd  = CreateTrigger()
            private trigger            trig_run_system = CreateTrigger()
            private timer              camera_timer    = CreateTimer()
            private camerasetup        camera          = null
            private string             sfx_click       = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl"
            private string             sfx_pick        = "Abilities\\Spells\\Other\\Awaken\\Awaken.mdl"
           
            private boolean      array system_enabled
            private real         array hero_spawn_x
            private real         array hero_spawn_y
            private integer      array hero_selected
            private string       array color
        /* end core system globals */
           
        /* hero */
            private integer array      hero_id
            private integer            hero_counter   = 0
               
            private destructable array hero_model
        /* end hero */
           
        /* stats */
            private integer      array stats_id
            private integer            stats_counter  = 0
               
            private string       array stats_name
            private texttag      array tt_name
            private real         array tt_name_x
            private real         array tt_name_y
               
            private string       array stats_value
            private texttag      array tt_value
            private real         array tt_value_x
            private real         array tt_value_y
        /* end stats */
        endglobals
       
        private function GetRealSize takes real size returns real
            return size * 0.023 / 10
        endfunction
       
        function ShowDest takes nothing returns nothing
            call ShowDestructable(GetEnumDestructable(), true)
        endfunction
       
        function HideDest takes nothing returns nothing
            call ShowDestructable(GetEnumDestructable(), false)
        endfunction

        private function ShowSystem takes player p, boolean flag returns nothing
            local integer i = 0
            if GetLocalPlayer() == p then
                if flag then
                    call EnumDestructablesInRect(gg_rct_SystemRegion, null, function ShowDest)
                    loop
                        exitwhen i > stats_counter
                        call SetTextTagVisibility(tt_name[stats_id[i]], true)
                        call SetTextTagVisibility(tt_value[stats_id[i]], true)
                        call SetTextTagText(tt_value[stats_id[i]], " ", 25.00)
                        set i = i + 1
                    endloop
                    set i = 0
                    loop
                        exitwhen i > hero_counter
                        call ShowDestructable(hero_model[hero_id[i]], false)
                        set i = i + 1
                    endloop
                else
                    call EnumDestructablesInRect(gg_rct_SystemRegion, null, function HideDest)
                    loop
                        exitwhen i > stats_counter
                        call SetTextTagVisibility(tt_name[stats_id[i]], false)
                        call SetTextTagVisibility(tt_value[stats_id[i]], false)
                        set i = i + 1
                    endloop
                endif
            endif
        endfunction
       
        private function SelectHero takes nothing returns nothing
            local integer fake_id = GetHandleId(GetTriggeringTrackable())
            local integer id = LoadInteger(hash, fake_id, 0)
            local integer i = 0
            local integer counter = 0
            local real x = LoadReal(hash, fake_id, 1)
            local real y = LoadReal(hash, fake_id, 2)
            local string s = ""
           
            loop
                exitwhen counter >12
                if system_enabled[counter] then
                    if GetLocalPlayer() == Player(counter) then
                        set hero_selected[counter] = id
                        set s = sfx_click
       
                        loop
                            exitwhen i > hero_counter
                            call ShowDestructable(hero_model[hero_id[i]], false)
                            set i = i + 1
                        endloop
                        call ShowDestructable(hero_model[id], true)
                       
                        set i = 0
                        loop
                            exitwhen i > stats_counter
                            call SetTextTagVisibility(tt_value[stats_id[i]], true)
                            call SetTextTagText(tt_value[stats_id[i]], LoadStr(hash, id, stats_id[i]), GetRealSize(10))
                            set i = i + 1
                        endloop
                    endif
                    call DestroyEffect(AddSpecialEffect(s,x,y))
                endif
                set counter = counter + 1
            endloop
        endfunction
       
        private function RegisterTrack takes player p, integer id, real x, real y, trigger trig returns nothing
            local trackable tr
            local string s
            if GetLocalPlayer() == p then
                set s = "war3mapImported\\128x128Track.mdx"
            else
                set s = ""
            endif
            set tr = CreateTrackable(s, x, y, 0.00)

            call SaveInteger(hash, GetHandleId(tr), 0, id)
            call SaveReal(hash, GetHandleId(tr), 1, x)
            call SaveReal(hash, GetHandleId(tr), 2, y)
            call SavePlayerHandle(hash, GetHandleId(tr), 3, p)
           
            call TriggerRegisterTrackableHitEvent(trig, tr)
            set tr = null
        endfunction
       
        private function RegisterHeroStat takes integer hero_id, integer stat_id, string value returns nothing
            call SaveStr(hash, hero_id, stat_id, value)
        endfunction
       
        private function RegisterHeroUnit takes integer hero_id, integer unit_id returns nothing
            call SaveInteger(hash, hero_id, -666, unit_id)
        endfunction
       
        private function RegisterHero takes integer id, real x, real y, destructable model, integer unit_id returns nothing
            local integer i = 0
            if hero_model[id] != null then
                call BJDebugMsg("UltimateHeroPickSystem_RegisterHero [id is already used!]")
                return
            endif
            set hero_id[hero_counter] = id
            set hero_counter = hero_counter + 1
           
            set hero_model[id] = model
           
            loop
                exitwhen i>12
                call RegisterTrack(Player(i), id, x, y, trig_click_hero)
                set i = i + 1
            endloop
            call RegisterHeroUnit(id, unit_id)
           
            call TriggerAddAction(trig_click_hero, function SelectHero)
            call ShowDestructable(model, false)
        endfunction
       
        private function RegisterStat takes integer id, string name, real x1, real y1, real size1, string value, real x2, real y2, real size2 returns nothing
            if tt_name[id] != null or tt_value[id] != null then
                call BJDebugMsg("UltimateHeroPickSystem_RegisterStat [id is already used!]")
                return
            endif
           
            set stats_id[stats_counter] = id
            set stats_counter = stats_counter + 1

            if name != "" then
                set stats_name[id] = name
                set tt_name[id] = CreateTextTag()
                set tt_name_x[id] = x1
                set tt_name_y[id] = y1
                call SetTextTagPos(tt_name[id], x1, y1, 25.00)
                call SetTextTagText(tt_name[id], name, GetRealSize(size1))
                call SetTextTagVisibility(tt_name[id], false)
            endif
             
            if value != "" then
                set stats_value[id] = value
                set tt_value[id] = CreateTextTag()
                set tt_value_x[id] = x2
                set tt_value_y[id] = y2
                call SetTextTagPos(tt_value[id], x2, y2, 25.00)
                call SetTextTagText(tt_value[id], value, GetRealSize(size2))
                call SetTextTagVisibility(tt_value[id], false)
            endif
        endfunction
       
        private function PanCamera takes nothing returns nothing
            local integer i = 0
            loop
                exitwhen i > 12
                if system_enabled[i] then
                   
                    if GetLocalPlayer() == Player(i) then
                        call CameraSetupApply(camera, true, true)
                    endif
                   
                endif
                set i = i + 1
            endloop
        endfunction
       
        private function RunSystem takes nothing returns nothing
            set system_enabled[GetPlayerId(GetTriggerPlayer())] = true
            call ShowSystem(GetTriggerPlayer(), true)
            call TimerStart(camera_timer, 0.03, true, function PanCamera)
        endfunction
       
        private function CreateHero takes player p, integer id returns nothing
            local real x = hero_spawn_x[GetPlayerId(p)]
            local real y = hero_spawn_y[GetPlayerId(p)]
            local unit u = CreateUnit(p, LoadInteger(hash, id, -666), x, y, 0.00)
            local string s = ""
            call ShowSystem(p, false)
            if GetLocalPlayer() == p then
                call ResetToGameCamera(0.00)
                call PanCameraToTimed(x, y, 0.00)
                set s = sfx_pick
                call SelectUnit(u, true)
            endif
            call DestroyEffect(AddSpecialEffect(s,x,y))
            set hero_selected[GetPlayerId(p)] = 0
            set u = null
        endfunction
       
        private function HitOk takes nothing returns nothing
            local integer i = 0
            local player p = LoadPlayerHandle(hash, GetHandleId(GetTriggeringTrackable()), 3)
            loop
                exitwhen i > 12
                if system_enabled[i] then
                    set system_enabled[i] = false
                    call CreateHero(p, hero_selected[GetPlayerId(p)])
                endif
                set i = i + 1
            endloop
           
        endfunction
       
        private function HitRandom takes nothing returns nothing
            local integer i = 0
            local player p = LoadPlayerHandle(hash, GetHandleId(GetTriggeringTrackable()), 3)
            loop
                exitwhen i > 12
                if system_enabled[i] then
                    set system_enabled[i] = false
                    call CreateHero(p, hero_id[GetRandomInt(0, hero_counter)])
                endif
                set i = i + 1
            endloop
        endfunction
       
        private function Init takes nothing returns nothing
            local integer i = 0
            loop
                exitwhen i > 12
                call TriggerRegisterPlayerEvent(trig_run_system, Player(i), EVENT_PLAYER_END_CINEMATIC)
               
                call ShowSystem(Player(i), false)
                set hero_spawn_x[i] = GetStartLocationX(GetPlayerStartLocation(Player(i)))
                set hero_spawn_y[i] = GetStartLocationY(GetPlayerStartLocation(Player(i)))
               
                call RegisterTrack(Player(i), 666, -2048.00,  1536.00, trig_click_ok)
                call RegisterTrack(Player(i), 999, -2560.00,  1536.00, trig_click_rnd)
                set i = i + 1
            endloop
            call TriggerAddAction(trig_run_system, function RunSystem)
            call TriggerAddAction(trig_click_rnd , function HitRandom)
            call TriggerAddAction(trig_click_ok  , function HitOk)
           
            /* system camera */
            set camera = gg_cam_CAMERA    
           
            /* register color codes */
            set color[ 0] = "|c00FF0000" // Red Color Code
            set color[ 1] = "|c000042FF" // Blue Color Code
            set color[ 2] = "|c001CE6B9" // Teal Color Code
            set color[ 3] = "|c00540081" // Purple Color Code
            set color[ 4] = "|c00FFFC01" // Yellow Color Code
            set color[ 5] = "|c00FEBA0E" // Orange Color Code
            set color[ 6] = "|c0020C000" // Green Color Code
            set color[ 7] = "|c00E55BB0" // Pink Color Code
            set color[ 8] = "|c00959697" // Gray Color Code
            set color[ 9] = "|c00FFFFBB" // Light Blue Color Code
            set color[10] = "|c00FF00FF" // Dark Green Color Code
            set color[11] = "|c004E2A04" // Brown Color Code
           
            /* register stats: id     name                n_x      n_y       n_s      value       v_x      v_y      v_s   */
            call RegisterStat(  1, "Hero Name:"       , -2592.00, 2368.00,  12.00, "/"        ,  -2304.00, 2368.00, 15.00)
            call RegisterStat(  2, "Hero Class:"      , -2592.00, 2304.00,  12.00, "/"        ,  -2304.00, 2304.00, 15.00)
           
            call RegisterStat(  3, "Attributes:"      , -2624.00, 2240.00,  12.00, ""         ,      0.00,    0.00,  0.00)
            call RegisterStat(  4, "- Agility"        , -2560.00, 2176.00,  10.00, "/"        ,  -2304.00, 2176.00, 10.00)
            call RegisterStat(  5, "- Intelligence"   , -2560.00, 2112.00,  10.00, "/"        ,  -2304.00, 2112.00, 10.00)
            call RegisterStat(  6, "- Strength"       , -2560.00, 2048.00,  10.00, "/"        ,  -2304.00, 2048.00, 10.00)
           
            call RegisterStat(  7, "Stats:"           , -2624.00, 1984.00,  12.00, ""         ,      0.00,    0.00,  0.00)
            call RegisterStat(  8, "- Attack Speed"   , -2560.00, 1920.00,  10.00, "/"        ,  -2304.00, 1920.00, 10.00)
            call RegisterStat(  9, "- Attack Range"   , -2560.00, 1856.00,  10.00, "/"        ,  -2304.00, 1856.00, 10.00)
            call RegisterStat( 10, "- Attack Damage"  , -2560.00, 1792.00,  10.00, "/"        ,  -2304.00, 1792.00, 10.00)
            call RegisterStat( 11, "- Armor"          , -2560.00, 1728.00,  10.00, "/"        ,  -2304.00, 1728.00, 10.00)
            call RegisterStat( 12, "- Movement Speed" , -2560.00, 1664.00,  10.00, "/"        ,  -2304.00, 1664.00, 10.00)
           
            call RegisterStat( 13, "Description:"     , -1792.00, 1888.00,  12.00, "/"        ,  -1792.00, 1536.00, 10.00)
           
            /* register heroes: id   icon_x    icon_y      model        unit_raw_code  */
            call RegisterHero(  1, -3200.00 , 2432.00, gg_dest_B00D_1022, 'Hamg') // Archmage
            call RegisterHero(  2, -3072.00 , 2432.00, gg_dest_B00J_1299, 'Hblm') // Blood Mage
            call RegisterHero(  3, -2944.00 , 2432.00, gg_dest_B00C_1301, 'Hmkg') // Mountain King
            call RegisterHero(  4, -2816.00 , 2432.00, gg_dest_B00R_1302, 'Hpal') // Paladin
            call RegisterHero(  5, -3200.00 , 2304.00, gg_dest_B00U_1303, 'Obla') // Blademaster
            call RegisterHero(  6, -3072.00 , 2304.00, gg_dest_B00K_1304, 'Ofar') // Far Seer
            call RegisterHero(  7, -2944.00 , 2304.00, gg_dest_B009_1305, 'Oshd') // Shadow Hunter
            call RegisterHero(  8, -2816.00 , 2304.00, gg_dest_B00Q_1307, 'Oshd') // Tauren Chieftain
            call RegisterHero(  9, -3200.00 , 2176.00, gg_dest_B00T_1308, 'Ucrl') // Crypt Lord
            call RegisterHero( 10, -3072.00 , 2176.00, gg_dest_B00S_1309, 'Udea') // Death Knight
            call RegisterHero( 11, -2944.00 , 2176.00, gg_dest_B00P_1310, 'Udre') // Dreadlord
            call RegisterHero( 12, -2816.00 , 2176.00, gg_dest_B00G_1306, 'Ulic') // Lich
            call RegisterHero( 13, -3200.00 , 2048.00, gg_dest_B01H_1314, 'Edem') // Demon Hunter
            call RegisterHero( 14, -3072.00 , 2048.00, gg_dest_B01Y_1313, 'Ekee') // Keeper of the Grove
            call RegisterHero( 15, -2944.00 , 2048.00, gg_dest_B01Z_1312, 'Emoo') // Pristress of the Moon
            call RegisterHero( 16, -2816.00 , 2048.00, gg_dest_B020_1311, 'Ewar') // Warden
           
            /* register hero stat: hero_id, stat_id, stat_value */
            call RegisterHeroStat(    1,    1, "|cffc3dbffTenn Flamecaster")
            call RegisterHeroStat(    1,    2, "|cffc3dbffArchmage")
            call RegisterHeroStat(    1,    4, "|cffc3dbff17 + 1.00")
            call RegisterHeroStat(    1,    5, "|cffffcc0019 + 3.20|r")
            call RegisterHeroStat(    1,    6, "|cffc3dbff14 + 1.80")
            call RegisterHeroStat(    1,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    1,    9, "|cffc3dbff600.00")
            call RegisterHeroStat(    1,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    1,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    1,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(    1,   13, "|cffc3dbffMystical Hero, adept at ranged assaults. Can learn Blizzard, Summon Water Elemental, Brilliance Aura and Mass Teleport. |n|n|cffffcc00Attacks land and air units.|r")
           
            call RegisterHeroStat(    2,    1, "|cffc3dbffEldin Sunstrider")
            call RegisterHeroStat(    2,    2, "|cffc3dbffBlood Mage")
            call RegisterHeroStat(    2,    4, "|cffc3dbff14 + 1.00")
            call RegisterHeroStat(    2,    5, "|cffffcc0019 + 3.00|r")
            call RegisterHeroStat(    2,    6, "|cffc3dbff18 + 2.00")
            call RegisterHeroStat(    2,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    2,    9, "|cffc3dbff600.00")
            call RegisterHeroStat(    2,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    2,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    2,   12, "|cffc3dbff300.00")
            call RegisterHeroStat(    2,   13, "|cffc3dbffMystical Hero, adept at controlling magic and ranged assaults. Can learn Flame Strike, Banish, Siphon Mana and Phoenix. |n|n|cffffcc00Attacks land and air units.|r")
           
            call RegisterHeroStat(    3,    1, "|cffc3dbffBor Stonebreaker")
            call RegisterHeroStat(    3,    2, "|cffc3dbffMountain King")
            call RegisterHeroStat(    3,    4, "|cffc3dbff11 + 1.50")
            call RegisterHeroStat(    3,    5, "|cffc3dbff15 + 1.50|r")
            call RegisterHeroStat(    3,    6, "|cffffcc0024 + 3.00")
            call RegisterHeroStat(    3,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    3,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(    3,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    3,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    3,   12, "|cffc3dbff270.00")
            call RegisterHeroStat(    3,   13, "|cffc3dbffWarrior Hero, adept at offensive combat and disrupting enemy troops. Can learn Storm Bolt, Thunder Clap, Bash and Avatar. |n|n|cffffcc00Attacks land units.|r")
           
            call RegisterHeroStat(    4,    1, "|cffc3dbffGranis Darkhammer")
            call RegisterHeroStat(    4,    2, "|cffc3dbffPaladin")
            call RegisterHeroStat(    4,    4, "|cffc3dbff13 + 1.50")
            call RegisterHeroStat(    4,    5, "|cffc3dbff17 + 1.80|r")
            call RegisterHeroStat(    4,    6, "|cffffcc0022 + 2.70")
            call RegisterHeroStat(    4,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    4,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(    4,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    4,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    4,   12, "|cffc3dbff270.00")
            call RegisterHeroStat(    4,   13, "|cffc3dbffWarrior Hero, exceptional at defense and augmenting nearby friendly troops. Can learn Holy Light, Divine Shield, Devotion Aura and Resurrection. |n|n|cffffcc00Attacks land units.|r")
           
            call RegisterHeroStat(    5,    1, "|cffc3dbffTojara")
            call RegisterHeroStat(    5,    2, "|cffc3dbffBlademaster")
            call RegisterHeroStat(    5,    4, "|cffc3dbff23 + 1.75")
            call RegisterHeroStat(    5,    5, "|cffffcc0016 + 2.25|r")
            call RegisterHeroStat(    5,    6, "|cffc3dbff18 + 2.00")
            call RegisterHeroStat(    5,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    5,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(    5,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    5,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    5,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(    5,   13, "|cffc3dbffCunning Hero, adept at quickly killing individual units and creating confusion among enemies. Can learn Mirror Image, Wind Walk, Critical Strike and Bladestorm. |n|n|cffffcc00Attacks land units.|r")
           
            call RegisterHeroStat(    6,    1, "|cffc3dbffGar'dal Grimsight")
            call RegisterHeroStat(    6,    2, "|cffc3dbffFar Seer")
            call RegisterHeroStat(    6,    4, "|cffc3dbff18 + 1.00")
            call RegisterHeroStat(    6,    5, "|cffffcc0019 + 3.00|r")
            call RegisterHeroStat(    6,    6, "|cffc3dbff15 + 2.00")
            call RegisterHeroStat(    6,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    6,    9, "|cffc3dbff600.00")
            call RegisterHeroStat(    6,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    6,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    6,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(    6,   13, "|cffc3dbffMystical Hero, effective at ranged attacks and scouting. Can learn Chain Lightning, Far Sight, Feral Spirit and Earthquake. |n|n|cffffcc00Attacks land and air units.|r")
           
            call RegisterHeroStat(    7,    1, "|cffc3dbffZul'kis")
            call RegisterHeroStat(    7,    2, "|cffc3dbffShadow Hunter")
            call RegisterHeroStat(    7,    4, "|cffffcc0017 + 1.00")
            call RegisterHeroStat(    7,    5, "|cffc3dbff19 + 3.20|r")
            call RegisterHeroStat(    7,    6, "|cffc3dbff14 + 1.80")
            call RegisterHeroStat(    7,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    7,    9, "|cffc3dbff600.00")
            call RegisterHeroStat(    7,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    7,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    7,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(    7,   13, "|cffc3dbffCunning Hero, adept at healing magics and voodoo curses. Can learn Healing Wave, Hex, Serpent Ward and Big Bad Voodoo. |n|n|cffffcc00Attacks land and air units.|r")
           
            call RegisterHeroStat(    8,    1, "|cffc3dbffMarn Thunderhorn")
            call RegisterHeroStat(    8,    2, "|cffc3dbffTauren Chieftain")
            call RegisterHeroStat(    8,    4, "|cffc3dbff17 + 1.00")
            call RegisterHeroStat(    8,    5, "|cffc3dbff19 + 3.20|r")
            call RegisterHeroStat(    8,    6, "|cffffcc0014 + 1.80")
            call RegisterHeroStat(    8,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    8,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(    8,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    8,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    8,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(    8,   13, "|cffc3dbffWarrior Hero, exceptional at absorbing damage and melee combat. Can learn Shockwave, War Stomp, Endurance Aura and Reincarnation. |n|n|cffffcc00Attacks land units.|r")
           
            call RegisterHeroStat(    9,    1, "|cffc3dbffThebis-Ra")
            call RegisterHeroStat(    9,    2, "|cffc3dbffCrypt Lord")
            call RegisterHeroStat(    9,    4, "|cffffcc0017 + 1.00")
            call RegisterHeroStat(    9,    5, "|cffc3dbff19 + 3.20|r")
            call RegisterHeroStat(    9,    6, "|cffc3dbff14 + 1.80")
            call RegisterHeroStat(    9,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(    9,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(    9,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(    9,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(    9,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(    9,   13, "|cffc3dbffWarrior Hero, adept at summoning insect minions and crushing enemies. Can learn Impale, Spiked Carapace, Carrion Beetles and Locust Swarm. |n|n|cffffcc00Attacks land units.|r")
           
            call RegisterHeroStat(   10,    1, "|cffc3dbffLord Nightsorrow")
            call RegisterHeroStat(   10,    2, "|cffc3dbffDeath Knight")
            call RegisterHeroStat(   10,    4, "|cffc3dbff17 + 1.00")
            call RegisterHeroStat(   10,    5, "|cffc3dbff19 + 3.20|r")
            call RegisterHeroStat(   10,    6, "|cffffcc0014 + 1.80")
            call RegisterHeroStat(   10,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(   10,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(   10,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(   10,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(   10,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(   10,   13, "|cffc3dbffWarrior Hero, evil counterpart to the Human Paladin. Can learn Death Coil, Death Pact, Unholy Aura, and Animate Dead. |n|n|cffffcc00Attacks land units.|r")
           
            call RegisterHeroStat(   11,    1, "|cffc3dbffTerrordar")
            call RegisterHeroStat(   11,    2, "|cffc3dbffDreadlord")
            call RegisterHeroStat(   11,    4, "|cffc3dbff17 + 1.00")
            call RegisterHeroStat(   11,    5, "|cffc3dbff19 + 3.20|r")
            call RegisterHeroStat(   11,    6, "|cffffcc0014 + 1.80")
            call RegisterHeroStat(   11,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(   11,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(   11,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(   11,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(   11,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(   11,   13, "|cffc3dbffCunning Hero, adept at controlling combat. Can learn Carrion Swarm, Sleep, Vampiric Aura, and Inferno. |n|n|cffffcc00Attacks land units.|r")
           
            call RegisterHeroStat(   12,    1, "|cffc3dbffOrdin Frostbane")
            call RegisterHeroStat(   12,    2, "|cffc3dbffLich")
            call RegisterHeroStat(   12,    4, "|cffc3dbff17 + 1.00")
            call RegisterHeroStat(   12,    5, "|cffffcc0019 + 3.20|r")
            call RegisterHeroStat(   12,    6, "|cffc3dbff14 + 1.80")
            call RegisterHeroStat(   12,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(   12,    9, "|cffc3dbff600.00")
            call RegisterHeroStat(   12,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(   12,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(   12,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(   12,   13, "|cffc3dbffMystical Hero, particularly adept at cold magic. Can learn Frost Armor, Frost Nova, Dark Ritual and Death And Decay. |n|n|cffffcc00Attacks land and air units.|r")
           
            call RegisterHeroStat(   13,    1, "|cffc3dbffShadowsong")
            call RegisterHeroStat(   13,    2, "|cffc3dbffDemon Hunter")
            call RegisterHeroStat(   13,    4, "|cffffcc0017 + 1.00")
            call RegisterHeroStat(   13,    5, "|cffc3dbff19 + 3.20|r")
            call RegisterHeroStat(   13,    6, "|cffc3dbff14 + 1.80")
            call RegisterHeroStat(   13,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(   13,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(   13,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(   13,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(   13,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(   13,   13, "|cffc3dbffCunning Hero, adept at maneuvering through battles. Can learn Immolation, Evasion, Mana Burn, and Metamorphosis. |n|n|cffffcc00Attacks land units.|r")
           
            call RegisterHeroStat(   14,    1, "|cffc3dbffLarodar")
            call RegisterHeroStat(   14,    2, "|cffc3dbffKeeper of the Grove")
            call RegisterHeroStat(   14,    4, "|cffc3dbff17 + 1.00")
            call RegisterHeroStat(   14,    5, "|cffffcc0019 + 3.20|r")
            call RegisterHeroStat(   14,    6, "|cffc3dbff14 + 1.80")
            call RegisterHeroStat(   14,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(   14,    9, "|cffc3dbff600.00")
            call RegisterHeroStat(   14,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(   14,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(   14,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(   14,   13, "|cffc3dbffMystical Hero, adept at using nature spells. Can learn Entangling Roots, Force of Nature, Thorns Aura, and Tranquility. |n|n|cffffcc00Attacks land and air units.|r")
           
            call RegisterHeroStat(   15,    1, "|cffc3dbffKathris Starsong")
            call RegisterHeroStat(   15,    2, "|cffc3dbffPristress of the Moon")
            call RegisterHeroStat(   15,    4, "|cffffcc0017 + 1.00")
            call RegisterHeroStat(   15,    5, "|cffc3dbff19 + 3.20|r")
            call RegisterHeroStat(   15,    6, "|cffc3dbff14 + 1.80")
            call RegisterHeroStat(   15,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(   15,    9, "|cffc3dbff600.00")
            call RegisterHeroStat(   15,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(   15,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(   15,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(   15,   13, "|cffc3dbffWarrior Hero, adept at enhancing ranged attacks and slaying enemies from afar. Can learn Scout, Searing Arrows, Trueshot Aura, and Starfall. |n|n|cffffcc00Attacks land and air units.|r")
           
            call RegisterHeroStat(   16,    1, "|cffc3dbffAlsa Iron-cell")
            call RegisterHeroStat(   16,    2, "|cffc3dbffWarden")
            call RegisterHeroStat(   16,    4, "|cffffcc0017 + 1.00")
            call RegisterHeroStat(   16,    5, "|cffc3dbff19 + 3.20|r")
            call RegisterHeroStat(   16,    6, "|cffc3dbff14 + 1.80")
            call RegisterHeroStat(   16,    8, "|cffc3dbff2.13")
            call RegisterHeroStat(   16,    9, "|cffc3dbff128.00 |cffffcc00(melee)")
            call RegisterHeroStat(   16,   10, "|cffc3dbff21 - 27 |cffffcc00(Hero)")
            call RegisterHeroStat(   16,   11, "|cffc3dbff3 |cffffcc00(Hero)")
            call RegisterHeroStat(   16,   12, "|cffc3dbff320.00")
            call RegisterHeroStat(   16,   13, "|cffc3dbffCunning Hero, adept at entering and escaping combat. Can learn Blink, Fan of Knives, Shadow Strike and Vengeance. |n|n|cffffcc00Attacks land units.|r")
        endfunction
    endlibrary


    Will this work nicely online, because of all those GetLocalPlayer shit, I had no time to test it. It seams ok to me...

    Btw as you can see there are still few things left to do...

    EDIT:

    Ok, Hit Ok and Hit Random are bad because of setting player variable inside local block.

    EDIT 2:

    It should be fixed now.
     
    Last edited: Sep 17, 2012
  13. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    Hmmm... it might look better if you separate the registration actions into another trigger... and it also makes your system code less prone to unintentional editing problems...

    also, you could change the call Debugblahblah to debug Debugblahblah, so that it will only show on debug mode... :)
     
  14. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,894
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    There finally updated, damn people started to upload all kind of similar systems :v
    Competition over 9000!
     
  15. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    You should allow more.

    Further, I'd suggest using images for text to make it look better. Text tags look so bad when they're still :(

    That aside, an obvious 5/5 good job.
     
  16. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,894
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    You can have 1000 heroes if you want, it's up to you how will you organize interface, I was lazy to add more than 16 heroes, it's just test example after all :)
     
  17. rulerofiron99

    rulerofiron99

    Joined:
    Jul 10, 2006
    Messages:
    3,129
    Resources:
    14
    Maps:
    4
    Spells:
    9
    Tutorials:
    1
    Resources:
    14
    Ah, my bad.
     
  18. Almia

    Almia

    Joined:
    Apr 24, 2012
    Messages:
    4,861
    Resources:
    35
    Spells:
    30
    Tutorials:
    4
    JASS:
    1
    Resources:
    35
    i liked your new UGHPS or should i say UVHPS(ultimate vJASS hero pick system)
    Nice looking windows too. :D

    I have a suggestion for your hero stat.
    Create 2 heroes of the same id,one is level one and one is in max level.
    Then get their attributes,subtract them,then divide it to max level - 1 and there you have it :D,it is much quicker to register.

    Edit
    I suggest using Vexorian's Dummy.mdx is a better idea :D
    For the model of the heroes,because the dummy.mdx can rotate its roll angle w/ animations and you dont have to create copy-and-paste destructables :D
     
  19. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,894
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    Added that Mag suggestion...
     
  20. meowie

    meowie

    Joined:
    Jun 13, 2010
    Messages:
    43
    Resources:
    0
    Resources:
    0
    my suggestion would be
    hero llimit to 1. Disable the respective hero icon slot after that hero is selected.
    Implement hero selectable group to two separate group that allow All pick function and respective hero in their player group force. That will make this system compatibility to AOS maps.
     
    Last edited: Dec 8, 2012