Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Damage Return Aura Copy
Events
Unit - A unit enters (Playable map area)
Conditions
((Triggering unit) is A Hero) Equal to True
((Triggering unit) has buff Damage Return Aura ) Equal to True
Actions
Set UnitGroupExplosion = (Units within 600.00 of (Position of (Triggering unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
Unit Group - Pick every unit in UnitGroupExplosion and do (Actions)
Loop - Actions
Unit - Cause (Triggering unit) to damage (Picked unit), dealing 1000.00 damage of attack type Chaos and damage type Normal
Custom script: call DestroyGroup( udg_UnitGroupExplosion )
Damage Return Aura Copy 2
Events
Unit - A unit Is attacked
Conditions
((Attacked unit) is A Hero) Equal to True
((Attacked unit) has buff Hell Flame <Buff> ) Equal to True
Actions
Set UnitGroupExplosion = (Units within 600.00 of (Position of (Attacked unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Attacked unit))) Equal to True))
Unit Group - Pick every unit in UnitGroupExplosion and do (Actions)
Loop - Actions
Unit - Cause (Attacked unit) to damage (Picked unit), dealing ((0.02 x (Real((Level of Hell Flame for (Attacked unit))))) x (Life of (Attacked unit))) damage of attack type Chaos and damage type Normal
Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call DestroyGroup( udg_UnitGroupExplosion )

Thực ra cái trên là edit lại của một cái phản damage, mình định làm 1 cái kiểu như Passive Immolation mà có thể tính damage theo LV hay máu gì đấy...Chả biết ghép Event nào cho phù hợp :(
Tranh thủ hỏi cái phản damage này luôn
Code trên chạy bình thường. Damage gây ra đúng theo code. Skill và Buff sử dụng đều của Passive Immolation. Vấn đề là máu của Hero mất rất nhanh. Khi ko sử dụng trigger này thì Hero khá trâu. Mình ngờ là cả Hero của mình cũng dính phản damage. Bác nào giúp cáiMã:Damage Return Aura Copy 2 Events Unit - A unit Is attacked Conditions ((Attacked unit) is A Hero) Equal to True ((Attacked unit) has buff Hell Flame <Buff> ) Equal to True Actions Set UnitGroupExplosion = (Units within 600.00 of (Position of (Attacked unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Attacked unit))) Equal to True)) Unit Group - Pick every unit in UnitGroupExplosion and do (Actions) Loop - Actions Unit - Cause (Attacked unit) to damage (Picked unit), dealing ((0.02 x (Real((Level of Hell Flame for (Attacked unit))))) x (Life of (Attacked unit))) damage of attack type Chaos and damage type Normal Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl Special Effect - Destroy (Last created special effect) Custom script: call DestroyGroup( udg_UnitGroupExplosion )![]()
Công nhận bá đạo thậtStork[gm];22420662 nói:Bạn pick unit như thế thì ko chỉ có con tấn công bị phản damage mà tất cả các con trong vùng AoE cũng mất máu theo luôn. Tức là ví dụ có 10 con đứng trong AoE thì nó sẽ phản damage lên tận 10 lần. Tốt nhất là xóa cái unitgroup đi, và để là cause attacked unit to damage triggering unit thôi cho đơn giản, vs làm thế thì con tướng chưa bị đánh thì con kia đã mất máu rồi, muốn phản damage kiểu spectre, blade mail .... thì dùng take damage vs 1 số trigger khác chứ phản damage thế này 1 con unit chưa đánh nó đã mất máu thì có lẽ hơi ớn.

cho m` hỏi, câu lệnh trong jass có BJ với k có BJ khác nhau chỗ nào, và sử dụng cía nào thì có lợi hơn
Công nhận bá đạo thật
Nhưng mình đang thắc mắc tại sao Hero của mình lại ăn damage đau thế ? Với 1 đám unit damage to mất máu nhanh kinh.
Trong khi chưa thêm trigger vào thì vẫn với đám unit đó trụ cả phút ko sao.
Bác có map tutorial về phản damage nào ko ? Đừng chơi Jass nhé :(
Cái bác bảo là "cause attacked unit to damage triggering unit" thì triggering unit là attacking unit à ?
globals
integer StunBuff = 'BPSE'
string StunOrder = "thunderbolt"
integer StunAbi = 'A000'
integer StunDummy = 'h000'
endglobals
struct StunData
unit whichUnit
timer xtimer
endstruct
library Stun
function GetStunTime takes unit u returns real
local StunData data = GetCSData ( u )
local real r = TimerGetRemaining( data.xtimer)
return r
endfunction
function StunEnd takes nothing returns nothing
local timer ti = GetExpiredTimer()
local StunData data = GetCSData ( ti )
if GetStunTime( data.whichUnit ) == 0 then
call UnitRemoveBuffBJ( StunBuff , data.whichUnit )
endif
endfunction
function StunUnit takes unit u, real r returns nothing
local StunData data = StunData.create()
local StunData xdata = GetCSData(u)
local location p = GetUnitLoc(u)
local timer ti = CreateTimer()
set data.whichUnit = u
set data.xtimer = ti
if (UnitHasBuffBJ(u, StunBuff) == FALSE) then
call CreateNUnitsAtLoc( 1 , StunDummy , GetOwningPlayer(u), p , GetUnitFacing(u) )
call UnitAddAbility( GetLastCreatedUnit() , StunAbi )
call IssueTargetOrderBJ( GetLastCreatedUnit() , StunOrder , u )
call UnitApplyTimedLife( GetLastCreatedUnit() , 'BTLF' , 0.5)
endif
if (r > TimerGetRemaining( xdata.xtimer)) then
call SetCSData (ti , data )
call SetCSData (u , data )
call TimerStart( ti , r , false , function StunEnd)
endif
call RemoveLocation(p)
set p = null
endfunction
endlibrary
Ai check giùm code sao xem đã ok chưa (lag, leak, code...) với lại hướng dẫn mình cách remove BJ
PHP:globals integer StunBuff = 'BPSE' string StunOrder = "thunderbolt" integer StunAbi = 'A000' integer StunDummy = 'h000' endglobals struct StunData unit whichUnit timer xtimer endstruct library Stun function GetStunTime takes unit u returns real local StunData data = GetCSData ( u ) local real r = TimerGetRemaining( data.xtimer) return r endfunction function StunEnd takes nothing returns nothing local timer ti = GetExpiredTimer() local StunData data = GetCSData ( ti ) if GetStunTime( data.whichUnit ) == 0 then call UnitRemoveBuffBJ( StunBuff , data.whichUnit ) endif endfunction function StunUnit takes unit u, real r returns nothing local StunData data = StunData.create() local StunData xdata = GetCSData(u) local location p = GetUnitLoc(u) local timer ti = CreateTimer() set data.whichUnit = u set data.xtimer = ti if (UnitHasBuffBJ(u, StunBuff) == FALSE) then call CreateNUnitsAtLoc( 1 , StunDummy , GetOwningPlayer(u), p , GetUnitFacing(u) ) call UnitAddAbility( GetLastCreatedUnit() , StunAbi ) call IssueTargetOrderBJ( GetLastCreatedUnit() , StunOrder , u ) call UnitApplyTimedLife( GetLastCreatedUnit() , 'BTLF' , 0.5) endif if (r > TimerGetRemaining( xdata.xtimer)) then call SetCSData (ti , data ) call SetCSData (u , data ) call TimerStart( ti , r , false , function StunEnd) endif call RemoveLocation(p) set p = null endfunction endlibrary
Thanks bạn, nhìn có vẻ phức tạp phếtBJ có thể nói là "gián tiếp" để thực hiện lệnh đó qua các lệnh khác mà đa phần đều thực hiện bằng một hoặc nhiều lệnh không có hoặc ít BJ
còn không BJ thì làm "trực tiếp" luôn nên nó sẽ tốn ít dữ liệu hơn.
BJ ở đây là các lệnh màu đỏ,không BJ là các lệnh màu tím ^^
Đầu tiên copy system này của anh Tom về map,trong Trigger UnitTakeDamage cho Triggering Unit gây damage vào Damage source một lượng sát thương = Damage taken (lượng sát thương Unit đó phải chịu) ít hoặc nhiều hơn tùy bạn
http://forum.gamevn.com/showthread.php?t=474447


và sys đó có 1 ưu thế là hok lag hơn so với sys chạy hashtable
library CustomStun//ten thu vien
globals
private constant integer StunBuff = 'BPSE' //id buff
private constant string StunOrder = "thunderbolt" //id order cua skill stun
private constant integer StunAbi = 'A000' //stun ability id
private constant integer StunDummy = 'h000' //stun dummy unit
private constant real StunLoop = 0.05 //thoi gian cho system loop
endglobals
private struct repeat extends RepeatData
unit target
integer tik
integer endtik
method onStart takes nothing returns nothing
endmethod
method onLoop takes nothing returns nothing
set this.tik = this.tik + 1
if this.tik >= this.endtik then// khi du? tik se stop system coi nhu da done!
call this.stop()
endif
endmethod
method onEnd takes nothing returns nothing
call UnitRemoveAbility(this.target, StunBuff)
set this.target = null
endmethod
endstruct
function StunUnit takes unit u, real r returns nothing
local repeat this = repeat.create(StunLoop, 0)
set this.target = u
set this.tik = 0
set this.endtik = R2I(r / StunLoop) //lay thoi gian R chia cho loop vi du. 15 giay thi` 15 / 0.03 tuc 300tik!
if not (GetUnitAbilityLevel(this.target, StunBuff) > 0) then// khong co buff
set u = CreateUnit(GetOwningPlayer(this.target), StunDummy, GetUnitX(this.target), GetUnitY(this.target), 0)
call UnitAddAbility(u, StunAbi)
call IssueTargetOrder(u, StunOrder, this.target)
call UnitApplyTimedLife(u, 'BTLF', 0.5)
endif
set u = null
endfunction
endlibrary
à quên Made in Dore.mun ức Daric Nguyen 
library RepeatData initializer RepeatInit
/*
-----------------------------------------------------------------------------------------------------------------------------------------------------------
*/
/*
____ _ ____ _
| _ \ ___ _ __ ___ __ _| |_| _ \ __ _| |_ __ _
| |_) / _ \ '_ \ / _ \/ _` | __| | | |/ _` | __/ _` |
| _ < __/ |_) | __/ (_| | |_| |_| | (_| | || (_| |
|_| \_\___| .__/ \___|\__,_|\__|____/ \__,_|\__\__,_|
|_|
---- version 0.1 ----
Write by Daric Nguyen
=> Easy to use
=> Store data by Struct
=> MUI for spell
* HOW TO USE?
+ Method:
- method isStart takes nothing returns nothing
- method isLoop takes nothing returns nothing
- method isEnd takes nothing returns nothing
+ Example
"
library example initializer init requires RepeatData
private struct repeat extends RepeatData
// some variables
method onLoop takes nothing returns nothing
// some actions when loop
endmethod
method onStart takes nothing returns nothing
// some actions when start
endmethod
method onEnd takes nothing returns nothing
// some actions when end
endmethod
endstruct
function init takes nothing returns nothing
local repeat t=repeat.create(0.05,0) // (real timeloop, real maxtimeloop) if real maxtimeloop equal to 0, struct will repeat until you use call this.stop() command in method Loop
endfunction
endlibrary
"
*/
/*
-----------------------------------------------------------------------------------------------------------------------------------------------------------
*/
private interface RepeatFace
method onLoop takes nothing returns nothing defaults nothing
method onStart takes nothing returns nothing defaults nothing
method onEnd takes nothing returns nothing defaults nothing
endinterface
globals
private integer cn
private timer rTime
endglobals
/* Version 0.1 */
struct RepeatData extends RepeatFace
public real rL
public real nrL
public real mrL
public boolean rSt
public real rnL
private static thistype array rData
static method create takes real Loop, real maxLoop returns thistype
local thistype this=thistype.allocate()
set this.rL=Loop
set this.mrL=maxLoop
set this.rSt=true
set this.nrL=0
set this.rnL=0
set cn=cn+1
set .rData[cn]=this
if cn==1 then
call TimerStart(rTime,0.03,true,function RepeatData.rpLoop)
endif
return this
endmethod
method stop takes nothing returns nothing
set this.mrL=0.03
endmethod
static method rpLoop takes nothing returns nothing
local thistype this
local integer i=1
loop
exitwhen i>cn
set this=.rData[i]
if this.rL==0 then
call this.stop()
endif
if this.rSt==true then
set this.rSt=false
call this.onStart()
endif
if this.mrL==0 then
set this.nrL=this.nrL+0.03
set this.rnL=this.rnL+0.03
if this.rnL>=this.rL then
call this.onLoop()
set this.rnL=0
endif
else
if this.nrL>=this.mrL then
call this.onEnd()
call this.destroy()
set .rData[i]=.rData[cn]
set i=i-1
set cn=cn-1
else
set this.nrL=this.nrL+0.03
set this.rnL=this.rnL+0.03
if this.rnL>=this.rL then
call this.onLoop()
set this.rnL=0
endif
endif
endif
set i=i+1
endloop
if cn<=0 then
set cn=0
call PauseTimer(rTime)
endif
endmethod
endstruct
private function RepeatInit takes nothing returns nothing
set cn=0
set rTime=CreateTimer()
endfunction
endlibrary
đâu cần phải JC 
Code về logic thì thế là OK rồi trừ chỗ StunEnd: Code đó chỉ chạy khi timer đã hết tức là time remain đương nhiên = 0 rùi còn check chi nữa @@Ai check giùm code sao xem đã ok chưa (lag, leak, code...) với lại hướng dẫn mình cách remove BJ
)tớ nghĩ cậu tập xài system repeat sẽ ngon hơn nhiều nó rất là đơn giản và tiện dụng hơn
@Ngoc LeO: cậu vào thẳng Trigger Editor bấm Ctrl vào các fun BJ là dc màđâu cần phải JC
![]()

Có hàm nào trong trigger làm cho unit ko hiển thị trên minimap ko nhi?