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

À, thì ra muốn xem bản đồ Undead Chapter 7 Part 3 (Ascent to the Upper Kingdom) phải không?
Đây: https://mega.co.nz/#!884HhZ5K!UbjSU2orMiEaIhwovHdpo2cigCxzgG1vSCfUWNtMD-M (bỏ đuôi .situvn)
Tải về rồi mở lên thích xem gì thì xem. Hàng chính hãng không có bảo vệ =))

Còn BR thì cũng cả năm trời rồi không mod nó nữa. Mô hình (model) của nó thì hình như chưa có ai đọc được lấy gì mà chuyển sang mdx chứ =))
 
Mấy bác làm ơn chỉ giúp mình chi tiết về 1 action trigger : move 1 Unit ngẫu nhiên trong region 01 đến region 02
Với lại mà , làm sao để "không thể attack vào Unit teammate "
 
Tức là không biết cách chọn ngẫu nhiên một đơn vị trong một vùng (region) hả? (Để sau đi=)))

Còn đánh bồ không được thì bắt sự kiện đơn vị đánh (hình như là Generic Unit Event - A Unit Attack thì phải) hay là Order a target to a unit.
Nếu người chơi có đơn vị đánh (trigging unit) và người chơi có đơn vị bị đánh (target unit) mà là bồ thì làm sao đó (hiện thông tin cảnh báo, dừng đơn vị đánh hoặc phạt thằng đang đánh)

Giờ máy đang giật quá, sợ mở WE đơ luôn, nên không nhớ rõ.
 
Mấy bác làm ơn chỉ giúp mình chi tiết về 1 action trigger : move 1 Unit ngẫu nhiên trong region 01 đến region 02
Với lại mà , làm sao để "không thể attack vào Unit teammate "

1. Nếu chỉ có 2 region thì code thế này:
Mã:
If - then - else
   If - Conditions
      Random integer between 1 and 2 equal to 1
   Then - Actions 
      Unit - Move unit to RegionA
   Else - Actions 
      Unit - Move Unit to RegionB

Còn nếu nhiều trigger thì thế này:
Mã:
Set Var_Reg[1] = Region1
Set Var_Reg[2] = Region2
Set Var_Reg[3] = Region3
...
Set Var_Reg[n] = RegionN
Set Var_Int = Random integer between 1 and n
Unit - Move unit to Var_Reg[Var_Int]

2. Để chặn ally đánh nhau:
Mã:
Events
   Unit is attacked
Conditions
   ((Attacking Unit) belong to ally of (Owner of (Attacked Unit))) == true 
Actions 
   Unit - Order Attacking Unit to stop
 
tks bạn , mình quên mất Unit này là 1 Hero , nên cái điều kiện khi random unit mình không biết lập thế nào để nó pick Hero , mà cái integer đó mình đặt trong Unit Group hay 1 cái nào đó để nó xác định là 1 Unit (mình ko rành cho lắm :( ) . mà cho mình hỏi cái này quan trọng hơn :D . Là mình có cái trigger hồi sình như thế này

Mã:
Hero Respawn
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is A Hero) Equal to (==) True
        ((Dying unit) belongs to an ally of Player 1 (Red)) Equal to (==) True
    Actions
        Set TempUnit = (Dying unit)
        Set TempInt = (Player number of (Owner of TempUnit))
        Game - Display to (All players) the text: ((Name of (Triggering player)) +  |cffffcc00®· b¹i trËn ! CÇn ®iÒu trÞ vµ mÊt 850G tiÒn phÝ !!|r)
        Player - Set (Owner of (Dying unit)) Current gold to (((Owner of (Dying unit)) Current gold) - 850)
        If (((Owner of (Dying unit)) Current gold) Less than (<) 0) then do (Player - Set (Owner of (Dying unit)) Current gold to 0) else do (Do nothing)
        Countdown Timer - Create a timer window for Timer with title (Name of TempUnit)
        Set Timer_Window[TempInt] = (Last created timer window)
        Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
        Countdown Timer - Start Timer as a One-shot timer that will expire in 10.00 seconds
        Wait 10.00 seconds
        Set Point_Spawn = (Center of Base Guild <gen>)
        Countdown Timer - Destroy Timer_Window[TempInt]
        Hero - Instantly revive (Dying unit) at Point_Spawn, Show revival graphics
        Selection - Select (Reviving Hero) for (Owner of (Dying unit))
        Camera - Pan camera for (Owner of (Triggering unit)) to Point_Spawn over 1.00 seconds
        Custom script:   call RemoveLocation( udg_Point_Spawn)


Sao cứ nhiều Hero đồng minh chết cùng lúc , là cái Timer_Window khác còn lại mà không mất , nó chỉ destroy dc có 1 cái @@
 
Chỉnh sửa cuối:
GUI là viết tắt của gì bạn nhỉ ? ^^ Cả MUI nữa, mình ko phân biệt đc
_____________

Câu hỏi đây:
Làm thế nào để tối thiểu hóa thời gian cast skill cho unit dummy ?
Ví dụ như tạo dummy ở vị trí hero để cast vào đối phương chẳng hạn. Khi hero di chuyển, ta thấy dummy cứ mọc ra ở sau lưng hero và cast skill ^^

Mình đã cho Cast backswing Cast Point bằng 0 mà ko có tác dụng mấy..
kể cả Blend Time = 0 luôn ý..
ko xi nhê

mình đã hứa thì sẽ làm mà :) mặc dù hơi trễ :-"
công nhận GUI khó làm thật :| phải mò từng code GUI hok hiểu thì converter qua jass để hiểu :((

http://www.mediafire.com/?0wlzgb2sbv4bmrv

chắc hồi nhỏ học chạy trước học đi
đoán quá đúng :-"




GUI có thể gây lag và leak, nếu dùng GUI thì máy phải dịch sang JASS =>> tốn time, mặc dù không đáng kể. JASS thì tối ưu hơn, hơn nữa 1 số thứ chỉ JASS mới có thể làm được.




Dummy xuất hiện ở đâu không quan trọng, Cast backswing và Cast Point bằng 0 là được rồi. Nếu muốn nhanh nữa thì khi create dummy cho nó face về cast point luôn thì sẽ đỡ tốn thời gian quay đầu.




và thời gian quay mặt ngược hướng nhất thì tốn tầm 0.04s tính ra sẽ chậm hơn Instant :-?




Cái đó là vJass (viết mã hướng đối tượng) dạng mở rộng của Jass. JASS NewGen Package hỗ trợ chức năng này.




nếu dịch thì chắc như thế hay hơn =)) vjas,jass là một phương thức định hướng cú pháp ngôn ngữ




Mình chưa đc giải đáp cụ thể về vụ Skill Phản Damage với range unit. Thorn Aura cũng chỉ phản melee mà thôi
_____________

Nguy cấp:





Tôi bị Lỗi MAP rồi !!! Chẳng thấy báo câu gì... Chỉ biết test thử thì bị đẩy ra main menu
Vào bằng custom game thử thì có hiện map, nhưng ko hiện các mục tùy chọn cho player..
LÝ DO TẠI SAO NHỈ ?? Xin nhắc lại là nguy cấp !!




test mà bị văng ra main menu không ra Faltal error hay gì đó thì lỗi dòng lặp vô tận Loop
còn vào map hok hiện ra main menu thì cả thì tui chắc rằng map đó đã thêm jass và thiếu cái gì đó hoặc open = worldeditor trong map có 1 vài vjass thì lỗi như thế :-?








àh với lại chỉ mình chi tiết dùng trigger thế nào để mua 1 unit trong shop , unit ấy sẽ không thể bị click và có aura buff , hễ Hero mua nó đi đâu nó cũng bay kế bên dù đi vào Teleport ( nó là 1 Pet )




cái đó là 1 dạng pet system của RPG vào hive! tìm em nào xài dc thì tải về test :-?
http://www.hiveworkshop.com/forums/spells.php?search=pet system&d=list&r=20








Làm sao để hide compuer player từ lúc Create Game (như Divide and Fight hay DotA ấy) ???




Untitled_zpsbbf87f5e.png

để như thế này! sau đó vào tìm dòng Player - Make Player 2 (Blue) treat Player 1 (Red) as an Ally with shared vision
cứ set như thế cho nó bồ với nhau và làm ngược lại như vậy :-?




à, làm sao để tạo Fade Filter cho 1 player thôi nhỉ ?




đọc phần này thì sẽ hiểu :-"
http://forum.gamevn.com/showthread.php?882466-Bai-Huong-Dan-Cach-lam-Fade-Filter




Bản đồ dạng chiến dịch tùy khách của Warcaft 3 gồm nhiều bản đồ thường thôi. Bản thân tập tin *.w3n chứa các tập tin cấu hình cho chiến dịch và mấy tập tin bản đồ riêng rẽ (*.w3x)
Campaign Editor của WE để trích xuất từng bản đồ trong đó ra. Rồi thích chôm model gì hay gì đó thì tùy :|
Nếu bản đồ đó không bị bảo vệ (protect) thì có thể mở được bằng WE. Còn nếu nó bị bảo vệ thì =)) ngồi nhìn.




sao không gọi là chiến dịch tùy biến? hay tùy chỉnh mà lại tùy khách. và người chơi đâu phải là khách hàng :|

tks bạn , mình quên mất Unit này là 1 Hero , nên cái điều kiện khi random unit mình không biết lập thế nào để nó pick Hero , mà cái integer đó mình đặt trong Unit Group hay 1 cái nào đó để nó xác định là 1 Unit (mình ko rành cho lắm :( ) . mà cho mình hỏi cái này quan trọng hơn :D . Là mình có cái trigger hồi sình như thế này

Mã:
Hero Respawn
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is A Hero) Equal to (==) True
        ((Dying unit) belongs to an ally of Player 1 (Red)) Equal to (==) True
    Actions
        Set TempUnit = (Dying unit)
        Set TempInt = (Player number of (Owner of TempUnit))
        Game - Display to (All players) the text: ((Name of (Triggering player)) +  |cffffcc00®· b¹i trËn ! CÇn ®iÒu trÞ vµ mÊt 850G tiÒn phÝ !!|r)
        Player - Set (Owner of (Dying unit)) Current gold to (((Owner of (Dying unit)) Current gold) - 850)
        If (((Owner of (Dying unit)) Current gold) Less than (<) 0) then do (Player - Set (Owner of (Dying unit)) Current gold to 0) else do (Do nothing)
        Countdown Timer - Create a timer window for Timer with title (Name of TempUnit)
        Set Timer_Window[TempInt] = (Last created timer window)
        Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
        Countdown Timer - Start Timer as a One-shot timer that will expire in 10.00 seconds
        Wait 10.00 seconds
        Set Point_Spawn = (Center of Base Guild <gen>)
        Countdown Timer - Destroy Timer_Window[TempInt]
        Hero - Instantly revive (Dying unit) at Point_Spawn, Show revival graphics
        Selection - Select (Reviving Hero) for (Owner of (Dying unit))
        Camera - Pan camera for (Owner of (Triggering unit)) to Point_Spawn over 1.00 seconds
        Custom script:   call RemoveLocation( udg_Point_Spawn)


Sao cứ nhiều Hero đồng minh chết cùng lúc , là cái Timer_Window khác còn lại mà không mất , nó chỉ destroy dc có 1 cái @@

tại không MUI :-? và có 1 cách làm local (hơi mạo hiểm =)))
hãy xóa 2 từ
Set TempUnit = (Dying unit)
Set TempInt = (Player number of (Owner of TempUnit))

và thêm 2 từ

Custom script: local unit udg_TempUnit = GetDyingUnit()
Custom script: local integer udg_TempInt = (GetPlayerId(GetOwningPlayer(udg_TempUnit))+1)

vào vị trí vừa xóa
 
Chỉnh sửa cuối:
Máy mình mới cài lại, mới cài lại war xong thế này là lỗi gì đây ?_?
Mình Open map không làm gì hết lúc save thì zậy ai zúp vs :(
 
Máy mình mới cài lại, mới cài lại war xong thế này là lỗi gì đây ?_?
Mình Open map không làm gì hết lúc save thì zậy ai zúp vs :(

open map = jassnewgen hoặc x design pack :|
 
À, thì ra muốn xem bản đồ Undead Chapter 7 Part 3 (Ascent to the Upper Kingdom) phải không?
Đây: https://mega.co.nz/#!884HhZ5K!UbjSU2orMiEaIhwovHdpo2cigCxzgG1vSCfUWNtMD-M (bỏ đuôi .situvn)
Tải về rồi mở lên thích xem gì thì xem. Hàng chính hãng không có bảo vệ =))

Còn BR thì cũng cả năm trời rồi không mod nó nữa. Mô hình (model) của nó thì hình như chưa có ai đọc được lấy gì mà chuyển sang mdx chứ =))

thank bạn nhớ.........................
 
cho mình hỏi 1 vấn đề khá cũ ... làm sao get armor của 1 unit nhỉ ?

Khi nào muốn check armor thì thêm đoạn code này vào:
Mã:
 Actions
     Set tempReal = (Life of targettedUnit)
     Unit - Cause damageDummy to damage targettedUnit, dealing 10.00 damage of attack type Chaos and damage type Normal
     Set damage = (tempReal - (Life of targettedUnit))
     If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
               damage Greater than 10.00
          Then - Actions
               Set armor = ((-1.00 x (10.00 - damage)) / (damage x ARMOR_CONSTANT))
          Else - Actions
               Set armor = ((10.00 - damage) / (damage x ARMOR_CONSTANT))
     Unit - Set life of targrettedUnit to tempReal
  • ARMOR_CONSTANT là 0.06, trừ khi bạn thay đổi giá trị này trong Gameplay Constant
  • Biến armor (real) trả về là armor hiện tại của unit
  • Chaos Damage phải gây 100% damage lên unit, nếu thay đổi trong Gameplay Constant thi code trên không đúng
Nguồn: Hiveworkshop
 
Cho mình hỏi có ai biết cách làm spell Aura: khi mình bị ATK thì +1 Armor cho mỗi phát (max 3 phát tức +3 armor) tương tự +2 armor mỗi phát khi LV2 v.v... Trong 2s mà ko bị đánh thì armor trở lại như cũ. Tks @.@
 
Giúp em vơi :( em làm trigger add spell Devotion Aura rùi remove ngay lập tức nhưng giá trị duration để tới 15s mà sao text có 5s ah` tks
 
Cho mình hỏi có ai biết cách làm spell Aura: khi mình bị ATK thì +1 Armor cho mỗi phát (max 3 phát tức +3 armor) tương tự +2 armor mỗi phát khi LV2 v.v... Trong 2s mà ko bị đánh thì armor trở lại như cũ. Tks @.@

đặt 1 item armor vào caster đó và cho level mỗi lần attack cứ + level và cho Integer +2 cho 1 timer đếm int này cứ 1s là trừ 1 nếu 0 thì ko trừ và remove ability armor


Giúp em vơi :( em làm trigger add spell Devotion Aura rùi remove ngay lập tức nhưng giá trị duration để tới 15s mà sao text có 5s ah` tks

cái đó là luật blizzard :-". và có cách khắc phục là gọi lệnh xóa buff đó :|
 
^ :| ơ zậy là sao ? Cách thực hiện sao zậy tks

Spell này bị lỗi ở đâu thế ? Có cách nào làm ngắn hơn được không đây là spell Jass đâu tiên làm :P mặc dù đã được convert chỉnh sữa tý cái sai lun @@!! tks
Mã:
function Pure_Light_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A03G'
endfunction

function PureLight_2 takes nothing returns boolean
    return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(Pure_Light_Caster)) == true )
endfunction

function PureLight_4 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true )
endfunction

function PureLight_5 takes nothing returns boolean
    return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction

function PureLight_3 takes nothing returns boolean
    return GetBooleanAnd( PureLight_4(), PureLight_5() )
endfunction

function PureLight_1 takes nothing returns boolean
    return GetBooleanAnd( PureLight_2(), PureLight_3() )
endfunction

function PureLight_A takes nothing returns nothing
    call UnitDamageTargetBJ( Pure_Light_Caster, GetEnumUnit(), ( ( I2R(GetUnitAbilityLevelSwapped('A03G', Pure_Light_Caster)) * 30.00 ) + 85.00 ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL )
endfunction

function Trig_Pure_Light_Actions takes nothing returns nothing
    local unit Pure_Light_Caster = GetTriggerUnit()
    local location Pure_Light_TargetPoint = GetSpellTargetLoc()
    local group Pure_Light_UnitGroup = GetUnitsInRangeOfLocMatching(200.00, Pure_Light_TargetPoint, Condition(function PureLight_1))
    call ForGroupBJ( Pure_Light_UnitGroup, function PureLight_A )
    call DestroyGroup (Pure_Light_UnitGroup)
    call RemoveLocation(Pure_Light_TargetPoint)
    set Pure_Light_Caster = null
endfunction

//===========================================================================
function InitTrig_Pure_Light takes nothing returns nothing
    set gg_trg_Pure_Light = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Pure_Light, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Pure_Light, Condition( function Pure_Light_Conditions ) )
    call TriggerAddAction( gg_trg_Pure_Light, function Pure_Light_Actions )
endfunction
 
^ spell trên em đã sữa nhưng tại sao chỉ sài dc có 1 lấn tks
Mã:
<function Pure_Light_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A001'
endfunction

function Pure_Light_Actions takes nothing returns nothing

local unit Pure_Light_Target
local unit Pure_Light_Caster = GetTriggerUnit()
local location Pure_Light_TargetPoint = GetSpellTargetLoc()
local group Pure_Light_UnitGroup = GetUnitsInRangeOfLocAll(200.00, Pure_Light_TargetPoint)

loop
        set Pure_Light_Target = FirstOfGroup(Pure_Light_UnitGroup)
        exitwhen Pure_Light_Target==null
        if  IsUnitEnemy(Pure_Light_Target, GetOwningPlayer(Pure_Light_Caster))==true then
        call UnitDamageTargetBJ( Pure_Light_Caster, Pure_Light_Target, ( ( I2R(GetUnitAbilityLevelSwapped('A001', Pure_Light_Caster)) * 30.00 ) + 85.00 ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL )
        call GroupRemoveUnit(Pure_Light_UnitGroup,Pure_Light_Target)
        endif
endloop 

set Pure_Light_UnitGroup = null
set Pure_Light_Target = null
set Pure_Light_Caster = null

endfunction


//===========================================================================
function InitTrig_Pure_Light takes nothing returns nothing
    local trigger Pure_Light = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( Pure_Light, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( Pure_Light, Condition( function Pure_Light_Conditions ) )
    call TriggerAddAction( Pure_Light, function Pure_Light_Actions )
endfunction>
 
-cho mình hỏi làm sao để xác định độ cao của 1 unit hay điểm terrain với mực nước biển; làm sao để unit giữ đc độ cao đó khi đi qua các terrain độ cao khác nhau vd: đi xuyên núi hay đi trên không trung bắt đầu từ 1 đỉnh núi 8-}

- đọc jass code của system ability hay trigger war3 như nào?
mình vào mấy file script nó chỉ có hiển thị data, string của ability, trigger thôi; muốn xem các hoạt động system trong đó ý;
có cách nào lấy đc tọa độ của missile hay tọa độ của skill phóng ra k?
 
Mình làm spell Holy Light: cast friend,self thì hồi máu và gây damage xung quanh. Nếu cast undead thì gây thêm 1/2 thiệt hại cho nó và gây thiệt hại xung quanh và bị cast spell Drunken Haze.
Spell nó sai chổ nào vậy thanks :(
Mã:
function Holy_Light_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'AHhb' 
endfunction

function Holy_Light_Actions takes nothing returns nothing

    local unit Holy_Light_Target
    local unit Holy_Light_C = GetTriggerUnit()
    local unit Holy_Light_T = GetSpellTargetUnit()
    local location Holy_Light_TP = GetUnitLoc(Holy_Light_T)
    local unit Holy_Light_Dummy = GetLastCreatedUnit() 
    local group Holy_Light_UnitGroup = GetUnitsInRangeOfLocAll(200.00, Holy_Light_TP)
 
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 4
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call AddSpecialEffectLocBJ( PolarProjectionBJ(Holy_Light_TP, 100.00, I2R(( GetForLoopIndexA() * 90 ))), "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    
    loop
        set Holy_Light_Target = FirstOfGroup(Holy_Light_UnitGroup)
        exitwhen Holy_Light_Target==null
        if  IsUnitEnemy(Holy_Light_Target, GetOwningPlayer(Holy_Light_C))==true then
        call UnitDamageTargetBJ( Holy_Light_C, Holy_Light_Target, ( ( I2R(GetUnitAbilityLevelSwapped('AHhb', Holy_Light_C)) * 30.00 ) + 85.00 ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL )
        call GroupRemoveUnit(Holy_Light_UnitGroup,Holy_Light_Target)
        endif
    endloop 
    
    call CreateNUnitsAtLoc( 1, 'n000', GetOwningPlayer(Holy_Light_C), Holy_Light_TP, bj_UNIT_FACING )
    call UnitAddAbilityBJ( 'A000', Holy_Light_Dummy )
    call IssueTargetOrderBJ( Holy_Light_Dummy, "drunkenhaze", Holy_Light_T )
    call UnitApplyTimedLifeBJ( 1.00, 'BTLF', Holy_Light_Dummy )
    
    call RemoveLocation(Holy_Light_TP)
    set Holy_Light_Target = null
    set Holy_Light_T = null
    set Holy_Light_C = null
    set Holy_Light_Dummy = null
    set Holy_Light_UnitGroup = null
    
endfunction
 
//===========================================================================
function InitTrig_Holy_Light takes nothing returns nothing
    local trigger Holy_Light = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( Holy_Light, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( Holy_Light, Condition( function Holy_Light_Conditions ) )
    call TriggerAddAction( Holy_Light, function Holy_Light_Actions )
endfunction
 
Mình làm spell Holy Light: cast friend,self thì hồi máu và gây damage xung quanh. Nếu cast undead thì gây thêm 1/2 thiệt hại cho nó và gây thiệt hại xung quanh và bị cast spell Drunken Haze.
Spell nó sai chổ nào vậy thanks :(
Mã:
function Holy_Light_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'AHhb' 
endfunction

function Holy_Light_Actions takes nothing returns nothing

    local unit Holy_Light_Target
    local unit Holy_Light_C = GetTriggerUnit()
    local unit Holy_Light_T = GetSpellTargetUnit()
    local location Holy_Light_TP = GetUnitLoc(Holy_Light_T)
    local unit Holy_Light_Dummy = GetLastCreatedUnit()[COLOR=#008000] // Có create unit đâu mà get[/COLOR]
    local group Holy_Light_UnitGroup = GetUnitsInRangeOfLocAll(200.00, Holy_Light_TP)
 
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 4
    [COLOR=#008000][Tốt nhất không nên xài bj][/COLOR]
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call AddSpecialEffectLocBJ( PolarProjectionBJ(Holy_Light_TP, 100.00, I2R(( GetForLoopIndexA() * 90 ))), "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    
    loop
        set Holy_Light_Target = FirstOfGroup(Holy_Light_UnitGroup)
        exitwhen Holy_Light_Target==null
        if  IsUnitEnemy(Holy_Light_Target, GetOwningPlayer(Holy_Light_C))==true then
        call UnitDamageTargetBJ( Holy_Light_C, Holy_Light_Target, ( ( I2R(GetUnitAbilityLevelSwapped('AHhb', Holy_Light_C)) * 30.00 ) + 85.00 ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL )
        call GroupRemoveUnit(Holy_Light_UnitGroup,Holy_Light_Target)
        endif
    endloop 
    
    call CreateNUnitsAtLoc( 1, 'n000', GetOwningPlayer(Holy_Light_C), Holy_Light_TP, bj_UNIT_FACING ) 
    [COLOR=#008000][Set Holy_Light_Dummy trước khi create ah?][/COLOR]
    call UnitAddAbilityBJ( 'A000', Holy_Light_Dummy )
    call IssueTargetOrderBJ( Holy_Light_Dummy, "drunkenhaze", Holy_Light_T )
    call UnitApplyTimedLifeBJ( 1.00, 'BTLF', Holy_Light_Dummy )
    
    call RemoveLocation(Holy_Light_TP)
    set Holy_Light_Target = null
    set Holy_Light_T = null
    set Holy_Light_C = null
    set Holy_Light_Dummy = null
    set Holy_Light_UnitGroup = null
    
endfunction
 
//===========================================================================
function InitTrig_Holy_Light takes nothing returns nothing
    local trigger Holy_Light = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( Holy_Light, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( Holy_Light, Condition( function Holy_Light_Conditions ) )
    call TriggerAddAction( Holy_Light, function Holy_Light_Actions )
endfunction

Nên sửa lại như thế này:

Mã:
function Holy_Light_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'AHhb' 
endfunction

function Holy_Light_Actions takes nothing returns nothing

    local unit Holy_Light_Target
    local unit Holy_Light_C = GetTriggerUnit()
    local unit Holy_Light_T = GetSpellTargetUnit()
    local location Holy_Light_TP = GetUnitLoc(Holy_Light_T)
    local player p = GetOwningPlayer(Holy_Light_C)
    local unit Holy_Light_Dummy = CreateUnitAtLoc( p, 'n000', Holy_Light_TP , 270)
    local group Holy_Light_UnitGroup = GetUnitsInRangeOfLocAll(200.00, Holy_Light_TP)
    local integer i = 1
 
    loop
[COLOR=#0000ff]         exitwhen i > 4[/COLOR]
[COLOR=#0000ff]        call AddSpecialEffectLocBJ( PolarProjectionBJ(Holy_Light_TP,  100.00, I2R(( i * 90 ))),  "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" )[/COLOR]
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
 [COLOR=#0000ff]       set i = i + 1[/COLOR]
    endloop
    
    loop
        set Holy_Light_Target = FirstOfGroup(Holy_Light_UnitGroup)
        exitwhen Holy_Light_Target == null
        if  IsUnitEnemy(Holy_Light_Target, p ) == true then
            [COLOR=#0000ff]call UnitDamageTarget(Holy_Light_C, Holy_Light_Target, I2R(GetUnitAbilityLevel( Holy_Light_C, 'AHhb')) * 30.00 ) + 85.00  ),, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)[/COLOR]
            call GroupRemoveUnit(Holy_Light_UnitGroup,Holy_Light_Target)
        endif
    endloop 
    
    [COLOR=#0000ff]call UnitAddAbility( Holy_Light_Dummy, [/COLOR][COLOR=#0000ff]'A000'[/COLOR][COLOR=#0000ff] )[/COLOR]
[COLOR=#0000ff]    call IssueTargetOrder( Holy_Light_Dummy, "drunkenhaze", Holy_Light_T )[/COLOR]
    [COLOR=#0000ff]call UnitApplyTimedLife( [/COLOR][COLOR=#0000ff]Holy_Light_Dummy [/COLOR][COLOR=#0000ff], 'BTLF', 1.00 )[/COLOR]
    
    call RemoveLocation(Holy_Light_TP)
    [COLOR=#0000ff]set Holy_Light_TP = null[/COLOR]
    set Holy_Light_Target = null
    set Holy_Light_T = null
    set Holy_Light_C = null
    set Holy_Light_Dummy = null
    set Holy_Light_UnitGroup = null
    
endfunction
 
//===========================================================================
function InitTrig_Holy_Light takes nothing returns nothing
    local trigger Holy_Light = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( Holy_Light, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( Holy_Light, Condition( function Holy_Light_Conditions ) )
    call TriggerAddAction( Holy_Light, function Holy_Light_Actions )
endfunction

Những dòng màu xanh là chỗ cần sửa.

  • Đã dùng local rồi thì tên biến nên viết ngắn gọn lại cho nhanh, không cần bê nguyên cái Holy_Light_ vào đâu. Local rồi thì các trigger khác không thể dùng biến đó được nên không phải sợ stack data.
  • Viết Jass thì nên lược bớt các bj vô ích, càng tối ưu càng tốt
 
Tks bạn nhiều :) nhưng cái dòng này nó bị gì zậy nó báo error.
call UnitDamageTarget(Holy_Light_C, Holy_Light_Target, I2R(GetUnitAbilityLevel( Holy_Light_C, 'AHhb')) * 30.00 ) + 85.00 ),, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
Với lại giá trị 270 là gì thế bạn ?
 
Back
Top