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

Thảo luận trong 'World Editor' bắt đầu bởi Tom_Kazansky, 22/3/11.

Trạng thái chủ đề:
Không mở trả lời sau này.
  1. Tom_Kazansky

    Tom_Kazansky

    Tham gia ngày:
    28/12/06
    Bài viết:
    3,454
    Nơi ở:
    Hà Nội
    condition "(Local player)" lấy ở đâu ra vậy?

    "nhiễm" thì cũng "nhiễm" cho đúng chứ =))
     
  2. 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
    "(Local player)" cái này xuất hiện trong UMWSE và EGUi thì phải, em đang dùng cái này :-j nó như mã jass get localplayer
     
  3. orochi x

    orochi x Mr & Ms Pac-Man

    Tham gia ngày:
    20/7/10
    Bài viết:
    246
    cho mình hỏi 1 câu: sau khi đã làm cho quân spawn ở 1 region nào đó, đặt 1 building gần đấy rồi vào game phá hủy building thì quân sẽ ko spawn nữa thì làm thế nào?
     
  4. orochi x

    orochi x Mr & Ms Pac-Man

    Tham gia ngày:
    20/7/10
    Bài viết:
    246
    cho mình hỏi 1 câu: sau khi làm cho quân tự spawn ở 1 region nào đó, đặt 1 building bên cạnh rồi vào game cứ phá hủy building đó là quân ko spawn nưa thì làm the nào?
     
  5. DylandKyo

    DylandKyo Donkey Kong

    Tham gia ngày:
    28/10/10
    Bài viết:
    358
    cho bjn hỏi cái này cái. Trong 2 trigger này có cái này lỗi or leak or. .... mà sao khi vào dùng skill khoảng 2-3 lần là lag không thấy mặt trời lun @@ (2 cái khác nhau không liên quan, 1 cái là 1 skill )
    Trigger 1:
    Mã:
    Light Death
        Events
            Unit - A unit Starts the effect of an ability
        Conditions
            (Ability being cast) Equal to Light Death 
        Actions
            For each (Integer A) from 1 to 10, do (Actions)
                Loop - Actions
                    Set Caster[16] = (Triggering unit)
                    Set Points[16] = ((Position of Caster[16]) offset by 200.00 towards ((Real((Integer A))) x 36.00) degrees)
                    Special Effect - Destroy (Create a special effect using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl at Points[16])
                    Set UnitGroups[16] = (Units within 100.00 of Points[16] matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
                    Unit Group - Pick every unit in UnitGroups[16] and do (Actions)
                        Loop - Actions
                            Unit - Cause (Triggering unit) to damage (Picked unit), dealing ((100.00 + (100.00 x (Real((Level of Light Death  for (Triggering unit)))))) + (2.00 x (Real((Strength of (Triggering unit) (Include bonuses)))))) damage of attack type Spells and damage type Normal
                    Custom script:   call DestroyGroup(udg_UnitGroups[16])
                    Custom script:   call RemoveLocation(udg_Points[16])
    
    Trigger 2:
    Mã:
    scope FireMassing initializer init
    //>>>>>>>>>>>>>>>>>>>>>>>>>SETUP<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<//
    globals
        private constant integer SPELL_ID = 'A01P'
        private constant integer DUMMY_UNIT_ID = 'e008'
        private constant integer EFF_UNIT_ID = 'e007'
        private constant string EFF = "Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl"
                                    //"Abilities\\Weapons\\Rifle\\RifleImpact.mdl"
                                    //"Abilities\\Spells\\Human\\SpellSteal\\SpellStealMissile.mdl"
                                    //"Abilities\\Spells\\Other\\BreathOfFire\\BreathOfFireDamage.mdl"
                                    //"Abilities\\Spells\\Other\\Doom\\DoomDeath.mdl"
        
    endglobals
    //Advance:
    private function speed takes nothing returns real
        return 0.01 //lager value, more slower
    endfunction
    
    private function range takes nothing returns real
        return 1500.00 
    endfunction
    
    private function radius takes nothing returns real
        return 100.00 //the radius for detecting collision
    endfunction
    
    private function amount takes nothing returns integer
        return 10 //the numbers of arrow per cast
    endfunction
    
    private function dam takes integer aLevel returns real
        return ( ( 300.00 + ( 100.00 * aLevel ) ) + ( 3.00 * I2R(GetHeroStatBJ(bj_HEROSTAT_STR, GetTriggerUnit(), true)) ) )
    endfunction
    
    private function addOn takes unit trigUnit, unit dam2Unit returns nothing
        //this option is for advance user, you can add your code here to Make
        //more effect when the projectile impact to enemy. ex: knock back, dam over time...
    endfunction
    
    //>>>>>>>>>>>>>>>>>>>>>>>ENDSETUP<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<//
    
    //=================Confuse zone==============//
    //Dont edit this bunk of code unless you
    //really wanna do
    //===========================================//
    globals
        private constant real MOVE = 10.0 //distance that the projectile will move Per
                                          //*speed()* . You should'nt change this
        private constant real deviation = 10.0 //deviation between projectile
    endglobals
    
    
    
    
    private struct Projectile
        unit u//projectile
        unit uT// trigger unit
        real angle
        real moved = 0
        
        boolean stop = false
        
        method control takes nothing returns nothing
            local location moveLoc = PolarProjectionBJ(GetUnitLoc(.u), MOVE, .angle)
            //valriable for collision detect:
            local group cGrp = GetUnitsInRangeOfLocAll(radius(),moveLoc)
            local unit uDam
            
            //move the unit(projectile)
            call SetUnitPositionLoc(.u,moveLoc)
            
            //collision detect and dam enemy:
            set uDam = FirstOfGroup(cGrp)
            if uDam != null then
            
                loop
                    exitwhen uDam == null
                    if IsUnitEnemy(uDam,GetOwningPlayer(.uT)) and IsUnitAliveBJ(uDam) then 
                        
                        call UnitDamageTargetBJ(.uT, uDam, dam(GetUnitAbilityLevel(.uT,SPELL_ID)),ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC)
                        call addOn(.uT,uDam)
                        set .stop = true//need improve
                    endif
                    
                    call GroupRemoveUnit(cGrp,uDam)
                    
                    set uDam = FirstOfGroup(cGrp)
                endloop
                
                
            endif
            
            
            //out of range detect:
            if .moved < range() then
                set .moved = .moved + MOVE//if still in range, then set the .moved value go up
            else 
                set .stop = true
            endif
            
            //play animation
            if .stop then
                call DestroyEffect(AddSpecialEffectLoc(EFF,moveLoc))
            endif
            
            //remove leak
            call RemoveLocation(moveLoc)
            call DestroyGroup(cGrp)
            set moveLoc = null
            set cGrp = null
            set uDam = null
        endmethod
        
        
    endstruct
    
    globals
        private integer Total = 0
        private timer T = CreateTimer()
        private Projectile array pArr
    endglobals
    
                                      
    
    private function timerLoop takes nothing returns nothing
        local integer i = 0
        loop
            exitwhen(i >= Total)
         
            if pArr[i].stop then
                call KillUnit(pArr[i].u)//kill the projectile to not display it any more
                call pArr[i].destroy()//Not need this instance any more
                set Total=Total-1//degrease the Total by 1
                if Total > 0 then
                    set pArr[i]=pArr[Total]
                    set i=i-1//if not the loops will forget to handle the pArr[Total] ^^
                else
                    call PauseTimer(T)
                endif
            else
                call pArr[i].control()
            endif
            
        
            set i = i + 1
        endloop
     
        //call BJDebugMsg("yeah")
    endfunction
    
    //extra function for formula caculate:
    private function angleCalculate takes real angle, integer iAddOne returns real
        local real result = 0
        //==========for div number of *amount()*:
        local real halfDev //deviation / 2
        local real cen1
        local real cen2
        local integer cen1Index
        local integer cen2Index
        //==========for odd number of *amount()*:
        local integer cenIndex
        local real cen
        
        //div:
        if ModuloInteger(amount(),2)==0 then
            //call BJDebugMsg("so chan")
            set halfDev = deviation/2
            set cen1 = angle - halfDev
            set cen2 = angle + halfDev
            set cen1Index = amount()/2
            set cen2Index = cen1Index + 1
            
            if iAddOne == cen1Index then
                set result = cen1
            elseif iAddOne < cen1Index then
                set result = cen1 - deviation*(cen1Index - iAddOne)
            elseif iAddOne == cen2Index then
                set result = cen2
            elseif iAddOne > cen2Index then
                set result = cen2 + deviation*(iAddOne - cen2Index)
            endif
            
            
        //odd:    
        else
            //call BJDebugMsg("so le")
            set cen = angle
            set cenIndex = ((amount() - 1)/2) + 1
            
            if iAddOne == cenIndex then
                set result = angle
            elseif iAddOne > cenIndex then
                set result = cen - (deviation*(iAddOne - cenIndex))
            else
                set result = cen + (deviation*(cenIndex - iAddOne))
            endif
        endif
        
        return result
    endfunction
    
    //====================end=====================//
    
    
    //Condition================================================================
    private function condition takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endfunction
    
    //Actions==================================================================
    
    
    private function Actions takes nothing returns nothing
        local player pT =  GetOwningPlayer(GetTriggerUnit())
        local location tar = GetSpellTargetLoc()
        local location self = GetUnitLoc(GetTriggerUnit())
        local real deg = AngleBetweenPoints(self,tar)
        local Projectile p
        //
        local integer iPlus = 1
        
    
        
        if Total == 0 then
            call TimerStart (T, speed(), true, function timerLoop)
        endif
       
        //
        loop
        exitwhen iPlus > amount()
            set p = Projectile.create()
            set p.u = CreateUnitAtLoc(pT,EFF_UNIT_ID,self,angleCalculate(deg,iPlus))
            set p.angle = angleCalculate(deg,iPlus)
            set p.uT = GetTriggerUnit()
            
            //call BJDebugMsg(R2S(angleCalculate(deg,iPlus)))
            //call BJDebugMsg(I2S(Total))
            
            set pArr[Total] = p
            set Total = Total + 1
        
            set iPlus = iPlus + 1
        endloop
        
        //remove leak
        set pT = null
        call RemoveLocation(tar)
        call RemoveLocation(self)
        set tar = null
        set self = null
     
    endfunction
    
    //Initializer==============================================================
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger(  )
        call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
        call TriggerAddAction( t, function Actions )
        call TriggerAddCondition(t,Condition(function condition))
    endfunction
    
    endscope
     
  6. AzuhaSky

    AzuhaSky T.E.T.Я.I.S

    Tham gia ngày:
    30/5/10
    Bài viết:
    550
    Nơi ở:
    WE Box
    UMSWE cậu ạ!
    Còn đối với Trigger thứ nhất của DylandKyo thì Set Variable unit đến 10 lần liên tiếp,như vậy sẽ rất lag,nên dời giá trị đó ra ngoài vùng loop!
     
  7. Diệp Thanh

    Diệp Thanh Kirin Tor Moderator Lão Làng GVN

    Tham gia ngày:
    7/2/04
    Bài viết:
    4,034
    UMSWE nó có chạy được với patch mới đâu mà cố xài cho nó lỗi ra o.O
     
  8. *darkman*

    *darkman* Mr & Ms Pac-Man

    Tham gia ngày:
    2/1/09
    Bài viết:
    278
    Ai làm spell khi cast đối tượng thì hero chạy tới đối tượng tấn công đối tượng đã cast ? Thanks nhìu
     
  9. DylandKyo

    DylandKyo Donkey Kong

    Tham gia ngày:
    28/10/10
    Bài viết:
    358
    Mã:
    Leap of Death
        Events
            Unit - A unit Starts the effect of an ability
        Conditions
            (Ability being cast) Equal to Leap of Death 
        Actions
            Set Caster[20] = (Triggering unit)
            Set Points[20] = (Target point of ability being cast)
            Set Dame[9] = ((400.00 + (100.00 x (Real((Level of Leap of Death  for Caster[20]))))) + (3.50 x (Real((Strength of Caster[20] (Include bonuses))))))
            Unit - Create 1 Dummy for (Owner of Caster[20]) at Points[20] facing Default building facing degrees
            Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
            Unit - Move Caster[20] instantly to Points[20]
            EGUI Effect - Create a ring of effects at Points[20] with a radius of 300.00 using 6 effects using the model Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl that lasts for 2.00 seconds
            EGUI Leak - Destroy (Last created special effect)
            EGUI Effect - Create an effect at Points[20] using the model Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl that lasts for 2.00 seconds
            Set UnitGroups[20] = (Units within (150.00 x (Real((Level of (Ability being cast) for Caster[15])))) of Points[20] matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) is in K_Group[2]) Equal to False)) and (((Owner of (Matching unit)) is an enemy of (Owner
            Unit Group - Pick every unit in UnitGroups[20] and do (Actions)
                Loop - Actions
                    Unit - Cause Caster[20] to damage (Picked unit), dealing Dame[9] damage of attack type Chaos and damage type Universal
                    Camera - Shake the camera for (Owner of (Picked unit)) with magnitude 3.00
                    Camera - Sway the camera target for (Owner of (Picked unit)) with magnitude 20.00 and velocity 5.00
                    Unit Group - Add (Picked unit) to K_Group[2]
            EGUI Leak - Remove Points[20]
            EGUI Leak - Destroy UnitGroups[20]
            Set Caster[20] = No unit
    
    cho bjn hỏi ở trigger trên có sai chỗ nào? mà sao khi cast spell thì không gây ra dame, và k có cooldown @@ (do skill này tự làm 100% nên mới bị nhìu lỗi @@)
     
  10. AzuhaSky

    AzuhaSky T.E.T.Я.I.S

    Tham gia ngày:
    30/5/10
    Bài viết:
    550
    Nơi ở:
    WE Box
    Bạn đã đưa ra điều kiện như vậy,mình xin hỏi K_Group array trong điều kiện của UnitGroup[20] là gì thế?Khuyên bạn nên pick bằng cách sử dụng hàm GroupEnumUnitsInRange của vJass chắc dễ sử dụng hơn!
    cái thứ hai là bạn nên để hàm move unit sau một Wait Time lớn hơn giá trị chờ là 0.0,như vậy thì Cooldown của spell mới thực hiện được!

    ---------- Post added at 18:45 ---------- Previous post was at 18:43 ----------

    Chạy với Patch là sao cậu?
    Thường UMSWE cũng tùy vào phiên bản của Jasshelper và của Patch game war3,nếu chạy không phù hợp thì nên cài lại Jassnewgen 1.5d để nó tự tìm lại mục chứa patch của W3!Mình bị rồi!Nói chung,nếu phiên bản Jasshelper hiện đại hơn Patch game,có sử dụng cũng khó hỗ trợ được,còn Patch game mới,jasshelper cũ thì không làm gì bằng vJass kiểu mới được luôn!
     
    Chỉnh sửa cuối: 15/5/11
  11. DylandKyo

    DylandKyo Donkey Kong

    Tham gia ngày:
    28/10/10
    Bài viết:
    358
    bạn thử cho mình một ví dụ về pick group đi cái này mình k bík làm @@
     
  12. AzuhaSky

    AzuhaSky T.E.T.Я.I.S

    Tham gia ngày:
    30/5/10
    Bài viết:
    550
    Nơi ở:
    WE Box
    Bạn nên convert từ trigg thường sang Custom text ,rồi gõ vào sau
    Mã:
    private function KiểmTra takes nothing returns boolean
       return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())) and IsUnitAliveBJ(GetFilterUnit())==true 
    endfunction
    
    function CáiGìĐây takes nothing returns nothing
       local group G = CreateGroup()
       local unit enum
       local real dam = sát thương bạn đưa ra
       call GroupEnumUnitsInrange(G,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),400,Condition(function KiểmTra))
       loop
          set enum=FirstOfGroup(G)
          exitwhen (enum==null)
          call UnitDamageTarget(GetTriggerUnit(),enum, dam,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_ENHANCED,null)
          call GroupRemoveUnit(enum)
       endloop
       call GroupClear(G)
       set enum=null
       call DestroyGroup(G)
    endfunction
    
    Trong hàm trên,400 là khoảng cách gây,GetUnitX,GetUnitY là điểm X,Y của Mục tiêu gom nhóm,nếu thay vì gom nhóm tại một mục tiêu,bạn có thể gom nhóm tại một địa điểm,như GetLocationX (Địa điểm),GetLocationY(Địa điểm)
     
    Chỉnh sửa cuối: 15/5/11
  13. YAN[asian]

    YAN[asian] Mario & Luigi

    Tham gia ngày:
    27/3/07
    Bài viết:
    812
    . ...
     
  14. AzuhaSky

    AzuhaSky T.E.T.Я.I.S

    Tham gia ngày:
    30/5/10
    Bài viết:
    550
    Nơi ở:
    WE Box
    Mình không có rồi,nhưng bạn thử diễn tả lại chiêu thức đó xem,nếu có thể mình làm!
     
  15. YAN[asian]

    YAN[asian] Mario & Luigi

    Tham gia ngày:
    27/3/07
    Bài viết:
    812
    À đó là skill khi hú lên sẽ cộng dam cho Hero = % máu hiện tại của nó (add = abi +dam), check theo thời gian, cứ máu giảm thì dam cũng giảm. Ngày trước xem cũng hiểu hiểu mà lâu ko động quên xừ nó rồi x_x.
     
    Chỉnh sửa cuối: 15/5/11
  16. 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
    ví dụ như thế
    Mã:
    Respawn
        Events
            Time - Every 15.00 seconds of game time
        Conditions
        Actions
            Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
    
    đây là trigger Respawn còn về turn off thì cái này.
    Mã:
    TurnOff Respawn
        Events
            Unit - Barracks 0000 <gen> Dies
        Conditions
        Actions
            Trigger - Turn off Respawn <gen>
    
    
    @DylandKyo
    Mã:
    (Line: 10) (Word: 3) Location Leak
    Set Points[16] = ((Position of Caster[16]) offset by 200.00 towards ((Real((Integer A))) x 36.00) degrees)
    Set Points[16] = ^Leak
    
    (Line: 10) (Word: 6) Location Leak
    Set Points[16] = ((Position of Caster[16]) offset by 200.00 towards ((Real((Integer A))) x 36.00) degrees)
    Set Points[16] = ((Position of Caster[16]) ^Leak
    
    Scan Complete
    Location leaks: 2
    Special Effect leaks: 0
    Lightning leaks: 0
    Unit Group leaks: 0
    Player Group leaks: 0
    
    Variables
    UnitGroups[16] : (Line: 12) Unit Group - Removed: Yes
    
    Summary
    Total Leaks: 2
    Unremoved Variables: 0
    Scan duration: 0 seconds
    Total Lines Scanned: 17
    Total Words Scanned: 159
    
    tổng số check ra là như thế :|
    UMSWE lỗi chẳng bằng EGUi đâu anh rex à =))


    mình ví dụ như thế nhé :D
    Mã:
    Move
        Events
            Unit - A unit Starts the effect of an ability
        Conditions
            (Ability being cast) Equal to Storm Bolt
        Actions
            Set Tmp_Cast = (Triggering unit)
            Set Tmp_Vitm = (Target unit of ability being cast)
            Unit - Order Tmp_Cast to Attack Tmp_Vitm
            Wait until ((Distance between (Position of Tmp_Cast) and (Position of Tmp_Vitm)) Less than or equal to 200.00), checking every 0.10 seconds
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                Then - Actions
                    Unit - Cause Tmp_Cast to damage Tmp_Vitm, dealing 500.00 damage of attack type Spells and damage type Normal
                Else - Actions
    
    
     

    Các file đính kèm:

    • Temp.rar
      Kích thước:
      16 KB
      Đọc:
      2
    *darkman* thích bài này.
  17. AzuhaSky

    AzuhaSky T.E.T.Я.I.S

    Tham gia ngày:
    30/5/10
    Bài viết:
    550
    Nơi ở:
    WE Box
    Đây,chiêu thức bạn cần gửi theo file dính kèm!Mỹ mãn rồi nhé!
    View attachment Damage Based on Life.rar
     
  18. DylandKyo

    DylandKyo Donkey Kong

    Tham gia ngày:
    28/10/10
    Bài viết:
    358
    @Sky ở cái trên sky đưa là cover từ 1 cái mới hay là cover từ cái củ của bjn
     
  19. YAN[asian]

    YAN[asian] Mario & Luigi

    Tham gia ngày:
    27/3/07
    Bài viết:
    812
    Quên mất, ý mình là bằng GUI, mình mù Jass >_<!
     
  20. protectq2007

    protectq2007 Donkey Kong

    Tham gia ngày:
    17/10/07
    Bài viết:
    378
    Cho e hỏi là vd e làm 1 skill summon max là 3 unit thì khi summon lần thứ 4 thì làm sao để unit đầu tiên biến mất ?? :-/
     
Trạng thái chủ đề:
Không mở trả lời sau này.

Chia sẻ trang này