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

Status
Không mở trả lời sau này.
Thực chất trong cùng 1 trigger thì dù hàm của cậu có remove unit đó, trừ khi set null giá trị unit ko thì sẽ lun lun lấy ra được GetUnitUserData và GetHandId thì kể cả trigger khác mà ko làm null nó thì vẫn lấy được.
Đây là trigger thử nghiệm của mình

Điều này nghĩa là khi lưu 1 Unit vào 1 biến rồi sau đó RemoveUnit nếu như ko đi kèm null biến đó thì ko có cách nào phân biệt unit chứ trong biến đó đã Remove hay chưa?
Nghĩa là

Sao ko dùng group thì chỉ cần 1 cái array và bao nhiêu unit cũng được
Vì quên :">. Tại đó h ít dùng group :D.
Mà tính ra mình vẫn dùng đc 1 arr cho 3 units nhở, ví dụ như cái trên

Thì mình dùng UnitB[GetUnitUserData(GetTriggerUnit())*3+0/1/2] để lấy unit B thứ 1/2/3 của A nhỉ :-?



Bạn thật may mắn hơn 1 số người đang sửa chữa map trên cái file war3map.j >"<

chém gió. chắc cả map đc ghi = jass nhỉ :-?

---------- Post added at 16:21 ---------- Previous post was at 15:31 ----------

quote lộn
<quote bài của langthangbairac nhé>
cho em hỏi cách làm -repick đi \m/
 
Ai chỉ mình làm lệnh swap ( hoán đổi Hero giữa các ng` chơi với nhau ), cụ thể là 6 ng` chơi và 6 Hero đc set theo biến Hero ( Unit )
 
Ai chỉ mình làm lệnh swap ( hoán đổi Hero giữa các ng` chơi với nhau ), cụ thể là 6 ng` chơi và 6 Hero đc set theo biến Hero ( Unit )
Bạn phải nói cụ thể 6 người chơi ở các slot nào, game của bạn là dạng 2 bên bem nhau như Dota hay cùng nhu bem máy (6 player có cùng 1 team ko?)
 
xin trả lời câu 2 của bạn nhé.
Trigger như thế này
Mã:
Event - Unit - A unit Acquires an item
Conditions
    (nhà 1 has an item of type item1) Equal to True
    (nhà 2 has an item of type item2) Equal to True
Actions
    .........
action thì của bạn nhé
và map demo là cho 2 item vô hai căn nhà, set đìu kịn, nếu đúng thì tạo 1 em foot giữa máp :
http://www.mediafire.com/?t7wx04c8u42mzn9

---------- Post added at 11:32 ---------- Previous post was at 11:23 ----------



trả lời cho bạn lun câu 2: lun, suy nghĩ mãi mới ra

trigger như thế này

Mã:
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to thu nghiem 
    Actions
        Set cast = (Triggering unit)
        Set target = (Target point of ability being cast)
        Unit - Create 1 dummy for (Owner of cast) at ((Position of cast) offset by <khoảng cách> towards (Angle from (Position of cast) to target) degrees) facing Default building facing degrees

bạn xem map demo
http://www.mediafire.com/?swvv5fr16kivnwe
Câu 1 ý mình bảo là xem bên ngoài chứ không phải là làm thể nào để kiểm tra khi vào game
Câu ^ mình biết rồi
Tiện cho mình hỏi :
1:Giờ mình muốn làm cái này : là khi 1 hero chạm vào 1 con unit (hay là đi vào nó) Thì sẽ chết
2:Ai tìm giúp mình skill passive kiểu như là khi đánh vào quái thì nó sẽ slow theo kiểu dính băng frost armor (Special)
 
Bạn phải nói cụ thể 6 người chơi ở các slot nào, game của bạn là dạng 2 bên bem nhau như Dota hay cùng nhu bem máy (6 player có cùng 1 team ko?)
Cùng 1 team rồi đổi cho nhau, mỗi ng` swap 1 lần thôi
 

Cùng 1 team rồi đổi cho nhau, mỗi ng` swap 1 lần thôi

Mình viết thử nè. Bản sửa phần tên biến chứa unit cho player tương ứng vào nhé.
Và bạn phải thêm 1 cái kiểm tra xem player đã chọn unit chưa nữa
Mã:
//Xai dc trong map co tu 1 den 12 player o slot 1 den 12, ko co ke thu
//Vi ban ko cung cap thong tin ve bao nhieu team, hay nay kia nen minh
//ko viet cu the dc
globals
integer array WannaSwap
endglobals

function Trg_Swap_Con takes nothing returns boolean
    local integer i1=GetPlayerId(GetTriggerPlayer())
    local integer i2=(S2I(SubString(GetEventPlayerChatString(),6,8))+1)
    //Khuc nay ban them kiem tra xem ca 2 Players da chon hero chua nhe!
    return i2<=12 and i2>=1 and i2!=i1 and WannaSwap[i1*6]!=-5 and WannaSwap[i2*6]!=-5
endfunction
function Trig_Swap_Actions takes nothing returns nothing
local player p= GetTriggerPlayer()
local player p2=Player(S2I(SubString(GetEventPlayerChatString(),6,8))+1)

    local integer index=0
    loop 
    exitwhen index>=6
        if WannaSwap[GetPlayerId(p)*6+index]==-1 then
            set WannaSwap[GetPlayerId(p)*6+index]=GetPlayerId(p2)
            set index=6
        elseif index==5 then
            set WannaSwap[GetPlayerId(p)*6]=GetPlayerId(p2)
        endif
    set index=index+1
    endloop
    set index=0
    loop
    exitwhen index>=6
        if WannaSwap[GetPlayerId(p2)*6+index]==GetPlayerId(p) then 
            set index=6
        endif
    set index=index+1
    endloop
    if index==7 and IsPlayerAlly(p,p2) then
        call SetUnitOwner([B][COLOR="#FF0000"]TenBienChuaUnitCuaNguoiGoLenhSwap[/COLOR][/B],p,true)
        call SetUnitOwner([B][COLOR="#FF0000"]TenBienChuaUnitCuaPlayerThu2[/COLOR][/B],p2,true)
        set  WannaSwap[GetPlayerId(p)*6]=-5 //-5 la da swap roi
        set  WannaSwap[GetPlayerId(p2)*6]=-5 //-5 la da swap roi
    endif
endfunction

//===========================================================================
function InitTrig_Swap takes nothing returns nothing
local integer i=0
local integer i2=0
    set gg_trg_Swap = CreateTrigger(  )
    //Dat gia tri muon swap cua tat ca = 0
    loop 
    exitwhen i>11
        set i2=0
        loop
        exitwhen i2>5
            set WannaSwap[i*6+i2]=-1
        set i2=i2+1
        endloop
        call TriggerRegisterPlayerChatEvent(gg_trg_Swap, Player(i), "-swap ",false)
    set i=i+1
    endloop
    call TriggerAddCondition(gg_trg_Swap,Condition(function Trg_Swap_Con))
    call TriggerAddAction( gg_trg_Swap,function Trig_Swap_Actions )
endfunction
 
Câu 1 ý mình bảo là xem bên ngoài chứ không phải là làm thể nào để kiểm tra khi vào game
Câu ^ mình biết rồi
Tiện cho mình hỏi :
1:Giờ mình muốn làm cái này : là khi 1 hero chạm vào 1 con unit (hay là đi vào nó) Thì sẽ chết
2:Ai tìm giúp mình skill passive kiểu như là khi đánh vào quái thì nó sẽ slow theo kiểu dính băng frost armor (Special)

1. no không hiểu ý bạn nói, là làm spell lun hay là vô game là đã có
 
trước khi di chuyển unit thì kiểm tra xem point này (TempLoc2) có ở trong Playable map area hay không
- có: di chuyển, tạo effect, phá cây
- không: dừng slide bằng cách đặt số tick = 0

Ngày trước có cái cách gì mà set point X, point Y gì ấy, mình ko biết gọi nó là gì, cách này cũng hay, nhưng mình cần cách kia ^^. Ko cần demo đâu ^^.
 
YAN[asian];21593083 nói:
Ngày trước có cái cách gì mà set point X, point Y gì ấy, mình ko biết gọi nó là gì, cách này cũng hay, nhưng mình cần cách kia ^^. Ko cần demo đâu ^^.

Mình ko biết nhưng mình nghĩ chắc như anh Tom chỉ :-s, có khác chăng là GetRectMinX/MinY/MaxX/MaxY so sánh thôi nhỉ ?
 
Vậy cho mình hỏi làm cách nào để slide 1 unit mà ko bị mất order?
 
YAN[asian];21593246 nói:
Vậy cho mình hỏi làm cách nào để slide 1 unit mà ko bị mất order?
Bạn dùng SetUnitX và SetUnitY thay cho SetUnitPostion :D
 
Như nào nhỉ bạn. Bạn làm cho mình 1 ví dụ đi. :)
 
function slide_ALLTHEUNIT takes nothing returns boolean
local unit u=GetFilterUnit()
call SetUnitX(u,GetUnitX(u)+1)
call SetUnitY(u,GetUnitY(u)+1)
return true
endfunction

function slideUnit_timer takes nothing returns nothing
local group g=CreateGroup()
call GroupEnumUnitsInRect(g,GetPlayableMapRect(),Filter(function slide_ALLTHEUNIT))

if FirstOfGroup(g)==null then
call DestroyTimer(GetExpiredTimer())
endif

call DestroyGroup(g)
set g=null
endfunction

function slideUnit_act takes nothing returns nothing //Cho Event nao do goi ham nay de test
local timer t=CreateTimer()
call TimerStart(t,0.01,true,function slideUnit_timer)
set t=null
endfunction
Mỗi 0.01 giây nó sẽ dịch toàn bộ Unit đi 1X 1Y cho đến khi ko còn unit trong đó :D

Sẵn đây cho mình hỏi sao SetUnitX SetUnitY cho unit loại building đc? nó bị lôi đi mất hình luôn :D
 
Chỉnh sửa cuối:
trước khi di chuyển unit thì kiểm tra xem point này (TempLoc2) có ở trong Playable map area hay không
- có: di chuyển, tạo effect, phá cây
- không: dừng slide bằng cách đặt số tick = 0

Sao mình làm đúng như thế mà ko đc nhỉ? Unit vẫn "trượt" dọc theo mép bản đồ..

[spoil]
Mã:
Arrow move
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        For each (Integer ArValue[3]) from 1 to ArMui[3], do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ARTICK[ArValue[3]] Equal to 130
                    Then - Actions
                        Unit - Add a 0.01 second Generic expiration timer to ARROW[ArValue[3]]
                        For each (Integer B) from ArValue[3] to (ArMui[3] - 1), do (Actions)
                            Loop - Actions
                                Set ARANGLE[(Integer B)] = ARANGLE[((Integer B) + 1)]
                                Set ARCHER[(Integer B)] = ARCHER[((Integer B) + 1)]
                                Set ARROW[(Integer B)] = ARROW[((Integer B) + 1)]
                                Set ARTICK[(Integer B)] = ARTICK[((Integer B) + 1)]
                                Set ARSTUN[(Integer B)] = ARSTUN[((Integer B) + 1)]
                        Set ArMui[3] = (ArMui[3] - 1)
                    Else - Actions
                        Set ARTICK[ArValue[3]] = (ARTICK[ArValue[3]] + 1)
                        Set ARSTUN[ArValue[3]] = (ARSTUN[ArValue[3]] + 0.10)
                        Set ArPoint[1] = (Position of ARROW[ArValue[3]])
                        Set ArPoint[2] = (ArPoint[1] offset by 26.00 towards ARANGLE[ArValue[3]] degrees)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                               [COLOR="#0000FF"]((Playable map area) contains ArPoint[2]) Equal to True[/COLOR]
                            Then - Actions
                                Unit - Move ARROW[ArValue[3]] instantly to ArPoint[2]
                                Custom script:   call RemoveLocation(udg_ArPoint[1])
                                Set ArPoint[1] = (Position of ARROW[ArValue[3]])
                                Set ArGroup[2] = (Units within 80.00 of ArPoint[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of ARCHER[ArValue[3]])) Equal to True) and ((Level of Locust  for (Matching unit)) Less than or equal to 0))))
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (ArGroup[2] is empty) Equal to False
                                    Then - Actions
                                        Set ARTICK[ArValue[3]] = 130
                                        Unit Group - Pick every unit in ArGroup[2] and do (Actions)
                                            Loop - Actions
                                                Set ArPoint[3] = (Position of (Picked unit))
                                                Unit - Create 1 Peasant for (Owner of ARCHER[ArValue[3]]) at ArPoint[3] facing Default building facing degrees
                                                Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                                                Unit - Add Alune Arrow  to (Last created unit)
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        ARSTUN[ArValue[3]] Greater than or equal to (Real((3 + (Level of Elunes Arrow  for ARCHER[ArValue[3]]))))
                                                    Then - Actions
                                                        Unit - Set level of Alune Arrow  for (Last created unit) to 7
                                                    Else - Actions
                                                        Unit - Set level of Alune Arrow  for (Last created unit) to (Integer(ARSTUN[ArValue[3]]))
                                                Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
                                                Custom script:   call RemoveLocation(udg_ArPoint[3])
                                                Special Effect - Create a special effect attached to the origin of ARROW[ArValue[3]] using Abilities\Weapons\BallistaMissile\BallistaImpact.mdl
                                                Special Effect - Destroy (Last created special effect)
                                                Unit - Cause ARCHER[ArValue[3]] to damage (Picked unit), dealing ((Real((75 x (Level of Elunes Arrow  for ARCHER[ArValue[3]])))) + 0.00) damage of attack type Pierce and damage type Normal
                                                Unit - Cause ARCHER[ArValue[3]] to damage (Picked unit), dealing ((Real(((Level of Elunes Arrow  for ARCHER[ArValue[3]]) x 5))) x ARSTUN[ArValue[3]]) damage of attack type Chaos and damage type Divine
                                                Floating Text - Create floating text that reads (+ + (String(((Integer(ARSTUN[ArValue[3]])) x ((Level of Elunes Arrow  for ARCHER[ArValue[3]]) x 5))))) above (Picked unit) with Z offset 0.00, using font size 11.00, color (0.00%, 50.00%, 100.00%), and 0.00% transparency
                                                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                                Floating Text - Change (Last created floating text): Disable permanence
                                                Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                                                Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
                                    Else - Actions
                            Else - Actions
                                Set ARTICK[ArValue[3]] = 130
                        Custom script:   call RemoveLocation(udg_ArPoint[1])
                        Custom script:   call RemoveLocation(udg_ArPoint[2])
                        Custom script:   call DestroyGroup(udg_ArGroup[2])
[/spoil]
 
Chỉnh sửa cuối:
YAN[asian];21593773 nói:
Sao mình làm đúng như thế mà ko đc nhỉ? Unit vẫn "trượt" dọc theo mép bản đồ..

[spoil]
Mã:
Arrow move
    Events
        Time - Every 0.03 seconds of game time
    Conditions
    Actions
        For each (Integer ArValue[3]) from 1 to ArMui[3], do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ARTICK[ArValue[3]] Equal to 130
                    Then - Actions
                        Unit - Add a 0.01 second Generic expiration timer to ARROW[ArValue[3]]
                        For each (Integer B) from ArValue[3] to (ArMui[3] - 1), do (Actions)
                            Loop - Actions
                                Set ARANGLE[(Integer B)] = ARANGLE[((Integer B) + 1)]
                                Set ARCHER[(Integer B)] = ARCHER[((Integer B) + 1)]
                                Set ARROW[(Integer B)] = ARROW[((Integer B) + 1)]
                                Set ARTICK[(Integer B)] = ARTICK[((Integer B) + 1)]
                                Set ARSTUN[(Integer B)] = ARSTUN[((Integer B) + 1)]
                        Set ArMui[3] = (ArMui[3] - 1)
                    Else - Actions
                        Set ARTICK[ArValue[3]] = (ARTICK[ArValue[3]] + 1)
                        Set ARSTUN[ArValue[3]] = (ARSTUN[ArValue[3]] + 0.10)
                        Set ArPoint[1] = (Position of ARROW[ArValue[3]])
                        Set ArPoint[2] = (ArPoint[1] offset by 26.00 towards ARANGLE[ArValue[3]] degrees)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Playable map area) contains ArPoint[2]) Equal to True
                            Then - Actions
                                Unit - Move ARROW[ArValue[3]] instantly to ArPoint[2]
                                Custom script:   call RemoveLocation(udg_ArPoint[1])
                                Set ArPoint[1] = (Position of ARROW[ArValue[3]])
                                Set ArGroup[2] = (Units within 80.00 of ArPoint[1] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of ARCHER[ArValue[3]])) Equal to True) and ((Level of Locust  for (Matching unit)) Less than or equal to 0))))
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        (ArGroup[2] is empty) Equal to False
                                    Then - Actions
                                        Set ARTICK[ArValue[3]] = 130
                                        Unit Group - Pick every unit in ArGroup[2] and do (Actions)
                                            Loop - Actions
                                                Set ArPoint[3] = (Position of (Picked unit))
                                                Unit - Create 1 Peasant for (Owner of ARCHER[ArValue[3]]) at ArPoint[3] facing Default building facing degrees
                                                Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                                                Unit - Add Alune Arrow  to (Last created unit)
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        ARSTUN[ArValue[3]] Greater than or equal to (Real((3 + (Level of Elunes Arrow  for ARCHER[ArValue[3]]))))
                                                    Then - Actions
                                                        Unit - Set level of Alune Arrow  for (Last created unit) to 7
                                                    Else - Actions
                                                        Unit - Set level of Alune Arrow  for (Last created unit) to (Integer(ARSTUN[ArValue[3]]))
                                                Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
                                                Custom script:   call RemoveLocation(udg_ArPoint[3])
                                                Special Effect - Create a special effect attached to the origin of ARROW[ArValue[3]] using Abilities\Weapons\BallistaMissile\BallistaImpact.mdl
                                                Special Effect - Destroy (Last created special effect)
                                                Unit - Cause ARCHER[ArValue[3]] to damage (Picked unit), dealing ((Real((75 x (Level of Elunes Arrow  for ARCHER[ArValue[3]])))) + 0.00) damage of attack type Pierce and damage type Normal
                                                Unit - Cause ARCHER[ArValue[3]] to damage (Picked unit), dealing ((Real(((Level of Elunes Arrow  for ARCHER[ArValue[3]]) x 5))) x ARSTUN[ArValue[3]]) damage of attack type Chaos and damage type Divine
                                                Floating Text - Create floating text that reads (+ + (String(((Integer(ARSTUN[ArValue[3]])) x ((Level of Elunes Arrow  for ARCHER[ArValue[3]]) x 5))))) above (Picked unit) with Z offset 0.00, using font size 11.00, color (0.00%, 50.00%, 100.00%), and 0.00% transparency
                                                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                                Floating Text - Change (Last created floating text): Disable permanence
                                                Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
                                                Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
                                    Else - Actions
                            Else - Actions
                                Set ARTICK[ArValue[3]] = 130
                        Custom script:   call RemoveLocation(udg_ArPoint[1])
                        Custom script:   call RemoveLocation(udg_ArPoint[2])
                        Custom script:   call DestroyGroup(udg_ArGroup[2])
[/spoil]
Tình hình là mình ko đọc GUI Trigger đc nhưng đại khái bạn phải chắc là mình kiểm tra cái "vị trị mà Unit SẼ đc set đến có trong PlayAbleArea ko" chứ ko phải là "kiểm tra vị trí Unit có trong PlayAbleArea ko"
 
Có! Dòng Conditions : "((Playable map area) contains ArPoint[2]) Equal to True" là để kiểm tra rồi đấy, ArPoint[1] là điểm của unit, ArPoint[2] là điểm unit sẽ move, mà vẫn ko đc. :?
 
Chỉnh sửa cuối:
YAN[asian];21594036 nói:
Có! Dòng Conditions : "((Playable map area) contains ArPoint[2]) Equal to True" là để kiểm tra rồi đấy, ArPoint[1] là điểm của unit, ArPoint[2] là điểm unit sẽ move, mà vẫn ko đc. :?

có thể bạn nên thử 1 rect nhỏ hơn playable area xem sao :D
 
Có cách nào khác để check 1 unit nhận damage đánh tay ngoài cách dùng các skill như Envenomed Spear, Poison Sting,..... không :-?
Em thấy Hero Tuskarr trong DotA dùng Ulti Warlush Punch của mình khi đang cầm Orb of Venom thì cả 2 đều hoạt động :-?
 
^
chắc là dummy creep làm, tuskar chỉ việc quơ tay 1 phát thực chất là đánh thường (có model khi mang chop tree) mà thôi :D

---------- Post added at 10:49 ---------- Previous post was at 09:49 ----------

bây giờ em muốn làm skill này nhưng nghĩ hoài ko ra, mong mọi ng giúp:
tạo 1 skill active, khi target là ally thì bom (heal) cho nó 100/200/300/400 HP, khi target là enemy thì gây (deal) 100/200/300/400 damage cho nó, khi target là self thì bom (heal) cho chính mình 100/200/300/400 HP
* đặc biệt: khi cast skill này thì thằng cast sẽ mất 50/100/150/200 HP :D
tks!!! \m/
 
Status
Không mở trả lời sau này.
Back
Top