kingkingyyk3
Visitor (Welcome to the Jungle, Baby!)
- Reaction score
- 216
Yep.
function callback
-> If Damage_IsAttack() and //some percentage calculations here
call Damage_Block()
//create "miss" texttag
endif
//Register trigger to Damage
function callback
-> If Damage_IsAttack() and //some percentage calculations here
call Damage_Block()
//create "miss" texttag
endif
//Register trigger to Damage
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
if Damage_IsAttack() then
call Damage_BlockAll
endif
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call Damage_RegisterEvent(gg_trg_Untitled_Trigger_001 )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction
------------------------------------------------------------------------------------------
function Trig_UntActions takes nothing returns nothing
if Damage_IsAttack() and then //how to make false for the 'miss'
call BJDebugMsg("attack")
endif
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_002 takes nothing returns nothing
set gg_trg_Untitled_Trigger_002 = CreateTrigger( )
call Damage_RegisterEvent(gg_trg_Untitled_Trigger_002 )
call TriggerAddAction( gg_trg_Untitled_Trigger_002, function Trig_UntActions )
endfunction
sorry xDhow would i do that? XD sketch a template thanks
function Trig_UntActions takes nothing returns nothing
if not Damage_IsAttack() then //like this?
call BJDebugMsg("attack")
endif
endfunction
function Trig_UntActions takes nothing returns nothing
if not Damage_IsAttack() then //how to make false for the 'miss'
call BJDebugMsg("Spell missed")
endif
endfunction
library AttackManipulator requires Damage, Event
globals
private Event AttackEvent
private Event MissEvent
endglobals
function RegisterMissAttack takes trigger whichTrigger returns nothing
call MissEvent.register(whichTrigger)
endfunction
function RegisterAttacked takes trigger whichTrigger returns nothing
call AttackEvent.register(whichTrigger)
endfunction
private function Cond takes nothing returns boolean
if Damage_IsAttack() then
if /*Miss Condition*/ then
call Damage_BlockAll()
call MissEvent.fire()
else
call AttackEvent.fire()
endif
endif
return false
endfunction
private struct Initializer extends array
private static method onInit takes nothing returns nothing
local trigger trig = CreateTrigger()
call Damage_RegisterEvent(trig)
call TriggerAddCondition(trig,Condition(function Cond))
endmethod
endstruct
endlibrary
function onInit takes nothing returns nothing
local trigger trig = CreateTrigger()
call RegisterMissAttack(trig)
call TriggerAddCondition(trig,Condition(function Cond))
endfunction
Nope, but you can write that yourself.is there like a function in 'damage' that obtains the final damage done to the unit?
library AttackManipulator requires Damage, Event
globals
private Event AttackEvent
private Event MissEvent
endglobals
function RegisterMissAttack takes trigger whichTrigger returns nothing
call MissEvent.register(whichTrigger)
endfunction
function RegisterAttacked takes trigger whichTrigger returns nothing
call AttackEvent.register(whichTrigger)
endfunction
private function Cond takes nothing returns boolean
if Damage_IsAttack() then
if /*Miss Condition*/ then
call Damage_BlockAll()
call MissEvent.fire()
else
call AttackEvent.fire()
endif
endif
return false
endfunction
private struct Initializer extends array
private static method onInit takes nothing returns nothing
local trigger trig = CreateTrigger()
// but you forgot these:
set AttackEvent = Event.create()
set MissEvent = Event.create()
call Damage_RegisterEvent(trig)
call TriggerAddCondition(trig,Condition(function Cond))
endmethod
endstruct
endlibrary
globals
private real array EventDamageEx//stack
endglobals
function GetEventDamageEx takes nothing returns real
return EventDamageEx[TypeStackLevel]//stack
endfunction
private function OnDamageActions takes nothing returns boolean
if EventEnabled then
if GetEventDamage()==0. then
call OnZeroDamageEvent.fire()
else
call OnDamageEvent.fire()
endif
set EventDamageEx[TypeStackLevel] = GetEventDamage()
if ToBlock[TypeStackLevel]!=0. then
//====================================================
// Blocking
set ForUnit=GetTriggerUnit()
set NextHealth=GetEventDamage()
if ToBlock[TypeStackLevel]>=NextHealth then
set NextHealth=GetWidgetLife(ForUnit)+NextHealth
set EventDamageEx[TypeStackLevel] = 0//blockall
else
set EventDamageEx[TypeStackLevel] = EventDamageEx[TypeStackLevel] - ToBlock[TypeStackLevel]//block (real)
set NextHealth=GetWidgetLife(ForUnit)+ToBlock[TypeStackLevel]
endif
// removed irrelevant code
//====================================================
set ToBlock[TypeStackLevel]=0.
endif
endif
return false
endfunction
library test initializer asdf requires Damage
globals
private group g = CreateGroup()
private unit target
endglobals
private function fdsa takes nothing returns nothing
local unit u = FirstOfGroup(g)
if u != null then
call GroupRemoveUnit(g, u)
call Damage_Pure(u, target, 10.)
endif
endfunction
private function zxcv takes nothing returns boolean
call fdsa()
call Damage_BlockAll()
call BJDebugMsg(R2S(GetUnitState(GetTriggerUnit(), UNIT_STATE_MAX_LIFE))) //Prints "650.000" "500650.000" "500650.000"
return false
endfunction
private function vcxz takes nothing returns nothing
local trigger t = CreateTrigger()
call Damage_RegisterEvent(t)
call TriggerAddCondition(t, Condition(function zxcv))
call GroupEnumUnitsOfPlayer(g, Player(0), null)
set target = FirstOfGroup(g)
call GroupRemoveUnit(g, target)
call fdsa()
endfunction
private function asdf takes nothing returns nothing
call TimerStart(CreateTimer(), 1., false, function vcxz)
endfunction
endlibrary
Lol, right. I could add a function for it...So, you can't get an accurate UNIT_STATE_MAX_LIFE in recursive damage events when calling Damage_BlockAll(), right?