[ Hướng dẫn ] Làm skills Time Lapse

Thảo luận trong 'World Editor' bắt đầu bởi langthangbairac, 8/6/12.

  1. langthangbairac

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

    Tham gia ngày:
    19/5/12
    Bài viết:
    594
    Nơi ở:
    Thanh Chương
    Chắc mọi người biết until con kiến trong dota rồi chứ ? Sau đây mình sin giới thiệu qua về skills này :

    Khi cast skill, hero sẽ trở về trạng thái 5s trước đó ( MP, HP trở về và EXP, gold vẫn bình thường )

    Mình dốt văn nên ko thể miêu tả được cho các bạn :(( nên chỉ nói sơ sơ thôi, ai ko hiểu down về copy sang map mình cũng được.

    Khi cast skill, nó sẽ hồi phục MP, HP 5s trước ( nhờ trigger thứ 3 )
    Mã:
    Time Lapse cast
        Events
            Unit - A unit Starts the effect of an ability
        Conditions
            (Ability being cast) Equal to Time Lapse 
        Actions
            Set CasterPos = (Position of (Triggering unit))
            Special Effect - Create a special effect at CasterPos using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
            Special Effect - Destroy (Last created special effect)
            Custom script:   call RemoveLocation (udg_CasterPos)
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    HPInteger Less than or equal to 6
                Then - Actions
                    Unit - Set life of (Triggering unit) to HP[1]
                    Unit - Set mana of (Triggering unit) to MP[1]
                    Unit - Move (Triggering unit) instantly to POS[1]
                    Custom script:   call RemoveLocation (udg_POS[1])
                Else - Actions
                    Unit - Set life of (Triggering unit) to HP[(HPInteger - 5)]
                    Unit - Set mana of (Triggering unit) to MP[(MPInteger - 5)]
                    Unit - Move (Triggering unit) instantly to POS[(POSInteger - 5)]
                    Custom script:   call RemoveLocation (udg_POS[udg_POSInteger - 5])
            Set CasterPos = (Position of (Triggering unit))
            Special Effect - Create a special effect at CasterPos using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
            Special Effect - Destroy (Last created special effect)
            Custom script:   call RemoveLocation (udg_CasterPos)
            Unit - Order (Triggering unit) to Stop
    
    Khi học skill thì sẽ bắt dầu mở trigger 3 đẻ đặt thời gian bảo lưu
    Mã:
    Time Lapse cast
        Events
            Unit - A unit Learns a skill
        Conditions
            (Level of Time Lapse  for (Triggering unit)) Greater than 0
        Actions
            Set Caste = (Triggering unit)
            Trigger - Turn off (This trigger)
            Trigger - Turn on Time Lapse creat restore2 <gen>
    
    Đặt số máu, vị trí trước đó 5s, sau 5s sẽ đặt lại vị trí ( kể từ khi mỏ trigger này )
    Mã:
    Time Lapse creat restore2
        Events
            Time - Every 1.00 seconds of game time
        Conditions
            (Caste is alive) Equal to True
        Actions
            Set HPInteger = (HPInteger + 1)
            Set HP[HPInteger] = (Life of Caste)
            Set MPInteger = (MPInteger + 1)
            Set MP[MPInteger] = (Mana of Caste)
            Set POSInteger = (POSInteger + 1)
            Set POS[POSInteger] = (Position of Caste)
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    HPInteger Greater than 6
                Then - Actions
                    Custom script:   call RemoveLocation (udg_POS[udg_POSInteger - 6])
                Else - Actions
    
    Lưu 5 giây kể từ khi bị chết
    Mã:
    Time Lapse save dies
        Events
            Unit - A unit Dies
        Conditions
            (Dying unit) Equal to Caste
        Actions
            Wait until ((Caste is alive) Equal to True), checking every 0.10 seconds
            For each (Integer A) from 1 to 5, do (Actions)
                Loop - Actions
                    Set HP[(HPInteger - (Integer A))] = (Life of Caste)
                    Set MP[(MPInteger - (Integer A))] = (Mana of Caste)
                    Set POS[(POSInteger - (Integer A))] = (Position of Caste)
    
    Chắc khó hiểu :( nhưng đảm bảo ko có leak :2onion2:

    Cũng tại vì WE bị lỗi nên đã Enabled trigger nên các bạn phải tick vào enabled trigger rồi test
     

    Các file đính kèm:

    Chỉnh sửa cuối: 8/6/12
  2. LeoNguyen112

    LeoNguyen112 Dragon Quest

    Tham gia ngày:
    22/5/10
    Bài viết:
    1,438
    Nơi ở:
    TP.HCM
    Edit: nhìn nhầm code 8-|

    P/s: được thì nghiên cứu làm MUI luôn đi.
     
  3. langthangbairac

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

    Tham gia ngày:
    19/5/12
    Bài viết:
    594
    Nơi ở:
    Thanh Chương
    Wtf? Mui là gì vậy ? Trước giờ chỉ ngiên cứu gui vs jass thôi
     
  4. Daranla

    Daranla Mr & Ms Pac-Man

    Tham gia ngày:
    11/9/09
    Bài viết:
    237
    Nơi ở:
    Nhấp vào cái cân th
    èo, ko biết làm MUI sao bjk code jass hay vậy ?
     
  5. ShadowThanatos

    ShadowThanatos -|--Soul Reaper--|-

    Tham gia ngày:
    23/2/09
    Bài viết:
    2,119
    Nơi ở:
    Horror Depht
    Ulti chứ không phải Unti

    MUI = Multi Unit Instanciable (nhiều unit cùng cast 1 triggered spell mà không gây ra lỗi).
     
  6. langthangbairac

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

    Tham gia ngày:
    19/5/12
    Bài viết:
    594
    Nơi ở:
    Thanh Chương
    hè. cũng hay đấy chứ :D thử rồi sẽ biết ngay :)
    ko nhất thiết đâu :D mà cũng mới biết mấy cái rìa thôi chẳng dám đông sâu :(
     
    Chỉnh sửa cuối: 8/6/12
  7. Ryanpzo9

    Ryanpzo9 Donkey Kong

    Tham gia ngày:
    20/10/08
    Bài viết:
    326
    sao giống code trên thehelper.net vậy? =.=
     
  8. chomap007

    chomap007 Donkey Kong

    Tham gia ngày:
    20/11/06
    Bài viết:
    402
    chủ topic set trigger nhớ HP,MP,vị trí thành mỗi 0,1 s đi làm vậy chính xác hơn.
     
  9. langthangbairac

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

    Tham gia ngày:
    19/5/12
    Bài viết:
    594
    Nơi ở:
    Thanh Chương

    thực ra nó là đoạn
    code jass tôi kiếm trên epic và viết bằng gui đấy.

    Mã:
    function Trig_Time_Lapse_Creat_restore_Conditions takes nothing returns boolean
        if ( not ( GetSpellAbilityId() == 'A000' ) ) then
            return false
        endif
        return true
    endfunction
    
    function Trig_Time_Lapse_Creat_restore_Func005C takes nothing returns boolean
        if ( not ( udg_HPInteger <= 6 ) ) then
            return false
        endif
        return true
    endfunction
    
    function Trig_Time_Lapse_Creat_restore_Actions takes nothing returns nothing
        set udg_CasterPos = GetUnitLoc(GetTriggerUnit())
        call AddSpecialEffectLocBJ( udg_CasterPos, "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl" )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        call RemoveLocation (udg_CasterPos)
        if ( Trig_Time_Lapse_Creat_restore_Func005C() ) then
            call SetUnitLifeBJ( GetTriggerUnit(), udg_HP[1] )
            call SetUnitManaBJ( GetTriggerUnit(), udg_MP[1] )
            call SetUnitPositionLoc( GetTriggerUnit(), udg_POS[1] )
            call RemoveLocation (udg_POS[1])
        else
            call SetUnitLifeBJ( GetTriggerUnit(), udg_HP[( udg_HPInteger - 5 )] )
            call SetUnitManaBJ( GetTriggerUnit(), udg_MP[( udg_MPInteger - 5 )] )
            call SetUnitPositionLoc( GetTriggerUnit(), udg_POS[( udg_POSInteger - 5 )] )
            call RemoveLocation (udg_POS[udg_POSInteger - 5])
        endif
        set udg_CasterPos = GetUnitLoc(GetTriggerUnit())
        call AddSpecialEffectLocBJ( udg_CasterPos, "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl" )
        call DestroyEffectBJ( GetLastCreatedEffectBJ() )
        call RemoveLocation (udg_CasterPos)
        call IssueImmediateOrderBJ( GetTriggerUnit(), "stop" )
    endfunction
    
    //===========================================================================
    function InitTrig_Time_Lapse_Creat_restore takes nothing returns nothing
        set gg_trg_Time_Lapse_Creat_restore = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( gg_trg_Time_Lapse_Creat_restore, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddCondition( gg_trg_Time_Lapse_Creat_restore, Condition( function Trig_Time_Lapse_Creat_restore_Conditions ) )
        call TriggerAddAction( gg_trg_Time_Lapse_Creat_restore, function Trig_Time_Lapse_Creat_restore_Actions )
    endfunction
    
    
    Mã:
    function Trig_Time_Lapse_cast_Conditions takes nothing returns boolean
        if ( not ( GetUnitAbilityLevelSwapped('A000', GetTriggerUnit()) > 0 ) ) then
            return false
        endif
        return true
    endfunction
    
    function Trig_Time_Lapse_cast_Actions takes nothing returns nothing
        set udg_Caste = GetTriggerUnit()
        call DisableTrigger( GetTriggeringTrigger() )
        call EnableTrigger( gg_trg_Time_Lapse_creat_restore2 )
    endfunction
    
    //===========================================================================
    function InitTrig_Time_Lapse_cast takes nothing returns nothing
        set gg_trg_Time_Lapse_cast = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( gg_trg_Time_Lapse_cast, EVENT_PLAYER_HERO_SKILL )
        call TriggerAddCondition( gg_trg_Time_Lapse_cast, Condition( function Trig_Time_Lapse_cast_Conditions ) )
        call TriggerAddAction( gg_trg_Time_Lapse_cast, function Trig_Time_Lapse_cast_Actions )
    endfunction
    
    
    Mã:
    function Trig_Time_Lapse_creat_restore2_Conditions takes nothing returns boolean
        if ( not ( IsUnitAliveBJ(udg_Caste) == true ) ) then
            return false
        endif
        return true
    endfunction
    
    function Trig_Time_Lapse_creat_restore2_Func007C takes nothing returns boolean
        if ( not ( udg_HPInteger > 6 ) ) then
            return false
        endif
        return true
    endfunction
    
    function Trig_Time_Lapse_creat_restore2_Actions takes nothing returns nothing
        set udg_HPInteger = ( udg_HPInteger + 1 )
        set udg_HP[udg_HPInteger] = GetUnitStateSwap(UNIT_STATE_LIFE, udg_Caste)
        set udg_MPInteger = ( udg_MPInteger + 1 )
        set udg_MP[udg_MPInteger] = GetUnitStateSwap(UNIT_STATE_MANA, udg_Caste)
        set udg_POSInteger = ( udg_POSInteger + 1 )
        set udg_POS[udg_POSInteger] = GetUnitLoc(udg_Caste)
        if ( Trig_Time_Lapse_creat_restore2_Func007C() ) then
            call RemoveLocation (udg_POS[udg_POSInteger - 6])
        else
        endif
    endfunction
    
    //===========================================================================
    function InitTrig_Time_Lapse_creat_restore2 takes nothing returns nothing
        set gg_trg_Time_Lapse_creat_restore2 = CreateTrigger(  )
        call TriggerRegisterTimerEventPeriodic( gg_trg_Time_Lapse_creat_restore2, 1.00 )
        call TriggerAddCondition( gg_trg_Time_Lapse_creat_restore2, Condition( function Trig_Time_Lapse_creat_restore2_Conditions ) )
        call TriggerAddAction( gg_trg_Time_Lapse_creat_restore2, function Trig_Time_Lapse_creat_restore2_Actions )
    endfunction
    
    
    Mã:
    function Trig_Time_Lapse_save_dies_Conditions takes nothing returns boolean
        if ( not ( GetDyingUnit() == udg_Caste ) ) then
            return false
        endif
        return true
    endfunction
    
    function Trig_Time_Lapse_save_dies_Func001001 takes nothing returns boolean
        return ( IsUnitAliveBJ(udg_Caste) == true )
    endfunction
    
    function Trig_Time_Lapse_save_dies_Actions takes nothing returns nothing
        loop
            exitwhen ( Trig_Time_Lapse_save_dies_Func001001() )
            call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
        endloop
        set bj_forLoopAIndex = 1
        set bj_forLoopAIndexEnd = 5
        loop
            exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
            set udg_HP[( udg_HPInteger - GetForLoopIndexA() )] = GetUnitStateSwap(UNIT_STATE_LIFE, udg_Caste)
            set udg_MP[( udg_MPInteger - GetForLoopIndexA() )] = GetUnitStateSwap(UNIT_STATE_MANA, udg_Caste)
            set udg_POS[( udg_POSInteger - GetForLoopIndexA() )] = GetUnitLoc(udg_Caste)
            set bj_forLoopAIndex = bj_forLoopAIndex + 1
        endloop
    endfunction
    
    //===========================================================================
    function InitTrig_Time_Lapse_save_dies takes nothing returns nothing
        set gg_trg_Time_Lapse_save_dies = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( gg_trg_Time_Lapse_save_dies, EVENT_PLAYER_UNIT_DEATH )
        call TriggerAddCondition( gg_trg_Time_Lapse_save_dies, Condition( function Trig_Time_Lapse_save_dies_Conditions ) )
        call TriggerAddAction( gg_trg_Time_Lapse_save_dies, function Trig_Time_Lapse_save_dies_Actions )
    endfunction
    
    
    zzz nhìn hoa cả mắt. ko biết có sai chỗ nào ko
     
    Chỉnh sửa cuối: 8/6/12
  10. dh-g

    dh-g Fire in the hole!

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    nhưng đám (code jass) kia nó hoàn toàn là từ GUI to jass( Converter Custom Text) cũng là jass nhưng không được tối ưu.

    nói chung:

    Jass không tối ưu hóa = Vô ích.
    GUI (Converter Custom Text) chẳng khác gì là GUI mặc dù ghi = jass

    nếu bấm nút (Converter Custom Text) thì lấy đâu ra mà sai =))

    P/S: có thể ai đó khá rảnh rỗi up một map demo. spell Time Lapse by cr4xzZz được chuyển hết GUI = jass lên epicwar chăng :-?
     
    Chỉnh sửa cuối: 9/6/12
  11. langthangbairac

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

    Tham gia ngày:
    19/5/12
    Bài viết:
    594
    Nơi ở:
    Thanh Chương
    gui chuyển sang jass được hả. giờ em mới nghe đấy
     
  12. dh-g

    dh-g Fire in the hole!

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    [​IMG]
    thì vào phần Edit bấm Converter Custom Text là đươc...
     
  13. langthangbairac

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

    Tham gia ngày:
    19/5/12
    Bài viết:
    594
    Nơi ở:
    Thanh Chương
    thế jass -> gui có làm đc ko vậy ?
     
  14. dh-g

    dh-g Fire in the hole!

    Tham gia ngày:
    29/8/09
    Bài viết:
    2,654
    Nơi ở:
    Q1 TP.HCM
    cái đó thì converter = tay chứ Soft lành bó tay =))
     
  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
    Chỉ giùm vài cái thắc mắc nhỏ này cái :D chắc bạn biết nhỉ ??
     
  16. LeoNguyen112

    LeoNguyen112 Dragon Quest

    Tham gia ngày:
    22/5/10
    Bài viết:
    1,438
    Nơi ở:
    TP.HCM
    1. Pick Player group 1 rồi add pick player vào group 2
    2. Giật là giật thế nào? Code?
    3. Hướng dẫn tạo effect cho 1 vài player nhất định
    4. Sao không post vào topic hỏi đáp?
     
  17. World_Editor

    World_Editor Mr & Ms Pac-Man

    Tham gia ngày:
    6/6/12
    Bài viết:
    137
    Nơi ở:
    tpHCM
    Sẵn topic cho mình hỏi GUI, MUI và JASS là gì vậy
     
  18. Daric™

    Daric™ C O N T R A

    Tham gia ngày:
    7/3/12
    Bài viết:
    1,853
    Nơi ở:
    Porizon
    GUI: Tức là những trigger bình thường có ba dòng event, conditions, actions mà bạn có thể đưa các lệnh thực thi có sẵn bằng cách chuột phải-> add event, condition,action trong trigger đó.

    MUI: MUI Là một thuật ngữ để chỉ về việc trigger đó có thể thực hiện cùng một lúc (hay chênh lệch ở một phạm vi thời gian) hoặc nhiều bản thân khác sử dụng mà không bị lỗi.
    Lấy ví dụ đơn giản về một chiêu thức, thường thì bạn làm chiêu sử dụng lên một đối thủ, muốn gây ra dam sau 5s mà sử dụng hàm Wait 5.00s trong trigger , rồi sau đó sử dụng hàm deal dam và gán mục tiêu là một giá trị định sẵn (ex:set TargetUnit = GetSpellTargetUnit()) trước đó thì sẽ bị lỗi khi một đơn vị khác sử dụng chiêu thức đó trong phạm vi 5 giây.

    JASS: Là trigger và cũng có event, conditions, actions nhưng được hiển thị dưới hình thức text, nó phải nhờ người viết phân định ra đâu là event, đâu là conditions, đâu là actions qua các bộ hàm gọi là function. Tiện lợi của JASS hơn GUI ở chỗ là dễ dàng giúp người viết thực hiện MUI spell nếu biết cách sử dụng hợp lý.
    JASS được anh Tom-sama khuyên các bạn rành thạo nên học và viết các spell bằng JASS. :7onion68:
    Bạn đọc thêm về JASS ở đây nhé:http://forums.gamevn.com/showthread.php?485055-Tutorial-GUI-to-JASS

    p.s: Trả lời thui Tom-sama chém nhẹ em thui nhé :9cool_too_sad:
     
    Chỉnh sửa cuối: 9/6/12
  19. raivor

    raivor Dragon Quest Lão Làng GVN

    Tham gia ngày:
    24/7/09
    Bài viết:
    1,411
    GUI là viết tắt của graphical user interface, hiểu nôm na là lập trình bằng giao diện.
    Jass là ngôn ngữ lập trình của World Editor.
     
  20. langthangbairac

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

    Tham gia ngày:
    19/5/12
    Bài viết:
    594
    Nơi ở:
    Thanh Chương
    làm thằng bị trúng giật giật nhưng vẫn đứng 1 chỗ như skil black hole ấy
     

Chia sẻ trang này