[JASS] Convert this Jass to GUI Triggers ( AI )

Level 7
Joined
May 23, 2011
Messages
179
(Jass) Check My Jass Syntax ( AI )

Can anyone help me check the syntax of my Jass please because im confused.It causes error and disobedience in my AI...... :vw_sad::vw_sad::vw_sad::vw_sad:
JASS:
function AILearnSkill takes unit h, string a returns nothing
    local integer i = GetTableInt(a, "LearnSkillOrder")+1
    if i == 1 or i == 4 or i == 8 then
        call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, UnitId2String(GetUnitTypeId(h)), "BaseSkill1"))
    elseif i == 2 or i == 5 or i == 9 then
        call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, UnitId2String(GetUnitTypeId(h)), "BaseSkill2"))
    elseif i == 3 or i == 7 or i == 10 then
        call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, UnitId2String(GetUnitTypeId(h)), "BaseSkill3"))
    elseif i == 6 then
        call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, UnitId2String(GetUnitTypeId(h)), "UltimateSkill"))
    endif
    call SetTableInt(a, "LearnSkillOrder", i)
endfunction

function AISetItem takes nothing returns nothing
    set bj_lastRemovedItem=GetEnumItem()
endfunction

function AIItemFilter takes nothing returns boolean
    return IsItemVisible(GetFilterItem()) and GetWidgetLife(GetFilterItem()) > 0
endfunction

function AIHasEmptyInventorySlot takes unit u returns boolean
    return UnitItemInSlot(u, 0) == null or UnitItemInSlot(u, 1) == null or UnitItemInSlot(u, 2) == null or UnitItemInSlot(u, 3) == null or UnitItemInSlot(u, 4) == null or UnitItemInSlot(u, 5) == null
endfunction

function AIFilterEnemyConditions takes nothing returns boolean
    return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0 and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetAttachedUnit(GetExpiredTimer(), "hero")))
endfunction

function AILoop takes nothing returns nothing
    local string a = GetAttachmentTable(GetExpiredTimer())
    local unit h = GetTableUnit(a, "hero")
    local rect i
    local location r
    local real x = GetUnitX(h)
    local real y = GetUnitY(h)
    local group g
    local boolexpr b
    local boolexpr be
    local unit f
    local string o = OrderId2String(GetUnitCurrentOrder(h))
    local real l = GetUnitState(h, UNIT_STATE_LIFE)
    local real e = 5
    if l <= 0 then
        set e = 1.5
    endif
    if l < GetUnitState(h, UNIT_STATE_MAX_LIFE)/5 then
        call IssuePointOrder(h, "move", GetUnitX(gg_unit_nfoh_0001), GetUnitY(gg_unit_nfoh_0001))
        set e = 3
    else
        if ((o == "smart") or (o == "attack") or (o == "patrol") or (o == "move") or (o == "stop") or (o == "hold") or (o == null)) then
            set g = CreateGroup()
            set b = Condition(function AIFilterEnemyConditions)
            call GroupEnumUnitsInRange(g, x, y, 500, b)
            set f = FirstOfGroup(g)
            if f == null then
                set i = Rect(x-800, y-800, x+800, y+800)
                set be = Condition(function AIItemFilter)
                set bj_lastRemovedItem=null
                call EnumItemsInRect(i, be, function AISetItem)
                if bj_lastRemovedItem != null and (GetItemType(bj_lastRemovedItem) == ITEM_TYPE_POWERUP or AIHasEmptyInventorySlot(h)) then
                    call IssueTargetOrder(h, "smart", bj_lastRemovedItem)
                else
                    set r = GetRandomLocInRect(bj_mapInitialPlayableArea)
                    call IssuePointOrderLoc(h, "patrol", r)
                    call RemoveLocation(r)
                endif
                call RemoveRect(i)
                call DestroyBoolExpr(be)
            else
                call IssueTargetOrder(h, "attack", f)
            endif
            call DestroyGroup(g)
            call DestroyBoolExpr(b)
        endif
    endif
    if GetHeroSkillPoints(h) > 0 and l > 0 then
        call AILearnSkill(h, a)
    endif
    call TimerStart(GetExpiredTimer(), e, true, function AILoop)
    set h = null
    set i = null
    set r = null
    set g = null
    set b = null
    set f = null
    set be = null
endfunction

function StartAI takes unit hero returns nothing
    local timer m = CreateTimer()
    call AttachObject(m, "hero", hero)
    call TimerStart(m, 0, false, function AILoop)
    set m = null
endfunction

function PlayerLeaves takes nothing returns nothing
    local player p = GetTriggerPlayer()
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(p)+" has left the game.")
    if udg_Hero[GetPlayerId(p)] != null then
        call StartAI(udg_Hero[GetPlayerId(p)])
    endif
    set p = null
endfunction

function SetupSkills takes nothing returns nothing
    local string h
// Paladin
    set h = UnitId2String('Hpal')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AHhb')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AHds')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AHad')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AHre')
// Archmage
    set h = UnitId2String('Hamg')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AHbz')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AHab')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AHwe')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AHmt')
// Mountain King
    set h = UnitId2String('Hmkg')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AHtc')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AHtb')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AHbh')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AHav')
// Blood Mage
    set h = UnitId2String('Hblm')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AHfs')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AHbn')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AHdr')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AHpx')
// Blademaster
    set h = UnitId2String('Obla')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AOwk')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AOcr')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AOmi')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AOww')
// Far Seer
    set h = UnitId2String('Ofar')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AOfs')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AOsf')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AOcl')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AOeq')
// Tauren Chieftain
    set h = UnitId2String('Otch')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AOsh')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AOae')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AOws')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AOre')
// Shadow Hunter
    set h = UnitId2String('Oshd')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AOhw')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AOhx')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AOsw')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AOvd')
// Death Knight
    set h = UnitId2String('Udea')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AUdc')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AUdp')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AUau')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AUan')
// Lich
    set h = UnitId2String('Ulic')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AUfn')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AUfu')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AUdr')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AUdd')
// Dreadlord
    set h = UnitId2String('Udre')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AUav')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AUsl')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AUcs')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AUin')
// Crypt Lord
    set h = UnitId2String('Ucrl')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AUim')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AUts')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AUcb')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AUls')
// Keeper of the Grove
    set h = UnitId2String('Ekee')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AEer')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AEfn')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AEah')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AEtq')
// Priestess of the Moon
    set h = UnitId2String('Emoo')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AEfa')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AEst')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AEar')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AEsf')
// Demon Hunter
    set h = UnitId2String('Edem')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AEmb')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AEim')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AEev')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AEme')
// Warden
    set h = UnitId2String('Ewar')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AEbl')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AEfk')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AEsh')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AEsv')
// Alchemist
    set h = UnitId2String('Nalc')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANhs')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANab')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANcr')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANtm')
// Naga Sea Witch
    set h = UnitId2String('Nngs')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANfl')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANfa')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANms')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANto')
// Tinker
    set h = UnitId2String('Ntin')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANsy')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANcs')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANeg')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANrg')
// Beast Master
    set h = UnitId2String('Nbst')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANsg')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANsq')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANsw')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANst')
// Dark Ranger
    set h = UnitId2String('Nbrn')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANsi')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANba')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANdr')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANch')
// Firelord
    set h = UnitId2String('Nfir')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANic')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANso')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANlm')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANvc')
// Pandaren Brewmaster
    set h = UnitId2String('Npbm')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANbf')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANdh')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANdb')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANef')
// Pit Lord
    set h = UnitId2String('Nplh')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANrf')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANht')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANca')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANdo')
endfunction

//===========================================================================
function InitTrig_AI takes nothing returns nothing
    local integer i = 0
    set gg_trg_AI = CreateTrigger(  )
    loop
        exitwhen i > 11
        call TriggerRegisterPlayerEventLeave( gg_trg_AI, Player(i) )
        set i = i + 1
    endloop
    call TriggerAddAction( gg_trg_AI, function PlayerLeaves )
    call ExecuteFunc("SetupSkills")
endfunction
:vw_sad::vw_sad::vw_sad::vw_sad::vw_sad::vw_sad::vw_sad:

Thanks.....
I will gladly Credit your name in my map.....
:vw_death::vw_death::vw_death::vw_death::vw_death::vw_death::vw_unimpressed::vw_unimpressed::vw_unimpressed::vw_unimpressed::vw_unimpressed::vw_unimpressed::vw_unimpressed::vw_unimpressed:
 
Last edited:

Bribe

Code Moderator
Level 47
Joined
Sep 26, 2009
Messages
9,189
This would be much more difficult to "convert" to GUI because it would involve restructuring every single detail from the bottom up, into a really stupid syntax. There is no way to create a function in GUI, so you're basically cutting off your arms and legs in order to try to make this transition.

I advise learning JASS, it will take much less time than trying to mess up this code with GUI nonsense.
 
Level 7
Joined
May 23, 2011
Messages
179
Please check my syntax

Can anyone help me.... My Jass would cause errors and crash.... I have checked it by myself but i cannot find the root cause of the error....
JASS:
//TESH.scrollpos=-1
//TESH.alwaysfold=0
function AILearnSkill takes unit h, string a returns nothing
    local integer i = GetTableInt(a, "LearnSkillOrder")+1
    if i == 1 or i == 4 or i == 8 then
        call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, I2S(GetUnitTypeId(h)), "BaseSkill1"))
    elseif i == 2 or i == 5 or i == 9 then
        call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, I2S(GetUnitTypeId(h)), "BaseSkill2"))
    elseif i == 3 or i == 7 or i == 10 then
        call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, I2S(GetUnitTypeId(h)), "BaseSkill3"))
    elseif i == 6 then
        call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, I2S(GetUnitTypeId(h)), "UltimateSkill"))
    endif
    call SetTableInt(a, "LearnSkillOrder", i)
endfunction

function AISetItem takes nothing returns nothing
    set bj_lastRemovedItem=GetEnumItem()
endfunction

function AIItemFilter takes nothing returns boolean
    return IsItemVisible(GetFilterItem()) and GetWidgetLife(GetFilterItem()) > 0
endfunction

function AIHasEmptyInventorySlot takes unit u returns boolean
    return UnitItemInSlot(u, 0) == null or UnitItemInSlot(u, 1) == null or UnitItemInSlot(u, 2) == null or UnitItemInSlot(u, 3) == null or UnitItemInSlot(u, 4) == null or UnitItemInSlot(u, 5) == null
endfunction

function AIFilterEnemyConditions takes nothing returns boolean
    return GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0 and IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(GetAttachedUnit(GetExpiredTimer(), "hero")))
endfunction

function AILoop takes nothing returns nothing
    local string a = GetAttachmentTable(GetExpiredTimer())
    local unit h = GetTableUnit(a, "hero")
    local rect i
    local location r
    local real x = GetUnitX(h)
    local real y = GetUnitY(h)
    local group g
    local boolexpr b
    local boolexpr be
    local unit f
    local string o = OrderId2String(GetUnitCurrentOrder(h))
    local real l = GetUnitState(h, UNIT_STATE_LIFE)
    local real e = 5
    if l <= 0 then
        set e = 1.5
    endif
    if l < GetUnitState(h, UNIT_STATE_MAX_LIFE)/5 then
        call IssuePointOrder(h, "move", GetUnitX(gg_unit_nfoh_0001), GetUnitY(gg_unit_nfoh_0001))
        set e = 3
    else
        if ((o == "smart") or (o == "attack") or (o == "patrol") or (o == "move") or (o == "stop") or (o == "hold") or (o == null)) then
            set g = CreateGroup()
            set b = Condition(function AIFilterEnemyConditions)
            call GroupEnumUnitsInRange(g, x, y, 500, b)
            set f = FirstOfGroup(g)
            if f == null then
                set i = Rect(x-800, y-800, x+800, y+800)
                set be = Condition(function AIItemFilter)
                set bj_lastRemovedItem=null
                call EnumItemsInRect(i, be, function AISetItem)
                if bj_lastRemovedItem != null and (GetItemType(bj_lastRemovedItem) == ITEM_TYPE_POWERUP or AIHasEmptyInventorySlot(h)) then
                    call IssueTargetOrder(h, "smart", bj_lastRemovedItem)
                else
                    set r = GetRandomLocInRect(bj_mapInitialPlayableArea)
                    call IssuePointOrderLoc(h, "patrol", r)
                    call RemoveLocation(r)
                endif
                call RemoveRect(i)
                call DestroyBoolExpr(be)
            else
                call IssueTargetOrder(h, "attack", f)
            endif
            call DestroyGroup(g)
            call DestroyBoolExpr(b)
        endif
    endif
    if GetHeroSkillPoints(h) > 0 and l > 0 then
        call AILearnSkill(h, a)
    endif
    call TimerStart(GetExpiredTimer(), e, true, function AILoop)
    set h = null
    set i = null
    set r = null
    set g = null
    set b = null
    set f = null
    set be = null
endfunction

function StartAI takes unit hero returns nothing
    local timer m = CreateTimer()
    call AttachObject(m, "hero", hero)
    call TimerStart(m, 0, false, function AILoop)
    set m = null
endfunction

function PlayerLeaves takes nothing returns nothing
    local player p = GetTriggerPlayer()
    call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, GetPlayerName(p)+" has left the game.")
    if udg_Hero[GetPlayerId(p)] != null then
        call StartAI(udg_Hero[GetPlayerId(p)])
    endif
    set p = null
endfunction

function SetupSkills takes nothing returns nothing
    local string h
// Paladin
    set h = UnitId2String('Hpal')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AHhb')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AHds')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AHad')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AHre')
// Archmage
    set h = UnitId2String('Hamg')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AHbz')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AHab')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AHwe')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AHmt')
// Mountain King
    set h = UnitId2String('Hmkg')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AHtc')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AHtb')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AHbh')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AHav')
// Blood Mage
    set h = UnitId2String('Hblm')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AHfs')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AHbn')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AHdr')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AHpx')
// Blademaster
    set h = UnitId2String('Obla')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AOwk')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AOcr')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AOmi')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AOww')
// Far Seer
    set h = UnitId2String('Ofar')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AOfs')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AOsf')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AOcl')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AOeq')
// Tauren Chieftain
    set h = UnitId2String('Otch')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AOsh')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AOae')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AOws')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AOre')
// Shadow Hunter
    set h = UnitId2String('Oshd')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AOhw')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AOhx')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AOsw')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AOvd')
// Death Knight
    set h = UnitId2String('Udea')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AUdc')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AUdp')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AUau')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AUan')
// Lich
    set h = UnitId2String('Ulic')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AUfn')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AUfu')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AUdr')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AUdd')
// Dreadlord
    set h = UnitId2String('Udre')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AUav')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AUsl')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AUcs')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AUin')
// Crypt Lord
    set h = UnitId2String('Ucrl')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AUim')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AUts')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AUcb')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AUls')
// Keeper of the Grove
    set h = UnitId2String('Ekee')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AEer')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AEfn')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AEah')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AEtq')
// Priestess of the Moon
    set h = UnitId2String('Emoo')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AEfa')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AEst')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AEar')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AEsf')
// Demon Hunter
    set h = UnitId2String('Edem')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AEmb')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AEim')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AEev')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AEme')
// Warden
    set h = UnitId2String('Ewar')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'AEbl')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'AEfk')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'AEsh')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'AEsv')
// Alchemist
    set h = UnitId2String('Nalc')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANhs')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANab')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANcr')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANtm')
// Naga Sea Witch
    set h = UnitId2String('Nngs')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANfl')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANfa')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANms')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANto')
// Tinker
    set h = UnitId2String('Ntin')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANsy')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANcs')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANeg')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANrg')
// Beast Master
    set h = UnitId2String('Nbst')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANsg')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANsq')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANsw')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANst')
// Dark Ranger
    set h = UnitId2String('Nbrn')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANsi')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANba')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANdr')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANch')
// Firelord
    set h = UnitId2String('Nfir')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANic')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANso')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANlm')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANvc')
// Pandaren Brewmaster
    set h = UnitId2String('Npbm')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANbf')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANdh')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANdb')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANef')
// Pit Lord
    set h = UnitId2String('Nplh')
    call StoreInteger(udg_GameCache, h, "BaseSkill1", 'ANrf')
    call StoreInteger(udg_GameCache, h, "BaseSkill2", 'ANht')
    call StoreInteger(udg_GameCache, h, "BaseSkill3", 'ANca')
    call StoreInteger(udg_GameCache, h, "UltimateSkill", 'ANdo')
endfunction

//===========================================================================
function InitTrig_AI takes nothing returns nothing
    local integer i = 0
    set gg_trg_AI = CreateTrigger(  )
    loop
        exitwhen i > 11
        call TriggerRegisterPlayerEventLeave( gg_trg_AI, Player(i) )
        set i = i + 1
    endloop
    call TriggerAddAction( gg_trg_AI, function PlayerLeaves )
    call ExecuteFunc("SetupSkills")
endfunction
Please Check My syntax...
Thanks....:goblin_good_job::goblin_good_job::goblin_good_job::goblin_good_job::goblin_good_job::goblin_good_job::goblin_good_job::goblin_good_job::goblin_good_job::goblin_good_job::goblin_good_job:
 
Level 37
Joined
Mar 6, 2006
Messages
9,242
Where did you get this from? It requires some library to work.

GetTableInt and SetTableInt are functions in some other library:
local integer i = GetTableInt(a, "LearnSkillOrder")+1
call SetTableInt(a, "LearnSkillOrder", i)
There are more functions that are from another library also.

You need to create a variable called GameCache of type game cache:
call SelectHeroSkill(h, GetStoredInteger(udg_GameCache, I2S(GetUnitTypeId(h)), "BaseSkill1"))

Also this line would require you to set the unit yourself:
call IssuePointOrder(h, "move", GetUnitX(gg_unit_nfoh_0001), GetUnitY(gg_unit_nfoh_0001))

You need to create a unit array called Hero:
if udg_Hero[GetPlayerId(p)] != null then
 
Top