W!†A_cRaft
Ultra Cool Member
- Reaction score
- 28
i think i need to learn a lil more about JASS before understanding what you just said
dont really get the whole scope thing
dont really get the whole scope thing
function irrelevant takes nothing returns nothing
local trigger threat T
set threatT = CreateTrigger()
call Damage_RegisterEvent(threatT)
All units in general. Every unit that is created will also trigger that event, even if it was not made when the trigger had the event registered.The basic question is: "Does this register only the units preset in the map at the moment of it's activation, or all units in general?"
Well, to be very specific, chaos damage has a 1x multiplier for every armor type by default, but that's changeable in the map configuration so there's no guarantee. It might be wise to list "1x multiplier for chaos damage" as a system requirement.Damage_Pure must have use ATTACK_TYPE_CHAOS and not DAMAGE_TYPE_NORMAL, because only chaos damage can affect divine armour for those cases, even though you are using DAMAGE_TYPE_UNIVERSAL. Needs a fix.
No, with Damage, making these new libs, is kinda useless.Yea, with these new libs, Damage is kinda useless ;P.
//! externalblock extension=lua ObjectMerger $FILENAME$
//! runtextmacro LUA_FILE_HEADER()
//! i dofile("GetVarObject")
//! i local rez = getvarobject("AHre", "abilities", "ABILITIES_REVIVE_UNIT_RESURRECTION", true)
//! i createobject("AHre",rez)
//! i makechange(current,"anam","DumResurrection")
//! i makechange(current,"aher","0")
//! i makechange(current,"acat","")
//! i makechange(current,"atat","")
//! i makechange(current,"Hre1","1","1")
//! i makechange(current,"aare","1","0")
//! i makechange(current,"aran","1","0")
//! i makechange(current,"acdn","1","0")
//! i makechange(current,"amcs","1","0")
//! i makechange(current,"atar","1","Air,Dead,Enemy,Friend,Ground,Neutral")
//! i local dummy = getvarobject("ushd", "units", "UNITS_REVIVE_UNIT_DUMMY", true)
//! i createobject("ushd",dummy)
//! i makechange(current,"unam","Dummy")
//! i makechange(current,"uabi",rez .. ",Aloc,Avul")
//! i makechange(current,"ucbs","0")
//! i makechange(current,"ucpt","0")
//! i makechange(current,"umdl","none.mdl")
//! i makechange(current,"usca","0.01")
//! i makechange(current,"ushu","None")
//! i makechange(current,"umvh","0")
//! i makechange(current,"umvs","0")
//! i makechange(current,"ufoo","0")
//! i makechange(current,"umpi","100000")
//! i makechange(current,"umpm","100000")
//! i makechange(current,"umpr","1000")
//! i updateobjects()
//! endexternalblock
function OMG4REALZ takes unit source, unit target, real amount returns nothing
if amount>GetWidgetLife(target) then
call Damage_Pure(source, target, 99999999)
else
call SetWidgetLife(target, GetWidgetLife(target)-amount)
endif
endfunction
Regular Damage-
1 damage event fires, buff applied before damage event
Missile Splash Damage
2 damage events fire for target unit
first damage event runs w/ dmg and w/o buff
second damage event runs w/ 0 damage and buff
2 damage event fires for rest of units
damage event runs w/ dmg and w/o buff
damage event runs w/ 0 damage and w/0 buff (wc3 bug??)
buff applied on rest of units on next period
Artillery Splash Damage
1 damage event fires
Buff applied to all units on next period
You have to use 2 abilities to get it working, and the two that appear to work are Frost Breath and Item Frost Damage Bonus. I have tried many combos and many abilities =).
if (UnitAlive(GetUnitById(targetId))) then
if (GetUnitAbilityLevel(GetUnitById(targetId), DUMMY_BUFF) > 0) then
//was a physical attack
if (ec[eventCount]) then
//initial splash (runs through w/ only splash abils on splash attack)
loop
set eventType<i> = PHYSICAL
set es<i> = 0
set i = i - 1
exitwhen not ec<i> or es<i> != sourceId
set ec<i> = false
endloop
else
//not splash (doesn't run w/ splash abil no non splash attack)
set eventCount = eventCount + 1
set eventType[eventCount] = PHYSICAL
set update = true
endif
elseif (ls == sourceId and eventType[eventCount] == PHYSICAL) then
//this will only run with non-splash abil and splash abil on splash attack
//first the 0 dmg runs, then the actual damage runs, alternates
if (ec[eventCount]) then
set ec[eventCount] = false
else
set eventCount = eventCount + 1
set eventType[eventCount] = PHYSICAL
set ec[eventCount] = true
set update = true
endif
elseif (hooked[sourceId] > 0) then
//JASS attack
set hooked[sourceId] = hooked[sourceId] - 1
set eventCount = eventCount + 1
set eventType[eventCount] = JASS
set update = true
elseif (overType != 0) then
//known attack
set eventType[eventCount] = overType
set overType = 0
set update = true
else
//unknown attack
//will initially run for all splash attacks
//artillery attacks won't be known until after timer
set eventCount = eventCount + 1
set eventType[eventCount] = 0
set update = true
set ec[eventCount] = true
set es[eventCount] = sourceId
endif
//for chaining attacks together, last source = current source
set ls = sourceId
//if update (didn't skip), then add to timer stack
if (update) then
set eventSourceId[eventCount] = sourceId
set eventTargetId[eventCount] = targetId
set eventDamage[eventCount] = amount
//if haven't saved the unit, add life abil to save it
if (saved[targetId] == 0) then
set life = GetWidgetLife(GetUnitById(targetId))
call UnitAddAbility(GetUnitById(targetId), ADV_DAMAGE_EVENT_SAVE_UNIT_ABILITY)
call SetWidgetLife(GetUnitById(targetId), life+500000)
endif
//always increase the save count so life ability is removed at right time
set saved[targetId] = saved[targetId] + 1
//start the timer to actually handle (only needed because of artillery attacks)
//artillery attacks are *never* known until after timer
call TimerStart(eventTimer, 0, false, function thistype.handleEvent)
endif
endif
</i></i></i></i></i>
if (type == 0) then
if (GetUnitAbilityLevel(target, DUMMY_BUFF) > 0) then
set type = PHYSICAL
set explode = true
else
set type = SPELL
set explode = false
endif
else
set explode = false
endif
if (type == PHYSICAL) then
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "PHYSICAL")
call UnitRemoveAbility(target, DUMMY_BUFF)
endif
call ANY.fire()
call Event(type).fire()
set life = GetWidgetLife(target)-500000
set saved[targetId] = saved[targetId] - 1
if (life < .405) then
call SetUnitExploded(target, explode)
set saved[targetId] = 0
call SetWidgetLife(target, .5)
call disable()
call UnitDamageTarget(GetUnitById(sourceId), GetUnitById(targetId), 100, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
call enable()
elseif (saved[targetId] == 0) then
call UnitRemoveAbility(GetUnitById(targetId), ADV_DAMAGE_EVENT_SAVE_UNIT_ABILITY)
call SetWidgetLife(target, life)
endif
public function BlockAll takes nothing returns nothing
set ToBlock[TypeStackLevel]=ToBlock[TypeStackLevel]+GetEventDamage()
endfunction
public function BlockPercent takes real percent returns nothing
set ToBlock[TypeStackLevel]=ToBlock[TypeStackLevel] + GetEventDamage()*percent
endfunction