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

Status
Không mở trả lời sau này.
Mã:
[COLOR="#0000FF"]Ownership Item[/COLOR]
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Custom value of [b](Item being manipulated))[/b] Equal to 0
            Then - Actions
                Item - Set the custom value of [b](Item being manipulated)[/b] to (Player number of (Triggering player))
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Custom value of [b](Item being manipulated))[/b] Equal to (Player number of (Triggering player))
                    Then - Actions
                    Else - Actions
                        Hero - Drop (Item being manipulated) from (Triggering unit)
                        Game - Display to (Player group((Owner of (Triggering unit)))) the text: This item does not ...

Đây là Trigger chống không cho Player khác nhặt Item đã có chủ.. thực hiện = Custom Value của Item đó.. Nhìn đơn giản nhưng hiệu quả...

Anh cho em hỏi những dòng in đậm Item being manipulated thì tìm chúng ở đâu ạ? Anh có thể chỉ rõ cho em đường dẫn đến nó đc ko?
 
Mã:
Trigger 1- Revive Hero
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) is A Hero) Equal to True
    Actions
        Unit Group - Add (Dying unit) to RevivableHeroes
        Set TempReal = (((Real((Hero level of (Dying unit)))) x Hero_Revive_Time_Factor) + 5.00)
        If (UberMode_On Equal to True) then do (Set TempReal = (TempReal x 0.50)) else do (Do nothing)
        Countdown Timer - Start ReviveTimers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in TempReal seconds
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Multiboard_ShowDeaths Equal to False
            Then - Actions
                Countdown Timer - Create a timer window for (Last started timer) with title (Name of (Owner of (Dying unit)))
                Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
                Set RevivableTimersWindows[(Player number of (Owner of (Dying unit)))] = (Last created timer window)
            Else - Actions

Trigger 2 - Revive Hero Timer
    Events
        Time - ReviveTimers[2] expires
        Time - ReviveTimers[3] expires
        Time - ReviveTimers[4] expires
        Time - ReviveTimers[5] expires
        Time - ReviveTimers[6] expires
        Time - ReviveTimers[8] expires
        Time - ReviveTimers[9] expires
        Time - ReviveTimers[10] expires
        Time - ReviveTimers[11] expires
        Time - ReviveTimers[12] expires
    Conditions
    Actions
        Unit Group - Pick every unit in RevivableHeroes and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Remaining time for ReviveTimers[(Player number of (Owner of (Picked unit)))]) Less than 1.00
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                ((Owner of (Picked unit)) is in PlayersSentinel) Equal to True
                            Then - Actions
                                Hero - Instantly revive (Picked unit) at (Center of HeroCreationSentinel <gen>), Show revival graphics
                            Else - Actions
                                Hero - Instantly revive (Picked unit) at (Center of HeroCreationScourge <gen>), Show revival graphics
                    Else - Actions

Trigger 3 - Revive Hero Tavern
    Events
        Unit - A unit Finishes reviving
    Conditions
        ((Reviving Hero) is in RevivableHeroes) Equal to True
    Actions
        Unit Group - Remove (Reviving Hero) from RevivableHeroes
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Multiboard_ShowDeaths Equal to True
            Then - Actions
                Multiboard - Set the text for (Last created multiboard) item in column 2, row Multiboard_Spots[(Player number of (Owner of (Reviving Hero)))] to  
            Else - Actions
                Countdown Timer - Destroy RevivableTimersWindows[(Player number of (Owner of (Reviving Hero)))]
        Camera - Pan camera for (Owner of (Reviving Hero)) to (Position of (Reviving Hero)) over 0.60 seconds
        Selection - Select (Reviving Hero) for (Owner of (Reviving Hero))
NẾU CÓ GÌ SAI A DOWN MAP VỀ XEM DÙM E NHA CẢM ƠN A TRC \:D/

Ở đây thiếu 1 Variable type TimerWindow.. vì thế cho nên khi tạo một cái bảng Coundown Timer bạn không đặt biến cho nó thì tới lúc 1 cái Event mới xảy ra nó sẽ tạo 1 cái TimerWindow đè lên.. thế là đứt cái Trigger của bạn..

Đây là đoạn sai
Then - Actions
Countdown Timer - Create a timer window for (Last started timer) with title (Name of (Owner of (Dying unit)))
Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
Set RevivableTimersWindows[(Player number of (Owner of (Dying unit)))] = (Last created timer window)

.. Hướng giải quyết.

Anh cho em hỏi những dòng in đậm Item being manipulated thì tìm chúng ở đâu ạ? Anh có thể chỉ rõ cho em đường dẫn đến nó đc ko?
Bạn thử tạo 1 biến có tên bất kì nhưng Type là Item.. sau đó [Set Variable] cái biến đó = (...)
khi click vào sẽ thấy Item being manipulated ...
Nếu không hiểu biến là gì có thể hiểu đơn giản.. Nó như 1 hình nhân thế mạng.. một thứ đại diện cho một thứ khác.. khi dùng lệnh Set nghĩa là đặt nó tương đương với thứ khác mà mình nói tới ở trên.. còn khó hiểu quá thì chắc phải tìm lại các bài đã post trên 4rum để dần dần hiểu.

---------- Post added at 23:02 ---------- Previous post was at 23:00 ----------

Oái nhằm rồi.. không đọc kĩ

---------- Post added at 23:04 ---------- Previous post was at 23:02 ----------

Bỏ đoạn này đi nha... sr...
Ở đây thiếu 1 Variable type TimerWindow.. vì thế cho nên khi tạo một cái bảng Coundown Timer bạn không đặt biến cho nó thì tới lúc 1 cái Event mới xảy ra nó sẽ tạo 1 cái TimerWindow đè lên.. thế là đứt cái Trigger của bạn..

Đây là đoạn sai


---------- Post added at 23:29 ---------- Previous post was at 23:04 ----------

Ok.. bắt mạch được rồi.. haizz.. là do cách bạn đặt biến..
Đối với Timer và TimerWindow thì bạn phải đặt Array của nó = 12 để trách việc lỗi trên...

Ps: Copy Template của DotA thì phải check kỹ lại maps đó nhé.
 
Em tạo 1 variable tên là Item và Type nó là Item, khi Set em để là "Set Item = Item being manipulated

Nhưng ở Condition Custom value of Unit thì em ko tìm đc Variable Item đâu, phiền anh có thể làm dùm em hoặc chỉ rõ được ko ?
 
Em tạo 1 variable tên là Item và Type nó là Item, khi Set em để là "Set Item = Item being manipulated

Nhưng ở Condition Custom value of Unit thì em ko tìm đc Variable Item đâu, phiền anh có thể làm dùm em hoặc chỉ rõ được ko ?

Condition - Integer - Custom value of Item
 
ai chỉ em làm sao để xài nhiều loại terrain được không , hôm qua có xem qua cái map gì đấy bên topic terrain anh gửi thấy nó xài nhiều terrain thế mà không biết làm thế nào

không ai trả lời em hết à, khó quá nhỉ
 
Đây hình như là một hiệu ứng của Skill vậy DAMAGE_TYPE_UNIVERSAL là gì vậy? Mình thấy có khá nhièu loại damage type nó có ảnh hưởng như thế nào đến độ sát thương? Làm ơn cho mình biết rõ sự khác nhau của: DAMAGE_TYPE_UNIVERSAL, DAMAGE_TYPE_NORMAL, DAMAGE_TYPE_DEVINE

Đây là cách sử lý của war3 cho DAMAGE_TYPE
Còn đầy là cho ATTACK_TYPE
Nói ngắn gọn như sau:
Lượng damage gây ra cho unit to hay nhỏ thì tùy thuộc vào attack type và armor
Còn damage type cho biết tính damage có qua phần tính giáp hay ko hay ăn thẳng vào máu
 
cho hỏi đoan code là là ntn vậy :D công dụng ntn
Mã:
//TESH.scrollpos=-1
//TESH.alwaysfold=0
function IsUnitNearUnit takes unit u1,unit u2 returns boolean
local real x1=GetUnitX(u1)
local real y1=GetUnitY(u1)
local real x2=GetUnitX(u2)
local real y2=GetUnitY(u2)
local real distance=SquareRoot((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1))
local real MaxDistance=1200.//____________ __________,
// __ _______ _______ _____ "______" ___ ____ _________ _____
    return distance<=MaxDistance
endfunction

function IsUnitInHome takes unit u returns boolean
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real tx=LoadReal(udg_ah,GetHandleId(u),StringHash("HomeX"))
local real ty=LoadReal(udg_ah,GetHandleId(u),StringHash("HomeY"))
local real distance=SquareRoot((tx - x) * (tx - x) + (ty - y) * (ty - y))
local real MaxDistance=1200.//____________ __________,
// __ _______ _______ _____ "______" ___ __ ___ _____ ______ ______
    return distance<MaxDistance
endfunction

function GetAggreUnit takes unit u,unit target,group gn returns unit
local unit f
local group g=CreateGroup()
local real agre
local real agre2
call GroupAddGroup(gn,g)
loop 
    set f=FirstOfGroup(g)
exitwhen f==null
    set agre=LoadReal(udg_ah,GetHandleId(u),GetHandleId(f))
    set agre2=LoadReal(udg_ah,GetHandleId(u),GetHandleId(target))
if agre>agre2 and IsUnitVisible(f,Player(PLAYER_NEUTRAL_PASSIVE)) and IsUnitNearUnit(f,u) and not IsUnitType(f,UNIT_TYPE_DEAD) and GetUnitState(f,UNIT_STATE_LIFE)>0.405  then
    set target=f
endif
    call DisplayTextToForce( GetPlayersAll(), GetUnitName(f)+ " agre is "+R2S(agre))
    call GroupRemoveUnit(g,f)
endloop
    call DestroyGroup(g)
set g=null
set f=null
return target
endfunction

function Trig_AttackTaken_Conditions takes nothing returns boolean
    return GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_PASSIVE)
endfunction

function GoHome_Remove takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer id=GetHandleId(t)
local unit u=LoadUnitHandle(udg_ah,id,0)
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local real tx=LoadReal(udg_ah,GetHandleId(u),StringHash("HomeX"))
local real ty=LoadReal(udg_ah,GetHandleId(u),StringHash("HomeY"))
local real distance=SquareRoot((tx - x) * (tx - x) + (ty - y) * (ty - y))
local trigger trg=LoadTriggerHandle(udg_ah,GetHandleId(u),StringHash("DamageTakenTrigger"))
local real HomeDistance=100.//__________,_______ __ _______ _ ________ _______,_______
// _____ ______ ___ _ ________ ______
if distance<=HomeDistance then
    call EnableTrigger(trg)
    call PauseTimer(t)
    call DestroyTimer(t)
    call FlushChildHashtable(udg_ah,id)
endif
set u=null
set t=null
set trg=null
endfunction

function Agre_Remove takes nothing returns nothing
local timer t=GetExpiredTimer()
local integer id=GetHandleId(t)
local integer i1=LoadInteger(udg_ah,id,0)
local unit Attacker=LoadUnitHandle(udg_ah,id,1)
local real Damage=LoadReal(udg_ah,id,2)
local real DamageTaken=LoadReal(udg_ah,i1,GetHandleId(Attacker))-Damage
local group DamageGroup=LoadGroupHandle(udg_ah,i1,StringHash("DamagedNeutralGroup"))
if DamageTaken==0. then
    call GroupRemoveUnit(DamageGroup,Attacker)
    call SaveGroupHandle(udg_ah,i1,StringHash("DamagedNeutralGroup"),DamageGroup)
endif
    call SaveReal(udg_ah,i1,GetHandleId(Attacker),DamageTaken)
    call PauseTimer(t)
    call DestroyTimer(t)
    call FlushChildHashtable(udg_ah,id)
set DamageGroup=null
set t=null
set Attacker=null
endfunction

function Trig_DamageTaken_Conditions takes nothing returns boolean
local trigger DamageCheck=GetTriggeringTrigger()
local unit Damaged=LoadUnitHandle(udg_ah,GetHandleId(DamageCheck),0)
local integer DamagedId=GetHandleId(Damaged)
local unit Attacker=GetEventDamageSource()
local integer AttackerId=GetHandleId(Attacker)
local real Damage=GetEventDamage()
local group DamagedNeutralGroup=LoadGroupHandle(udg_ah,DamagedId,StringHash("DamagedNeutralGroup"))
local unit Target
local real DamageTaken=LoadReal(udg_ah,DamagedId,AttackerId)+Damage
local timer AgreRemoveTimer=CreateTimer()
local integer Timerid=GetHandleId(AgreRemoveTimer)
local timer GoHomeTimer
local integer GoHomeTimerId
local real AggreRemove=10.//_____,_____ _______ __________ ________ ____ _____ ___________
call SaveReal(udg_ah,DamagedId,AttackerId,DamageTaken)
call DisplayTextToForce( GetPlayersAll(), "Damage is taken by "+GetUnitName(Attacker)+" is "+R2S(Damage))
call SaveInteger(udg_ah,Timerid,0,DamagedId)
call SaveUnitHandle(udg_ah,Timerid,1,Attacker)
call SaveReal(udg_ah,Timerid,2,Damage)
call SaveReal(udg_ah,Timerid,3,0.)
call TimerStart(AgreRemoveTimer,AggreRemove,false,function Agre_Remove)
if GetUnitState(Damaged,UNIT_STATE_LIFE)<0.405 and IsUnitType(Damaged,UNIT_TYPE_DEAD) or Damage>GetUnitState(Damaged,UNIT_STATE_LIFE) then
    call TriggerClearConditions(DamageCheck)
    call DestroyTrigger(DamageCheck)
    call FlushChildHashtable(udg_ah,DamagedId)
    call FlushChildHashtable(udg_ah,GetHandleId(DamageCheck))
endif
    set Target=GetAggreUnit(Damaged,Attacker,DamagedNeutralGroup)
if IsUnitInHome(Damaged) then
if Target!=null then
    call IssueTargetOrder(Damaged,"attack",Target)
    call DisplayTextToForce( GetPlayersAll(), "Go to attack a "+GetUnitName(Target))
elseif Target==null then
    call IssuePointOrder(Damaged,"move",LoadReal(udg_ah,DamagedId,StringHash("HomeX")),LoadReal(udg_ah,DamagedId,StringHash("HomeY")))
    call DisplayTextToForce( GetPlayersAll(), "Go home ")
    call DisableTrigger(DamageCheck)
    set GoHomeTimer=CreateTimer()
    set GoHomeTimerId=GetHandleId(GoHomeTimer)
    call SaveUnitHandle(udg_ah,GoHomeTimerId,0,Damaged)
    call TimerStart(GoHomeTimer,0.5,true,function GoHome_Remove)
endif
elseif not IsUnitInHome(Damaged) then
    call IssuePointOrder(Damaged,"move",LoadReal(udg_ah,DamagedId,StringHash("HomeX")),LoadReal(udg_ah,DamagedId,StringHash("HomeY")))
    call DisplayTextToForce( GetPlayersAll(), "Go home ")
    call DisableTrigger(DamageCheck)
    set GoHomeTimer=CreateTimer()
    set GoHomeTimerId=GetHandleId(GoHomeTimer)
    call SaveUnitHandle(udg_ah,GoHomeTimerId,0,Damaged)
    call TimerStart(GoHomeTimer,0.5,true,function GoHome_Remove)
endif
set GoHomeTimer=null
set AgreRemoveTimer=null
set Damaged=null
set Attacker=null
set DamagedNeutralGroup=null
set DamageCheck=null
return true
endfunction

function Trig_AttackTaken_Actions takes nothing returns nothing
local unit Damaged=GetTriggerUnit()
local integer DamagedId=GetHandleId(Damaged)
local unit Attacker=GetAttacker()
local group DamagedNeutralGroup=LoadGroupHandle(udg_ah,DamagedId,StringHash("DamagedNeutralGroup"))
local trigger DamageCheck
local real DamagedX=GetUnitX(Damaged)
local real DamagedY=GetUnitY(Damaged)
local real PeriodicAttack=1.//______,_____ _______ _______ _____ ________
// ____ ___ _____,_____ ___ _______,_____ _______ ________ ____
if HaveSavedHandle(udg_ah,DamagedId,StringHash("DamagedNeutralGroup")) and not IsUnitInGroup(Attacker,DamagedNeutralGroup) then
    call GroupAddUnit(DamagedNeutralGroup,Attacker)
    call SaveGroupHandle(udg_ah,DamagedId,StringHash("DamagedNeutralGroup"),DamagedNeutralGroup)
elseif not HaveSavedHandle(udg_ah,DamagedId,StringHash("DamagedNeutralGroup")) then
    set DamagedNeutralGroup=CreateGroup()
    call GroupAddUnit(DamagedNeutralGroup,Attacker)
    call SaveGroupHandle(udg_ah,DamagedId,StringHash("DamagedNeutralGroup"),DamagedNeutralGroup)
    call DisplayTextToForce( GetPlayersAll(), "DamageGroup Is Create") 
if not HaveSavedHandle(udg_ah,DamagedId,StringHash("DamageTakenTrigger")) then
    set DamageCheck=CreateTrigger()
    call TriggerRegisterUnitEvent( DamageCheck, Damaged, EVENT_UNIT_DAMAGED )
    call TriggerRegisterTimerEvent(DamageCheck, PeriodicAttack, true)
    call TriggerAddCondition( DamageCheck, Condition( function Trig_DamageTaken_Conditions ) )
    call SaveTriggerHandle(udg_ah,DamagedId,StringHash("DamageTakenTrigger"),DamageCheck)
    call SaveUnitHandle(udg_ah,GetHandleId(DamageCheck),0,Damaged)
endif
    call SaveReal(udg_ah,DamagedId,StringHash("HomeX"),DamagedX)
    call SaveReal(udg_ah,DamagedId,StringHash("HomeY"),DamagedY)
endif
set Damaged=null
set Attacker=null
set DamagedNeutralGroup=null
set DamageCheck=null
endfunction

//===========================================================================
function InitTrig_AttackTaken takes nothing returns nothing
    set gg_trg_AttackTaken = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_AttackTaken, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddCondition( gg_trg_AttackTaken, Condition( function Trig_AttackTaken_Conditions ) )
    call TriggerAddAction( gg_trg_AttackTaken, function Trig_AttackTaken_Actions )
endfunction
NeutralAttackAI
 
Cho mình hỏi làm sao để khi học skill Spiked Carapace của Crypt Lord nó ko còn mọc ra mấy cái gai nữa , mình đã thử để trống phần buff và thử thay bằng buff khác nhưng ko được.
 
Cho mình hỏi làm sao để khi học skill Spiked Carapace của Crypt Lord nó ko còn mọc ra mấy cái gai nữa , mình đã thử để trống phần buff và thử thay bằng buff khác nhưng ko được.
Không hiểu ! :| Ý bạn là khi xuất cái skill đó thì không mọc cái gai nữa chứ gì :D
1:bạn nói cụ thể ra mình giúp được
2:Trigger :D
?:Ai biết khi đánh vào một cái nhà thì số dmg của nó lên 1s là 1200 thì mình sẽ được 1200 Gold (Giống troll & Elves ý :D)
P/S:Lâu ngày không đụng đến WE rồi :D
 
Cho mình hỏi làm sao để khi học skill Spiked Carapace của Crypt Lord nó ko còn mọc ra mấy cái gai nữa , mình đã thử để trống phần buff và thử thay bằng buff khác nhưng ko được.

vẫn để Buff đó hoặc Copy Buff đó ra.. xóa phần Target trong Buff Spiked Carapace mà mình mới tạo..
Các Target Attachment Points cũng xóa hết luôn.

Sau đó add cái buff đó vào Abilities thử xem.
 
Anh mvcthinh cho em hỏi: giờ em có 1 trigger Circle of Power khi nhặt item thì sẽ remove item đó và tạo 1 item mới ở chính vị trí của nó, nếu dùng trigger chống nhặt item của anh thì quyền sở hữu sẽ thuộc về ai?
 
Anh mvcthinh cho em hỏi: giờ em có 1 trigger Circle of Power khi nhặt item thì sẽ remove item đó và tạo 1 item mới ở chính vị trí của nó, nếu dùng trigger chống nhặt item của anh thì quyền sở hữu sẽ thuộc về ai?
Lúc tạo Item mới thì mình thêm dòng này để chuyển quyền sở hữu cho Player mà mình muốn...

Actions - Item - Change ownership.
Item - Change ownership of (Last created item) to (Owner of (Triggering unit)) and Change color

---------- Post added at 14:57 ---------- Previous post was at 14:36 ----------

Cho hỏi đoạn này có thật là bị leak ko .. và xóa leak đoạn này phải làm sao...

Game - Display to (Player group((Owner of (Triggering unit)))) the text: "This item does not ..."
 
Có ai biết làm cái bottle giống dota không vậy,nhưng thay vì là item thì nó sẽ 1 chiêu của hero.
 
Có ai biết làm cái bottle giống dota không vậy,nhưng thay vì là item thì nó sẽ 1 chiêu của hero.

ý bạn muốn tạo Chiu cho Hero thông qua Học Item... ??
 
Cho em hỏi thêm 1 lỗi này nữa, ko biết có ai bị chưa. Khi em protect map bằng wc3mapoptimizer4.9 xong thì khi vào war lại mở map ko đc, cụ thể là khi em chọn map thì nó tự refresh lại. Nếu ai từng bị thì cho em 1 lời khuyên ạ '.'
 
các lựa chọn của bạn thế nào, có giống thế này không?

wc3mapoptimizer491.jpg


http://forum.gamevn.com/showthread.php?478320-xin-phan-mem-khoa-worldeditor&p=8377158#post8377158
 
Cần giúp đỡ có ai giúp kiểm tra dùm mình đoạn code này với.. không hiểu sao nó không hoạt động chút nào.. Ai rành Jass giúp mình nha.

PHP:
scope AttackAuto initializer Auto


private function Actions takes nothing returns nothing
local integer A =1
local integer B
local real hpTarget
local real hpHero
local unit x 

local location p 

local player h
local player r
local force f

local group g = CreateGroup()
local unit temp


loop 
   exitwhen A>12
                            
                            // Vong lap dau tien dung de kiem tra xem xung quanh Hero co Unit nao co mau duoi 50% thi se xong vao danh con do
    set x = udg_HERO[A]
    
// Dieu kien kiem tra xem Player do co phai do Computer dieu khien hay khong.. neu dung thi moi cho phep RUN o duoi.
    if (GetPlayerController(GetOwningPlayer(x)) == MAP_CONTROL_COMPUTER ) then
                            
             
                            call GroupEnumUnitsInRangeOfLoc(g,p,512,null)
                            set temp = FirstOfGroup(g)
                            set hpHero = GetUnitLifePercent(x)
                                    loop
                                        exitwhen temp == null
                                            set hpTarget= GetUnitLifePercent(temp)
                                                if hpTarget < 50 then
                                                    call IssueTargetOrderBJ(x,"attack",temp)
                                    
                                                    call GroupRemoveUnit(g,temp)
                                                    set temp = FirstOfGroup(g)
                                                endif
                                
                                            call GroupRemoveUnit(g,temp)
                                            set temp = FirstOfGroup(g)
                                    endloop
                                    
// Ket thuc vong lap cua Group g
// bat dau kiem tra Hp Hero.. neu duoi 20 % thi lenh cho no chay ve
                                  
                                    
                                    
                                if hpHero < 20 then
                                    set p =  GetPlayerStartLocationLoc(GetOwningPlayer(x))
                                   call IssuePointOrderLoc(x,"move",p)
                                   call RemoveLocation(p)
                                   set p = null
                                
                                   else
                                        if hpHero <7 then
                                            set p =  GetPlayerStartLocationLoc(GetOwningPlayer(x))
                                            call IssuePointOrderLoc(x,"patrol",p)
                                            call RemoveLocation(p)
                                            set p = null
                                                else
                                                    set h =GetOwningPlayer(x)
                                                    set f = GetPlayersEnemies(h)
                                                    set r = ForcePickRandomPlayer(f)
                                                        if  (GetPlayerSlotState(r) == PLAYER_SLOT_STATE_PLAYING ) then
                                                            set p =  GetPlayerStartLocationLoc(r)
                                                            call IssuePointOrderLoc(x,"attack",p)
                                                            call RemoveLocation(p)
                                                            set p = null
                                                        endif
                                            endif
                        
                                endif
   endif
                        
  set A = A+1
endloop

  set x = null
  set temp = null
  set r = null
  set h = null
  set g = null
  set f = null
call DestroyGroup(g)
call DestroyForce(f)
call RemoveLocation(p)
endfunction

//===========================================================================
private function Auto takes nothing returns nothing
local trigger t = CreateTrigger(  )

    call TriggerRegisterTimerEventPeriodic( t, 2.00 )
    call TriggerAddAction( t, function Actions )
   
set t = null
endfunction

endscope


---------- Post added at 17:02 ---------- Previous post was at 16:56 ----------

Mình muốn làm đoạn code trên hoạt động như Trigger này ne.

Có ai rành Jass giúp với.
Mã:
Attack
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        Player Group - Pick every player in (All players matching (((Matching player) controller) Equal to Computer)) and do (Actions)
            Loop - Actions
                Set TempPoint = (Position of HERO[(Player number of (Picked player))])
                Set GroupHero = (Units within 512.00 of TempLocation matching (((Matching unit) belongs to an enemy of (Picked player)) Equal to True))
                Unit Group - Pick every unit in GroupHero and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Percentage life of (Picked unit)) Less than or equal to 50.00
                            Then - Actions
                                Unit - Order HERO[(Player number of (Picked player))] to Attack (Picked unit)
                            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Percentage life of HERO[(Player number of (Picked player))]) Less than 20.00
                    Then - Actions
                        Unit - Order HERO[(Player number of (Picked player))] to Move To ((Picked player) start location)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Percentage life of HERO[(Player number of (Picked player))]) Less than 5.00
                            Then - Actions
                                Unit - Order HERO[(Player number of (Picked player))] to Patrol To ((Picked player) start location)
                            Else - Actions
                                Set TempLocation = ((Random player from (All players)) start location)
                                Unit - Order HERO[(Player number of (Picked player))] to Attack-Move To TempLocation
                                Custom script:   call RemoveLocation(udg_TempLocation)
                Custom script:   call RemoveLocation(udg_TempPoint)
                Custom script:   call DestroyGroup(udg_GroupHero)
 
Status
Không mở trả lời sau này.
Back
Top