Topic hỏi đáp về cách làm map | version 15

Thảo luận trong 'World Editor' bắt đầu bởi Tom_Kazansky, 2/9/12.

  1. dh-g

    dh-g Fire in the hole! GVN Veteran

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    1 timer thì sẽ ra tình trạng check thống nhất!
    còn nhiều timer thì timer ngẫu nhiên!
    cuối cùng là 1 timer sẽ ngon hơn! vì timer chạy liên tục nó sẽ ăn hiệu suất nhiều thay vì 1 timer!

    ăn hiệu suất ít nhất là event timer!
    còn nhiều nhất là Timer (Window)

    shockwave nếu muốn target bị chậm gì đó thì phải trigger thôi :|

    stormbolt nếu muốn check thì có 1 cách là sử dụng trigger check vị trí khoảng cách (math distance gì đó..) XY giữa AB

    ví dụ
    distance A và B là có 800 range
    lấy 800 chia cho 3600 là missile speed của storm bolt trong object editor kết quả là 0,222 giây

    xong lúc này! sử dụng trigger wait theo số 0.222s đó rồi blah blah blah gì đó .. :-"
    nhưng thật ra người ta hay sử dụng trigger tạo ra chính missile đó thay vì phải sử dụng cái "đếm" này :-?
     
  2. Saboteur94

    Saboteur94 Youtube Master Race

    Tham gia ngày:
    8/12/12
    Bài viết:
    12
    Co mình xin trigger mẫu của stormbolt và shockwave được không bạn ơi, mình mò rồi mà không ra chứ không phải đụng đâu hỏi đấy :9cool_pudency:
     
  3. mvcthinh

    mvcthinh Mr & Ms Pac-Man

    Tham gia ngày:
    18/8/11
    Bài viết:
    140
    Nơi ở:
    HCM
    trong jass có cái library.. có ai có thể giải thích dùm cái đó dùng như thế nào không ?
    Làm sao mình đưa một Trigger như thế này vào library vậy
    Mà nó dùng để làm gì nhỉ?
    Mã:
     Setup Units
     Events
     Map initialization
     Conditions
     Actions
     Set HEROES[1] = HeroArchMage
     Set SKILL[1] = (Archmage) Crushing Wave
     Set SKILL[2] = (Archmage) Frost Ball
     Set SKILL[3] = (Archmage) Brilliance Aura
     Set SKILL[4] = (Archmage) Blizzard
     Set HEROES[2] = HeroPaladin
     Set SKILL[5] = (Paladin) SuperHammer
     Set SKILL[6] = (Paladin) Mirror Image
     Set SKILL[7] = (Paladin) Devotion Aura
     Set SKILL[8] = (Paladin) Storm of the Dead
     Set HEROES[3] = HeroMountainKing
     Set SKILL[9] = (Mountain King) Thunder Clap
     Set SKILL[10] = (Mountain King) Storm Bolt
     Set SKILL[11] = (Mountain King) Bash
     Set SKILL[12] = (Mountain King) Avatar
     Set HEROES[4] = BloodMage2
     Set SKILL[13] = (Blood Mage) Flame Strike
     Set SKILL[14] = (Blood Mage) Phoenix
     Set SKILL[15] = (Blood Mage) Banish
     Set SKILL[16] = (Blood Mage) Super Lightning
     Set HEROES[5] = HeroBlademaster
     Set SKILL[17] = (Blade Master) Pháp kiem
     Set SKILL[18] = (Blade Master) Mirror Image
     Set SKILL[19] = [Blade Master] Critical Aura
     Set SKILL[20] = [BladeMaster] Bladestorm
     Set HEROES[6] = HeroFarseer
     Set SKILL[21] = [Far Seer] Chain Lightning
     Set SKILL[22] = [Far Seer] Feral Spirit
     Set SKILL[23] = [Far Seer] Avoid
     Set SKILL[24] = [Far Seer] Sleep
     Set HEROES[7] = HeroTaurenChieftain
     Set SKILL[25] = [Tauren Chieftain] Shockwave
     Set SKILL[26] = [Tauren Chieftain] War Stomp
     Set SKILL[27] = [Tauren Chieftain] Endurance Aura
     Set SKILL[28] = [Tauren Chieftain] Reincarnation
     Set HEROES[8] = ShadowHunter
     Set SKILL[29] = [ShadowHunter] Healing Ward (Witch Doctor)
     Set SKILL[30] = [Shadow Hunter] Voodoo Spirits
     Set SKILL[31] = [Shadow Hunter] Hex
     Set SKILL[32] = [Shadow Hunter] Big Bad Voodoo
     Set HEROES[9] = HeroDeathKnight
     Set SKILL[33] = [Death Knight] Circle of Death
     Set SKILL[34] = [Death Knight] Death Stomp
     Set SKILL[35] = [Death Knight] Unholy Aura
     Set SKILL[36] = [Death Knight] Animate Dead
     Set HEROES[10] = LichVersion2
     Set SKILL[37] = [Lich] Frost Nova
     Set SKILL[38] = [Lich] Frost Attack
     Set SKILL[39] = [Lich] Frost Armor (Autocast)
     Set SKILL[40] = [Lich] Hand of Frost
     Set HEROES[11] = HeroDreadLord
     Set SKILL[41] = [Dreadlord] Carrion Swarm
     Set SKILL[42] = [Dreadlord] Sleep
     Set SKILL[43] = [Dreadlord] Vampiric Aura
     Set SKILL[44] = [Dreadlord] RockFireFall
     Set HEROES[12] = HeroCryptLord
     Set SKILL[45] = [Crypt Lord] Impale
     Set SKILL[46] = [Crypt Lord] Carrion Beetles
     Set SKILL[47] = [Crypt Lord] Spiked Carapace
     Set SKILL[48] = [Crypt Lord] Locust Swarm
     Set HEROES[13] = KeeperoftheGrove
     Set SKILL[49] = [Keeper of the Grove] Feral Spirit
     Set SKILL[50] = [Keeper of the Grove] Hidden
     Set SKILL[51] = [Keeper of the Grove] Thorns Aura
     Set SKILL[52] = [Keeper of the Grove] Circle Spirit
     Set HEROES[14] = PriestessOfTheMoon
     Set SKILL[53] = [Priestess of the Moon] Starfall
     Set SKILL[54] = [Priestess of the Moon] Searing Arrows
     Set SKILL[55] = [Priestess of the Moon] Trueshot Aura
     Set SKILL[56] = [Priestess of the Moon] Spirit of Moon
     Set HEROES[15] = Warden2
     Set SKILL[57] = [Warden] Fan of Knives
     Set SKILL[58] = [Warden] Shadow Strike
     Set SKILL[59] = [Warden] Blink
     Set SKILL[60] = [Warden] Poison Bolt
     Set HEROES[16] = EvilIllidan
     Set SKILL[61] = [Demon Hunter] KiemKhi
     Set SKILL[62] = [Demon Hunter] Immolation
     Set SKILL[63] = [Demon Hunter] Evasion
     Set SKILL[64] = [Demon Hunter] Metamorphosis
     Set HEROES[17] = FelGuardBlue
     Set SKILL[65] = [FelGuardBlue] Storm Bolt
     Set SKILL[66] = [FelGuardBlue] Mana Burn
     Set SKILL[67] = [FelGuardBlue] Cleaving Attack
     Set SKILL[68] = [FelGuardBlue] Mirror Image
     Set HEROES[18] = HeroAlchemist
     Set SKILL[69] = [Alchemist] Chemical Rage
     Set SKILL[70] = [Alchemist] Acid Bomb
     Set SKILL[71] = [Alchemist] Healing Spray
     Set SKILL[72] = [Alchemist] Transmute
     Set HEROES[19] = HeroTinker
     Set SKILL[73] = [Tinker] Cluster Rockets
     Set SKILL[74] = [Tinker] Pocket Factory
     Set SKILL[75] = [Tinker] Machine Crazy
     Set SKILL[76] = [Tinker] Robo-Goblin
     Set HEROES[20] = Kiljaedin
     Set SKILL[77] = [Warlock] Fast & Furious
     Set SKILL[78] = [Warlock] Breath of Fire
     Set SKILL[79] = [Warlock] Charm
     Set SKILL[80] = [Warlock] Rain of Fire
     Set HEROES[21] = Arthas
     Set SKILL[81] = [Arthas] Swords
     Set SKILL[82] = [Arthas] Forked Lightning
     Set SKILL[83] = [Arthas] Holy Light Aura
     Set SKILL[84] = [Arthas] Electrical Attack
     Set HEROES[22] = BansheeRanger
     Set SKILL[85] = [BansheeRanger] Poison Arrow
     Set SKILL[86] = [BansheeRanger] Black Arrow
     Set SKILL[87] = [BansheeRanger] Silence
     Set SKILL[88] = [BansheeRanger] Charm
     Set HEROES[23] = HeroAvatarOfFlame
     Set SKILL[89] = [AvatarOfFlame] Summon Lava Spawn
     Set SKILL[90] = [AvatarOfFlame] Soul Burn
     Set SKILL[91] = [AvatarOfFlame] Incinerate
     Set SKILL[92] = [AvatarOfFlame] Volcano
     Set HEROES[24] = Thrall
     Set SKILL[93] = [Thrall] Lightning Shield
     Set SKILL[94] = [Thrall] Storm Bolt
     Set SKILL[95] = [Thrall] Spell Shield
     Set SKILL[96] = [Thrall] Chain Lightning
     
  4. £Ø√Є

    £Ø√Є Mr & Ms Pac-Man

    Tham gia ngày:
    6/2/11
    Bài viết:
    223
    Nơi ở:
    Ninh Sơn
    làm 1 mãng chứa cái skill thui mà bạn, khi nào cần gọi mạng skill đó ra sử dụng
    skill gán cho hero, khi gọi hero là hiểu các skill hero đó có, đại loại vậy @@
     
  5. mvcthinh

    mvcthinh Mr & Ms Pac-Man

    Tham gia ngày:
    18/8/11
    Bài viết:
    140
    Nơi ở:
    HCM
    cái trigger ở dưới thì mình viết ra để dùng.. vấn đề mình muốn hỏi là cái Library.. vì có người kêu mình đưa vào library nên mình mới cần kiến thức về nó bạn à..
    Vì mình cần làm việc với một system trên vJass mà không hiểu cái library nó như thế nào .. mình cũng là dân ngoại đạo lập trình nên hỏi cho chắc :D
     
  6. dh-g

    dh-g Fire in the hole! GVN Veteran

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    chỉ có stormbolt thôi! tại chưa có time :|
    http://www.mediafire.com/?21rqrczmrpjio4h

    library là thư viện function. nó chỉ có nhiệm vụ là chứa các function hoặc các var thôi! cho dù cho vào library thì nó cũng như thế! chỉ tiện được cái viết = text chứ không phải là click chọn chọn.. kiểu GUI.

    muốn cho vào library thì converter custom text trong trigger editor >> File >> sau đó viết 1 dòng
    library <myName>
    //copy hết mấy cái set ??? = ?? vào đây hết...
    endlibrary
     
    Chỉnh sửa cuối: 8/5/13
  7. mvcthinh

    mvcthinh Mr & Ms Pac-Man

    Tham gia ngày:
    18/8/11
    Bài viết:
    140
    Nơi ở:
    HCM
    Ồ nếu vậy thì lúc mình đưa vào Library thì cũng đưa biến udg_SKILL[..] vào hay là mình tạo một global nhỉ..
    rồi khi mình dùng qua một hàm khác thì mình gọi nó như thế nào ?

    À mà tại sao mình dùng cái Trigger kia để set mấy cái variable mà lúc dùng thì không được.. nên người ta khuyên đưa vào library.. mà mình thì chả hiểu tại sao họ lại bảo dùng library lại xài được nhi?
    Có sự khác nhau nào chăng?
     
    Chỉnh sửa cuối: 8/5/13
  8. Dragonmangia

    Dragonmangia Donkey Kong

    Tham gia ngày:
    8/5/09
    Bài viết:
    372
    Nơi ở:
    Kathapecea
    Mình có 2 item: 1 20% chance Crit và 1 40% Chance Crit

    Trường hợp 1: Cooldown Group: Critical Strike Chance ( lấy từ 1 cái)

    Trường hợp 2: Cooldown Group: 20% Chance Crit và Cooldown Group: 40% Chance Crit

    Vậy có trường hợp nào cộng dồn số % Crit lại = 60% hay ko, hay là 2 cái Crit hoạt động riêng lẻ ? Ví dụ 1 đòn đánh thì có khả năng bật cả 2 cái crit để từ x2 mỗi crit thành = x4 cho đòn đánh ko ?
     
  9. dh-g

    dh-g Fire in the hole! GVN Veteran

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    udg_ là để cho bít là var tạo từ GUI thôi! :|

    như thế nào mới là không dc ? hay send pic cho tớ coi thử! và nó báo lỗi thế nào!


    Crit nếu có cái có thông số lớn hơn thì đó sẽ là ưu tiên còn nếu = thì sẽ dạng như A và B cùng nhau chance! cũng ko dc coi là + dồn cả :|
     
  10. mvcthinh

    mvcthinh Mr & Ms Pac-Man

    Tham gia ngày:
    18/8/11
    Bài viết:
    140
    Nơi ở:
    HCM
    À.. mình hiểu vấn đề rồi.. tìm kiếm trên mạng thì thấy nói rằng.. Library cũng tương tự như Scope.. chỉ khác nhau ở chỗ khi chạy map thì những thứ nằm trong cái Library nó sẽ được đưa lên đầu map (chắc là chạy trước tiên). Do mình sử dụng cái trigger set biến kia cho một cái system. Mà ngặc nổi system kia nó dùng library nên mình đoán chắc là thằng System nó chạy trước khi cái trigger GUI được set. Nên nó không hoạt động..

    Tại mình muốn đưa cái system này vào map thay cho cái AI của map mình.. nên nghiên cứu... mà làm thất bại nên đã backup về AI cũ xài tạm :D..

    Cái AI mà mình muốn dùng ở đây nè.
    http://www.hiveworkshop.com/forums/spells-569/hero-ai-v4-3-4-a-209141/index5.html

    Bạn làm việc với vJass nhiều cho mình ý kiến xem sao.. không biết mấy cái đó mình đọc có đúng không nữa :D.. vì mình cũng không hiểu cái đoạn Đưa lên đầu map là như thế nào thôi .. chỉ đoán mò không biết chính xác không :D
    [spoil]
    PHP:
    Setup Units
     Events
     Map initialization
     Conditions
     Actions
     Set HEROES
    [1] = HeroArchMage
     Set SKILL
    [1] = (ArchmageCrushing Wave
     Set SKILL
    [2] = (ArchmageFrost Ball
     Set SKILL
    [3] = (ArchmageBrilliance Aura
     Set SKILL
    [4] = (ArchmageBlizzard
     Set HEROES
    [2] = HeroPaladin
     Set SKILL
    [5] = (PaladinSuperHammer
     Set SKILL
    [6] = (PaladinMirror Image
     Set SKILL
    [7] = (PaladinDevotion Aura
     Set SKILL
    [8] = (PaladinStorm of the Dead
     Set HEROES
    [3] = HeroMountainKing
     Set SKILL
    [9] = (Mountain KingThunder Clap
     Set SKILL
    [10] = (Mountain KingStorm Bolt
     Set SKILL
    [11] = (Mountain KingBash
     Set SKILL
    [12] = (Mountain KingAvatar
     Set HEROES
    [4] = BloodMage2
     Set SKILL
    [13] = (Blood MageFlame Strike
     Set SKILL
    [14] = (Blood MagePhoenix
     Set SKILL
    [15] = (Blood MageBanish
     Set SKILL
    [16] = (Blood MageSuper Lightning
     Set HEROES
    [5] = HeroBlademaster
     Set SKILL
    [17] = (Blade MasterPháp kiem
     Set SKILL
    [18] = (Blade MasterMirror Image
     Set SKILL
    [19] = [Blade MasterCritical Aura
     Set SKILL
    [20] = [BladeMasterBladestorm
     Set HEROES
    [6] = HeroFarseer
     Set SKILL
    [21] = [Far SeerChain Lightning
     Set SKILL
    [22] = [Far SeerFeral Spirit
     Set SKILL
    [23] = [Far SeerAvoid
     Set SKILL
    [24] = [Far SeerSleep
     Set HEROES
    [7] = HeroTaurenChieftain
     Set SKILL
    [25] = [Tauren ChieftainShockwave
     Set SKILL
    [26] = [Tauren ChieftainWar Stomp
     Set SKILL
    [27] = [Tauren ChieftainEndurance Aura
     Set SKILL
    [28] = [Tauren ChieftainReincarnation
     Set HEROES
    [8] = ShadowHunter
     Set SKILL
    [29] = [ShadowHunterHealing Ward (Witch Doctor)
     
    Set SKILL[30] = [Shadow HunterVoodoo Spirits
     Set SKILL
    [31] = [Shadow HunterHex
     Set SKILL
    [32] = [Shadow HunterBig Bad Voodoo
     Set HEROES
    [9] = HeroDeathKnight
     Set SKILL
    [33] = [Death KnightCircle of Death
     Set SKILL
    [34] = [Death KnightDeath Stomp
     Set SKILL
    [35] = [Death KnightUnholy Aura
     Set SKILL
    [36] = [Death KnightAnimate Dead
     Set HEROES
    [10] = LichVersion2
     Set SKILL
    [37] = [LichFrost Nova
     Set SKILL
    [38] = [LichFrost Attack
     Set SKILL
    [39] = [LichFrost Armor (Autocast)
     
    Set SKILL[40] = [LichHand of Frost
     Set HEROES
    [11] = HeroDreadLord
     Set SKILL
    [41] = [DreadlordCarrion Swarm
     Set SKILL
    [42] = [DreadlordSleep
     Set SKILL
    [43] = [DreadlordVampiric Aura
     Set SKILL
    [44] = [DreadlordRockFireFall
     Set HEROES
    [12] = HeroCryptLord
     Set SKILL
    [45] = [Crypt LordImpale
     Set SKILL
    [46] = [Crypt LordCarrion Beetles
     Set SKILL
    [47] = [Crypt LordSpiked Carapace
     Set SKILL
    [48] = [Crypt LordLocust Swarm
     Set HEROES
    [13] = KeeperoftheGrove
     Set SKILL
    [49] = [Keeper of the GroveFeral Spirit
     Set SKILL
    [50] = [Keeper of the GroveHidden
     Set SKILL
    [51] = [Keeper of the GroveThorns Aura
     Set SKILL
    [52] = [Keeper of the GroveCircle Spirit
     Set HEROES
    [14] = PriestessOfTheMoon
     Set SKILL
    [53] = [Priestess of the MoonStarfall
     Set SKILL
    [54] = [Priestess of the MoonSearing Arrows
     Set SKILL
    [55] = [Priestess of the MoonTrueshot Aura
     Set SKILL
    [56] = [Priestess of the MoonSpirit of Moon
     Set HEROES
    [15] = Warden2
     Set SKILL
    [57] = [WardenFan of Knives
     Set SKILL
    [58] = [WardenShadow Strike
     Set SKILL
    [59] = [WardenBlink
     Set SKILL
    [60] = [WardenPoison Bolt
     Set HEROES
    [16] = EvilIllidan
     Set SKILL
    [61] = [Demon HunterKiemKhi
     Set SKILL
    [62] = [Demon HunterImmolation
     Set SKILL
    [63] = [Demon HunterEvasion
     Set SKILL
    [64] = [Demon HunterMetamorphosis
     Set HEROES
    [17] = FelGuardBlue
     Set SKILL
    [65] = [FelGuardBlueStorm Bolt
     Set SKILL
    [66] = [FelGuardBlueMana Burn
     Set SKILL
    [67] = [FelGuardBlueCleaving Attack
     Set SKILL
    [68] = [FelGuardBlueMirror Image
     Set HEROES
    [18] = HeroAlchemist
     Set SKILL
    [69] = [AlchemistChemical Rage
     Set SKILL
    [70] = [AlchemistAcid Bomb
     Set SKILL
    [71] = [AlchemistHealing Spray
     Set SKILL
    [72] = [AlchemistTransmute
     Set HEROES
    [19] = HeroTinker
     Set SKILL
    [73] = [TinkerCluster Rockets
     Set SKILL
    [74] = [TinkerPocket Factory
     Set SKILL
    [75] = [TinkerMachine Crazy
     Set SKILL
    [76] = [TinkerRobo-Goblin
     Set HEROES
    [20] = Kiljaedin
     Set SKILL
    [77] = [WarlockFast Furious
     Set SKILL
    [78] = [WarlockBreath of Fire
     Set SKILL
    [79] = [WarlockCharm
     Set SKILL
    [80] = [WarlockRain of Fire
     Set HEROES
    [21] = Arthas
     Set SKILL
    [81] = [ArthasSwords
     Set SKILL
    [82] = [ArthasForked Lightning
     Set SKILL
    [83] = [ArthasHoly Light Aura
     Set SKILL
    [84] = [ArthasElectrical Attack
     Set HEROES
    [22] = BansheeRanger
     Set SKILL
    [85] = [BansheeRangerPoison Arrow
     Set SKILL
    [86] = [BansheeRangerBlack Arrow
     Set SKILL
    [87] = [BansheeRangerSilence
     Set SKILL
    [88] = [BansheeRangerCharm
     Set HEROES
    [23] = HeroAvatarOfFlame
     Set SKILL
    [89] = [AvatarOfFlameSummon Lava Spawn
     Set SKILL
    [90] = [AvatarOfFlameSoul Burn
     Set SKILL
    [91] = [AvatarOfFlameIncinerate
     Set SKILL
    [92] = [AvatarOfFlameVolcano
     Set HEROES
    [24] = Thrall
     Set SKILL
    [93] = [ThrallLightning Shield
     Set SKILL
    [94] = [ThrallStorm Bolt
     Set SKILL
    [95] = [ThrallSpell Shield
     Set SKILL
    [96] = [ThrallChain Lightning
    PHP:
    //==========================================================================================
    // This is separated from the main system of HeroAI to provide better organization.
    // It covers how the AI will learn skills.
    //
    // When MULTIPLE_SKILLS_PER_LVL is true, you can register as many as MAX_SKILL_PER_LVL spells
    // to one level for a hero in case you want your hero to learn multiple skills at one level.
    //##########################################################################################
    // Function API:
    //
    //  * RegisterHeroAISkill takes integer unitTypeId, integer level, integer spellId *
    //      Registers the spell that a hero of unitTypeId should learn at level.
    //      This is provided as an alternative way of setting up skills in a custom AI and is 
    //      recommended to do so then registering skills here.
    //==========================================================================================

    // Please don't call this textmacro.
    //! textmacro HeroAILearnset

        
    globals
            
    private constant integer    MAX_SKILL_LVL           140   // The level at which the hero learns all of its skills
            
    private constant boolean    HAVE_MORPH_HEROES       true  // Set to true if you have heroes that can morph
            
    private constant boolean    MULTIPLE_SKILLS_PER_LVL true  // Set to true if you want learnsets to register more than one skill per level
            
    private constant integer    MAX_SKILL_PER_LVL       2     // The max number of skills a hero can learn every level. Only configure this if you have MULTIPLE_SKILLS_PER_LVL set to true. 
        
    endglobals    
        
        
    // The following allow better ease of configuration
        
    private keyword Learnset
        
    static if HAVE_MORPH_HEROES then
        
    private keyword MorphHeroType
        
    endif
        
    globals
            
    private Learnset LearnsetInfo
        endglobals
        
        
    // Configures how the heroes learn skills by unit-type id.
        // You need to override this function with your own heroes and their skills.
        
        // You should also set up any morphing heroes to their normal unit-type id so
        // that you won't need to copy a learnset again.
        
    private function SetupLearnset takes nothing returns nothing
            local integer A 
    //tuc la Level , khi no len toi level A thi no hoc skill o duoi
            
    local integer const = 36
            local integer B
            local integer n
            local integer IdSpell
            local integer IdHero
            
    // Learnset Syntax:
            // set LearnsetInfo[LEVEL OF HERO][HERO UNIT-TYPE ID] = SKILL ID
      
          //Danh cho skill binh thuong cua 24 Hero. 24x3 = 72 skill thuong`
          // Voi skill dac biet có 24 skill
    set n 1
        loop
            exitwhen n
    >24
            set B 
    1
            loop
                exitwhen B
    >4
                    
    if B!=4 then //Neu B = 4 tuc la nam trong khoang skill dac biet thi set qua 1 ve^' khác.
                            
    loop // o tren nay la hàm dành cho các skill binh thuong
                                
    set A B
                                    exitwhen A
    >(const+B)
                                        
    set IdSpell udg_SKILL[B+3*n+(n-4)]
                                        
    set IdHero udg_HEROES[n]
                                        
    set LearnsetInfo[A][IdHero] = IdSpell
                                 set   A 
    A+4
                            endloop
                        
    else // o phia duoi nay la ham` danh` cho cac skill dac biet.
                            
    loop
                                set A 
    B+2
                                    exitwhen A
    >(const+B)
                                       
                                        
    set IdSpell udg_SKILL[B+3*n+(n-4)]
                                        
    set IdHero udg_HEROES[n]
                                        
    set LearnsetInfo[A][IdHero] = IdSpell

                                   set A 
    A+8
                            endloop
                    
    endif
                
    set B=B+1    
            endloop
            set n
    =n+1
        endloop
            
    // Sau khi co hàm trên thì phai set skill theo thu tu. 
            //1 2 3 skill thuong, 4 skill dac biet. Cu nhu vay sap xep dung vi tri.
            
            //phia duoi nay` la ban goc. neu xem lai thi` duoi nay` la mau~ day

            
    set MorphHeroType['N009'] = 'N00B'    
            
    set MorphHeroType['N008'] = 'N00A'    
            
    set MorphHeroType['E007'] = 'E00B' 
        
    endfunction

    //==========================================================================================
    // END OF USER CONFIGURATION
    //==========================================================================================

        
    private function MakeAILearnSkills takes nothing returns nothing
            local unit u 
    GetTriggerUnit() 
            
    local integer typeId GetUnitTypeId(u)
            static if 
    MULTIPLE_SKILLS_PER_LVL then
            
            local integer i 
    0
            
            
    endif
            if 
    heroesAI.has(GetHandleId(u)) and GetHeroSkillPoints(u) > 0 then
                
    static if HAVE_MORPH_HEROES then
                
                
    if MorphHeroType.has(typeIdthen
                    set typeId 
    MorphHeroType[typeId]
                endif
                
                endif
                
                static if 
    MULTIPLE_SKILLS_PER_LVL then
                
                loop
                    exitwhen i 
    == LearnsetInfo[GetUnitLevel(u)].skillNum(typeId)
                    
    call SelectHeroSkill(uLearnsetInfo[GetUnitLevel(u)].getSkill(typeIdi))
                    
    set i 1
                endloop
                
                
    else
                
                
    call SelectHeroSkill(uLearnsetInfo[GetUnitLevel(u)][typeId])
                
                endif
            endif
            
    set u null
        endfunction
        
        
    static if HAVE_MORPH_HEROES then
        
        
    private module MorphSuperHack
            
    static method onInit takes nothing returns nothing
                set thistype
    .info Table.create()
            
    endmethod
        endmodule
        
        struct MorphHeroType 
    extends array
            private static 
    Table info
            
            
    static method operator [] takes integer morphedTypeId returns integer
                
    return info[morphedTypeId]
            
    endmethod
            
            
    static method operator []= takes integer morphedTypeIdinteger originalTypeId returns nothing
                set info
    [morphedTypeId] = originalTypeId
            endmethod
            
            
    static method has takes integer morphedTypeId returns boolean
                
    return info.has(morphedTypeId)
            
    endmethod
            
            implement MorphSuperHack
        endstruct
        
        
    endif
        
        
        static if 
    MULTIPLE_SKILLS_PER_LVL then
        
        
    private module RawIdIndexerInit
            
    static method onInit takes nothing returns nothing
                set thistype
    .info Table.create()
            
    endmethod
        endmodule
        
        
    private struct RawIdIndexer
            
    static Table info
            
    static integer count = -// Zero-based indexing due to array storage
            
            
    implement RawIdIndexerInit
        endstruct
        
        
    private function RawId2Index takes integer rawId returns integer
            
    if RawIdIndexer.info.has(rawIdthen
                
    return RawIdIndexer.info[rawId]
            endif
            
    set RawIdIndexer.count RawIdIndexer.count 1
            set RawIdIndexer
    .info[rawId] = RawIdIndexer.count
            
    return RawIdIndexer.count
        endfunction
        
        struct SkillArray 
    extends array
            private static 
    integer array skills     // Stores the skills based on hero raw id (indexed) and level it should be learned
            
    private static integer array skillNums  // Number of skills for a particular level
            
            // "this" refers to the level (zero-based) that the skill will be learned at
            
            
    method operator []= takes integer rinteger s returns nothing 
                local integer index
                set r 
    RawId2Index(r)
                
    set index this MAX_SKILL_LVL
                
                
    static if DEBUG_MODE then
                
                
    if index skillNums[index] > 8190 then
                    call BJDebugMsg
    ("[Hero AI Learnset] Error: Index is too high, try lowering MAX_SKILL_PER_LVL?")
                    return
                endif
                
                endif
                
                if 
    skillNums[index] < MAX_SKILL_PER_LVL then                
                    set skills
    [index skillNums[index]] = s
                    set skillNums
    [index] = skillNums[index] + 1
                debug 
    else
                    
    debug call BJDebugMsg("[Hero AI Learnset] Error: Exceeding the registration of skills to level " I2S(this 1))
                endif
            
    endmethod
            
            method getSkill takes integer r
    integer whichOne returns integer
                
    return skills[(this RawId2Index(r) * MAX_SKILL_LVL) + whichOne]
            
    endmethod
            
            method skillNum takes integer r returns integer
                
    return skillNums[this RawId2Index(r) * MAX_SKILL_LVL]
            
    endmethod
        endstruct
        
        
    endif    
        
        private 
    module M
            
    static method onInit takes nothing returns nothing            
                set LearnsetInfo 
    thistype.create()
                
    call RegisterPlayerUnitEvent(EVENT_PLAYER_HERO_LEVEL, function MakeAILearnSkills)
                
    call SetupLearnset()
            
    endmethod
        endmodule
        
        
    // Wrapper to make things look better and cheat the zero-indexed Table.
        // Only one instance will be created and used.
        
    struct Learnset extends array  
        
            static if 
    MULTIPLE_SKILLS_PER_LVL then
            
            method operator 
    [] takes integer lvl returns SkillArray
                
    static if DEBUG_MODE then
                
                
    if lvl MAX_SKILL_LVL then
                    call BJDebugMsg
    ("[Hero AI Learnset] Error: Level of " I2S(lvl) + " is higher than MAX_SKILL_LVL")
                    return 
    0
                
    endif
                
                endif
                
                return 
    lvl 1
            endmethod
            
            
    else
            
            private static 
    TableArray info
            
            method operator 
    [] takes integer lvl returns Table
                
    static if DEBUG_MODE then
                
                
    if lvl MAX_SKILL_LVL then
                    call BJDebugMsg
    ("[Hero AI Learnset] Error: Level of " I2S(lvl) + " is higher than MAX_SKILL_LVL")
                    return 
    0
                
    endif
                
                endif

                return 
    info[lvl 1]
            
    endmethod
            
            
    endif  
            
            static 
    method create takes nothing returns thistype
                
    static if not MULTIPLE_SKILLS_PER_LVL then
                
                set info 
    TableArray[MAX_SKILL_LVL]
                
                endif
                return 
    1
            endmethod
            
            implement M
        endstruct
        
        
    function RegisterHeroAISkill takes integer unitTypeIdinteger levelinteger spellId returns nothing
            set LearnsetInfo
    [level][unitTypeId] = spellId
        endfunction
        
    //! endtextmacro
    [/spoil]
     
  11. goldviper

    goldviper Waiting to respawn GameOver

    Tham gia ngày:
    7/1/10
    Bài viết:
    668
    Nơi ở:
    Tổ dân phố
    cho mình hỏi làm thế nào để tạo giới hạn số unit của 1 skill summon nhỉ
    vd: sm tối đa 2 unit ,đến unit thứ 3 thì kill unit thứ 1 ,khó là ở chỗ ko biết unit thứ nhất là unit nào ,tương tự sau đó sm thì kill unit thứ 2 ,vv...
    Nếu skill này có 1lv thì dùng biến đếm ko vấn đề gì nhưng nếu vd lv2 là tối đa 3 unit ,lv3 tối đa 4 unit thì sao 8-}
     
  12. magicz123

    magicz123 Mr & Ms Pac-Man

    Tham gia ngày:
    31/5/07
    Bài viết:
    185
    Dùng skill mặc định của War3 là Feral Spirit..., skill gọi sói ấy.
     
  13. Dragonmangia

    Dragonmangia Donkey Kong

    Tham gia ngày:
    8/5/09
    Bài viết:
    372
    Nơi ở:
    Kathapecea
    Feral Spirit chỉ summon giới hạn 1 lần thôi ~_~. Tức là có cast bao nhiêu lần thì cũng xóa bộ công cụ lao động̃ và lấy con mới thế vào.

    Bạn có thể thử sử dụng spell Carrion Beetles, đáp ứng dc nguyện vọng của bạn tuy có điều là phải cast trên corpse.
     
  14. giatoai123

    giatoai123 Youtube Master Race

    Tham gia ngày:
    31/8/12
    Bài viết:
    10
    Ai có thể viết giúp mình trigger ramdom bằng cách viết -ar hay -ramdom gì không, bác gút gồ toàn chỉ mấy cái trigger mà sau khi -ar or -ramdom toàn ra cứ 1 loại tướng ( kể cả onl và off)
     
  15. langthangbairac

    langthangbairac T.E.T.Я.I.S

    Tham gia ngày:
    19/5/12
    Bài viết:
    594
    Nơi ở:
    Thanh Chương
    Post lâu rồi này :

    http://forum.gamevn.com/showthread.php?951256-Random-hero-System
     
  16. goldviper

    goldviper Waiting to respawn GameOver

    Tham gia ngày:
    7/1/10
    Bài viết:
    668
    Nơi ở:
    Tổ dân phố
    Có ai biết tại sao tạo hay move nhiều unit vào 1 tiles Abyss thì bị critical error ko .VD : mình cast skill kiểu meat hook (tạo nhiều mấy cái mắt xích ý) liên tục vào khoảng có Abyss thì bị bay ra ngoài game .Mình cast ngoài nền đất bằng phẳng thì ko sao ,hay là do chênh lệch cliff cũng ko biết nữa
    đây mình post tạm đoạn trigger mình tạo ,chắc chắn là ko có leak gì
    Mã:
    Else - Actions
        -------- //////////////////////////////////////////////////////////////////// --------
        -------- CHAIN --------
        -------- //////////////////////////////////////////////////////////////////// --------
        Unit Group - Pick every unit in VB_CHAIN_GROUP and do (Actions)
            Loop - Actions
                Unit - Kill (Picked unit)
                Unit - Remove (Picked unit) from the game
        Unit Group - Remove all units from VB_CHAIN_GROUP
        Set VB_CASTERLOC = (Position of CASTER[0])
        Set VB_MISSLELOC = (Position of VB_PROJECT)
        Set VB_CHAIN_NUMBER = (Integer(((Distance between VB_CASTERLOC and VB_MISSLELOC) / 50.00)))
        For each (Integer A) from 1 to VB_CHAIN_NUMBER, do (Actions)
            Loop - Actions
                Set VB_CHAINLOC[(Integer A)] = (VB_CASTERLOC offset by (50.00 x (Real((Integer A)))) towards (Angle from VB_CASTERLOC to VB_MISSLELOC) degrees)
                Unit - Create 1 Dummy for (Owner of CASTER[0]) at VB_CHAINLOC[(Integer A)] facing (Angle from VB_CASTERLOC to VB_MISSLELOC) degrees
                Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Weapons\WardenMissile\WardenMissile.mdl
                Animation - Change (Last created unit)'s size to (150.00%, 150.00%, 150.00%) of its original size
                Unit - Add a 0.05 second Generic expiration timer to (Last created unit)
                Unit - Add Crow Form to (Last created unit)
                Animation - Change (Last created unit) flying height to 75.00 at 0.00
                Unit - Remove Crow Form from (Last created unit)
                Unit - Turn collision for (Last created unit) Off
                Unit - Pause (Last created unit)
                Unit Group - Add (Last created unit) to VB_CHAIN_GROUP
                Custom script:   call RemoveLocation (udg_VB_CHAINLOC[bj_forLoopAIndex])
        Custom script:   call RemoveLocation (udg_VB_CASTERLOC)
        Custom script:   call RemoveLocation (udg_VB_MISSLELOC)
    
     
  17. Ngoc LeO

    Ngoc LeO Mario & Luigi

    Tham gia ngày:
    23/7/06
    Bài viết:
    839
    Nơi ở:
    Nothing...
    Mọi người cho mình hỏi cách lưu biến hay struct bằng rawcode với ví dụ:

    set TempInt=GetUnitTypeId(GetTriggerUnit())
    set StructVar[TempInt]=this
     
  18. dh-g

    dh-g Fire in the hole! GVN Veteran

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    tại sao ReloadGameCachesFromDisk() lại khiến map bị lỗi vụ không đồng bộ với replay nhỉ :(
    tức trong lúc chơi map mình đã mua tướng ra, săn creep. lên lv. nhưng trong lúc coi lại replay thì chỉ là "1 thời gian dài chẳng làm gì cả trong lúc đang coi cái ngôi nhà Tarven "đó :| ai bít vụ hok :|
     
    Chỉnh sửa cuối: 15/5/13
  19. Tom_Kazansky

    Tom_Kazansky Quy ẩn giang hồ

    Tham gia ngày:
    28/12/06
    Bài viết:
    3,454
    Nơi ở:
    Hà Nội
    lưu theo "type" của unit á? vậy nhiều unit cùng một type thì trùng nhau?

    thường sử dụng GetHandleId(GetTriggerUnit()) vì mỗi unit có một "handle id" riêng, không trùng nhau. Nhưng số này quá lớn để sử dụng cho array.

    với vụ trên, ta có hai cách:

    - dùng Hashtable: call SaveInteger( udg_Hashtable, GetHandleId(GetTriggerUnit()), StringHash("StructVar"), this )

    - dùng index system: (ví dụ: AutoIndex)
    với hệ thống index, mỗi unit sẽ được gắn một integer từ 0 đến "tổng số unit", như vậy ta có thể sử dụng cho array.

    set StructVar[ GetUnitId(GetTriggerUnit()) ] = this

    hàm GetUnitId được cung cấp bởi hệ thống index

    sao lại dùng ReloadGameCachesFromDisk? nói rõ ra chứ?
     
  20. dh-g

    dh-g Fire in the hole! GVN Veteran

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    cái đó có thể check single player dc :-?
     

Chia sẻ trang này