Name | Type | is_array | initial_value |
AfterDamageEvent | real | No | |
ClearDamageEvent | trigger | No | |
Creep_Point | location | Yes | |
DAMAGE_FACTOR_BRACERS | real | No | |
DAMAGE_FACTOR_ELUNES | real | No | |
DAMAGE_FACTOR_ETHEREAL | real | No | |
DamageBlockingAbility | abilcode | No | |
DamageEvent | real | No | |
DamageEventAmount | real | No | |
DamageEventOverride | boolean | No | |
DamageEventPrevAmt | real | No | |
DamageEventSource | unit | No | |
DamageEventsWasted | integer | No | |
DamageEventTarget | unit | No | |
DamageEventTrigger | trigger | No | |
DamageEventType | integer | No | |
DamageModifierEvent | real | No | |
DamageTypeBlocked | integer | No | |
DamageTypeCriticalStrike | integer | No | |
DamageTypeExplosive | integer | No | |
DamageTypeHeal | integer | No | |
DamageTypeReduced | integer | No | |
DmgEvBracers | itemcode | No | |
DmgEvRecursionN | integer | No | |
DmgEvRunning | boolean | No | |
DmgEvStarted | boolean | No | |
DmgEvTimer | timer | No | |
DmgEvTrig | trigger | No | |
DS_Ability | abilcode | No | |
DS_Animation | string | No | |
DS_AttackType | attacktype | No | |
DS_Caster | unit | No | |
DS_CasterEffect | string | No | |
DS_CasterEffectAttachment | string | No | |
DS_CasterKey | integer | No | |
DS_CasterLoc | location | No | |
DS_CurrentAngle | real | No | |
DS_CurrentDegrees | real | No | |
DS_CurrentDistance | real | No | |
DS_CurrentDuration | real | No | |
DS_Damage | real | Yes | |
DS_DamageType | damagetype | No | |
DS_DashCount | integer | No | |
DS_DashCountMax | integer | Yes | |
DS_DashEffect | string | No | |
DS_DashSpeed | real | No | |
DS_DRange | real | No | |
DS_Dummy | unitcode | No | |
DS_DummyAttachment | string | No | |
DS_Effect | effect | No | |
DS_EndAnimationSpeed | real | No | |
DS_Hash | hashtable | No | |
DS_Hit | boolean | No | |
DS_Level | integer | No | |
DS_LoopGroup | group | No | |
DS_MaxDashDistance | real | No | |
DS_MissileModel | string | No | |
DS_ModelColoring | real | Yes | |
DS_ModelSize | real | No | |
DS_NadoGroup | group | No | |
DS_NadoKnockupRange | real | No | |
DS_Offset | location | No | |
DS_Owner | player | No | |
DS_Picked | unit | No | |
DS_Speed | real | No | |
DS_TargetEffect | string | No | |
DS_TargetEffectAttachment | string | No | |
DS_TargetLoc | location | No | |
DS_TornadoMultiplier | real | Yes | |
DS_TornadoSpeed | real | No | |
DS_TornadoTravelDist | real | No | |
DS_Unit | unit | No | |
DS_UnitKey | integer | No | |
DS_UnitLoc | location | No | |
HideDamageFrom | boolean | Yes | |
IsDamageSpell | boolean | No | |
IsUnitBeingKnockedBack | boolean | Yes | |
KUS_animation | string | No | |
KUS_effect | string | No | |
KUS_group | group | No | |
KUS_hash | hashtable | No | |
KUS_height | real | No | |
KUS_knockup | boolean | No | |
KUS_speed | real | No | |
KUS_target | unit | No | |
KUS_temp_loc | location | No | |
KUS_temp_speed | real | No | |
LastDamageHP | real | No | |
LastDmgPrevAmount | real | Yes | |
LastDmgPrevType | integer | Yes | |
LastDmgSource | unit | Yes | |
LastDmgTarget | unit | Yes | |
LastDmgValue | real | Yes | |
LastDmgWasSpell | boolean | Yes | |
LB_Ability | abilcode | No | |
LB_Animation | string | Yes | |
LB_AttackType | attacktype | No | |
LB_Caster | unit | No | |
LB_CasterEffectAttachment | string | No | |
LB_CasterHeight | real | No | |
LB_CasterKey | integer | No | |
LB_CasterLoc | location | No | |
LB_Check | boolean | No | |
LB_Count | integer | No | |
LB_CurrentDuration | real | No | |
LB_Damage | real | Yes | |
LB_DamageType | damagetype | No | |
LB_Degrees | real | No | |
LB_DistanceFromTarget | real | No | |
LB_EffectCaster | string | No | |
LB_EffectCaster2 | string | No | |
LB_EffectTargetSlam | string | No | |
LB_Hash | hashtable | No | |
LB_isKnockedUp | group | No | |
LB_KnockDuration | real | Yes | |
LB_Level | integer | No | |
LB_LoopGroup | group | No | |
LB_LoopSpeed | real | No | |
LB_Owner | player | No | |
LB_Picked | unit | No | |
LB_PickedLoc | location | No | |
LB_Player | force | No | |
LB_Randomize | boolean | No | |
LB_Range | real | Yes | |
LB_SlamSpeedCaster | real | No | |
LB_SlamSpeedTarget | real | No | |
LB_TargetEffect | string | Yes | |
LB_TargetEffectAttachment | string | Yes | |
LB_TargetHeight | real | No | |
LB_ThirdStrikeSpeed | real | No | |
LB_Unit | unit | No | |
LB_UnitKey | integer | No | |
LB_UnitLoc | location | No | |
NextDamageOverride | boolean | No | |
NextDamageType | integer | No | |
SpellDamageAbility | abilcode | No | |
Temp_Integer | integer | No | |
TMP_Ability | abilcode | No | |
TMP_AttackType | attacktype | No | |
TMP_Caster | unit | No | |
TMP_CasterKey | integer | No | |
TMP_CasterLoc | location | No | |
TMP_CasterOffset | location | No | |
TMP_CurrentAngle | real | No | |
TMP_CurrentDegrees | real | No | |
TMP_CurrentDistance | real | No | |
TMP_CurrentDuration | real | No | |
TMP_Damage | real | Yes | |
TMP_DamageType | damagetype | No | |
TMP_Dummy | unitcode | No | |
TMP_DummyAttachment | string | No | |
TMP_Duration | real | Yes | |
TMP_Effect | unit | No | |
TMP_EndEffect | string | No | |
TMP_Hash | hashtable | No | |
TMP_LastWinds | unit | Yes | |
TMP_Level | integer | No | |
TMP_LoopGroup | group | No | |
TMP_LoopTimer | real | No | |
TMP_MaxDistance | real | No | |
TMP_MaxWindTime | real | No | |
TMP_MinDistance | real | No | |
TMP_ModelColoring | real | Yes | |
TMP_ModelSize | real | No | |
TMP_Owner | player | No | |
TMP_Picked | unit | No | |
TMP_Range | real | No | |
TMP_SpinEffect | effect | Yes | |
TMP_SpinModel | string | No | |
TMP_SpinSpeed | real | No | |
TMP_TotalEffects | integer | No | |
TMP_TotalWinds | integer | No | |
TMP_Unit | unit | No | |
TMP_UnitKey | integer | No | |
TMP_UnitLoc | location | No | |
TMP_WindBaseSpeed | real | No | |
TMP_WindDegrees | real | No | |
TMP_WindDistance | real | No | |
TMP_WindNumber | integer | No | |
TMP_WindOffset | location | No | |
TMP_WindSFX | string | No | |
TMP_WindSpeed | real | No | |
UDex | integer | No | |
UDexGen | integer | No | |
UDexNext | integer | Yes | |
UDexPrev | integer | Yes | |
UDexRecycle | integer | No | |
UDexUnits | unit | Yes | |
UDexWasted | integer | No | |
UnitDamageRegistered | boolean | Yes | |
UnitIndexerEnabled | boolean | No | |
UnitIndexEvent | real | No | |
UnitIndexLock | integer | Yes | |
WT_Ability | abilcode | No | |
WT_AttackType | attacktype | No | |
WT_CantProcTwice | group | No | |
WT_Chance | integer | Yes | |
WT_ChanceStrike | integer | Yes | |
WT_CLoc | location | No | |
WT_CounterAnimation | string | No | |
WT_Damage | real | Yes | |
WT_DamageStrike | real | Yes | |
WT_DamageStrike2 | real | Yes | |
WT_DamageType | damagetype | No | |
WT_EffectCaster | string | No | |
WT_EffectCasterAttachment | string | No | |
WT_EffectTarget | string | No | |
WT_EffectTargetAttachment | string | No | |
WT_Group | group | No | |
WT_Level | integer | No | |
WT_Owner | player | No | |
WT_Picked | unit | No | |
WT_Radius | real | No | |
WT_Rand | integer | No | |
WT_SEffectCaster | string | No | |
WT_SEffectTarget | string | No | |
WT_StrikeAnimation | string | No | |
WT_Striked | unit | No | |
WT_Unit | unit | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
//===========================================================================
// Damage Engine lets you detect, amplify, block or nullify damage. It even
// lets you detect if the damage was physical or from a spell. Just reference
// DamageEventAmount/Source/Target or the boolean IsDamageSpell, to get the
// necessary damage event data.
//
// - Detect damage: use the event "DamageEvent Equal to 1.00"
// - To change damage before it's dealt: use the event "DamageModifierEvent Equal to 1.00"
// - Detect damage after it was applied, use the event "AfterDamageEvent Equal to 1.00"
// - Detect spell damage: use the condition "IsDamageSpell Equal to True"
// - Detect zero-damage: use the event "DamageEvent Equal to 2.00" (an AfterDamageEvent will not fire for this)
//
// You can specify the DamageEventType before dealing triggered damage. To prevent an already-improbable error, I recommend running the trigger "ClearDamageEvent (Checking Conditions)" after dealing triggered damage from within a damage event:
// - Set NextDamageType = DamageTypeWhatever
// - Unit - Cause...
// - Trigger - Run ClearDamageEvent (Checking Conditions)
//
// You can modify the DamageEventAmount and the DamageEventType from a "DamageModifierEvent Equal to 1.00" trigger.
// - If the amount is modified to negative, it will count as a heal.
// - If the amount is set to 0, no damage will be dealt.
//
// If you need to reference the original in-game damage, use the variable "DamageEventPrevAmt".
//
//===========================================================================
// Programming note about "integer i" and "udg_DmgEvRecursionN": integer i
// ranges from -1 upwards. "udg_DmgEvRecursionN" ranges from 0 upwards.
// "integer i" is always 1 less than "udg_DmgEvRecursionN"
//
function DmgEvResetVars takes nothing returns nothing
local integer i = udg_DmgEvRecursionN - 2
set udg_DmgEvRecursionN = i + 1
if i >= 0 then
set udg_DamageEventPrevAmt = udg_LastDmgPrevAmount[i]
set udg_DamageEventAmount = udg_LastDmgValue[i]
set udg_DamageEventSource = udg_LastDmgSource[i]
set udg_DamageEventTarget = udg_LastDmgTarget[i]
set udg_IsDamageSpell = udg_LastDmgWasSpell[i]
set udg_DamageEventType = udg_LastDmgPrevType[i]
endif
endfunction
function CheckDamagedLifeEvent takes boolean clear returns nothing
if clear then
set udg_NextDamageOverride = false
set udg_NextDamageType = 0
endif
if udg_DmgEvTrig != null then
call DestroyTrigger(udg_DmgEvTrig)
set udg_DmgEvTrig = null
if udg_IsDamageSpell then
call SetWidgetLife(udg_DamageEventTarget, RMaxBJ(udg_LastDamageHP, 0.41))
if udg_LastDamageHP <= 0.405 then
if udg_DamageEventType < 0 then
call SetUnitExploded(udg_DamageEventTarget, true)
endif
//Kill the unit
call DisableTrigger(udg_DamageEventTrigger)
call UnitDamageTarget(udg_DamageEventSource, udg_DamageEventTarget, -999, false, false, null, DAMAGE_TYPE_UNIVERSAL, null)
call EnableTrigger(udg_DamageEventTrigger)
endif
elseif GetUnitAbilityLevel(udg_DamageEventTarget, udg_DamageBlockingAbility) > 0 then
call UnitRemoveAbility(udg_DamageEventTarget, udg_DamageBlockingAbility)
call SetWidgetLife(udg_DamageEventTarget, udg_LastDamageHP)
endif
if udg_DamageEventAmount != 0.00 and not udg_HideDamageFrom[GetUnitUserData(udg_DamageEventSource)] then
set udg_AfterDamageEvent = 0.00
set udg_AfterDamageEvent = 1.00
set udg_AfterDamageEvent = 0.00
endif
call DmgEvResetVars()
endif
endfunction
function DmgEvOnExpire takes nothing returns nothing
set udg_DmgEvStarted = false
call CheckDamagedLifeEvent(true)
endfunction
function PreCheckDamagedLifeEvent takes nothing returns boolean
call CheckDamagedLifeEvent(true)
return false
endfunction
function OnUnitDamage takes nothing returns boolean
local boolean override = udg_DamageEventOverride
local integer i = udg_DmgEvRecursionN - 1
local string s
local real prevAmount
local real life
local real prevLife
local unit u
call CheckDamagedLifeEvent(false) //in case the unit state event failed and the 0.00 second timer hasn't yet expired
if i >= 0 then
if i < 16 then
set udg_LastDmgPrevAmount[i]= udg_DamageEventPrevAmt
set udg_LastDmgValue[i] = udg_DamageEventAmount
set udg_LastDmgSource[i] = udg_DamageEventSource
set udg_LastDmgTarget[i] = udg_DamageEventTarget
set udg_LastDmgWasSpell[i] = udg_IsDamageSpell
set udg_LastDmgPrevType[i] = udg_DamageEventType
else
set s = "WARNING: Recursion error when dealing damage! Make sure when you deal damage from within a DamageEvent trigger, do it like this:\n\n"
set s = s + "Trigger - Turn off (This Trigger)\n"
set s = s + "Unit - Cause...\n"
set s = s + "Trigger - Turn on (This Trigger)"
return false
endif
endif
set udg_DmgEvRecursionN = i + 2
set u = GetTriggerUnit()
set prevAmount = GetEventDamage()
set udg_DamageEventSource = GetEventDamageSource()
set udg_DamageEventAmount = prevAmount
set udg_DamageEventTarget = u
set udg_DamageEventType = udg_NextDamageType
set udg_NextDamageType = 0
set udg_DamageEventOverride = udg_NextDamageOverride
set udg_NextDamageOverride = false
if prevAmount == 0.00 then
if not udg_HideDamageFrom[GetUnitUserData(udg_DamageEventSource)] then
set udg_DamageEventPrevAmt = 0.00
set udg_DamageEvent = 0.00
set udg_DamageEvent = 2.00
set udg_DamageEvent = 0.00
endif
call DmgEvResetVars()
else
if not udg_DmgEvStarted then
set udg_DmgEvStarted = true
call TimerStart(udg_DmgEvTimer, 0.00, false, function DmgEvOnExpire)
endif
set udg_IsDamageSpell = prevAmount < 0.00
if udg_IsDamageSpell then
set prevAmount = -udg_DamageEventAmount
set life = 1.00
if IsUnitType(u, UNIT_TYPE_ETHEREAL) and not IsUnitType(u, UNIT_TYPE_HERO) then
set life = life*udg_DAMAGE_FACTOR_ETHEREAL //1.67
endif
if GetUnitAbilityLevel(u, 'Aegr') > 0 then
set life = life*udg_DAMAGE_FACTOR_ELUNES //0.80
endif
if udg_DmgEvBracers != 0 and IsUnitType(u, UNIT_TYPE_HERO) then
//Inline of UnitHasItemOfTypeBJ without the potential handle ID leak.
set i = 6
loop
set i = i - 1
if GetItemTypeId(UnitItemInSlot(u, i)) == udg_DmgEvBracers then
set life = life*udg_DAMAGE_FACTOR_BRACERS //0.67
exitwhen true
endif
exitwhen i == 0
endloop
endif
set udg_DamageEventAmount = prevAmount*life
endif
set udg_DamageEventPrevAmt = prevAmount
set udg_DamageModifierEvent = 0.00
if not udg_DamageEventOverride then
set udg_DamageModifierEvent = 1.00
if not udg_DamageEventOverride then
set udg_DamageModifierEvent = 2.00
set udg_DamageModifierEvent = 3.00
endif
endif
set udg_DamageEventOverride = override
if udg_DamageEventAmount > 0.00 then
set udg_DamageModifierEvent = 4.00
endif
set udg_DamageModifierEvent = 0.00
if not udg_HideDamageFrom[GetUnitUserData(udg_DamageEventSource)] then
set udg_DamageEvent = 0.00
set udg_DamageEvent = 1.00
set udg_DamageEvent = 0.00
endif
call CheckDamagedLifeEvent(true) //in case the unit state event failed from a recursive damage event
//All events have run and the damage amount is finalized.
set life = GetWidgetLife(u)
set udg_DmgEvTrig = CreateTrigger()
call TriggerAddCondition(udg_DmgEvTrig, Filter(function PreCheckDamagedLifeEvent))
if not udg_IsDamageSpell then
if udg_DamageEventAmount != prevAmount then
set life = life + prevAmount - udg_DamageEventAmount
if GetUnitState(u, UNIT_STATE_MAX_LIFE) < life then
set udg_LastDamageHP = life - prevAmount
call UnitAddAbility(u, udg_DamageBlockingAbility)
endif
call SetWidgetLife(u, RMaxBJ(life, 0.42))
endif
call TriggerRegisterUnitStateEvent(udg_DmgEvTrig, u, UNIT_STATE_LIFE, LESS_THAN, RMaxBJ(0.41, life - prevAmount/2.00))
else
set udg_LastDamageHP = GetUnitState(u, UNIT_STATE_MAX_LIFE)
set prevLife = life
if life + prevAmount*0.75 > udg_LastDamageHP then
set life = RMaxBJ(udg_LastDamageHP - prevAmount/2.00, 1.00)
call SetWidgetLife(u, life)
set life = (life + udg_LastDamageHP)/2.00
else
set life = life + prevAmount*0.50
endif
set udg_LastDamageHP = prevLife - (prevAmount - (prevAmount - udg_DamageEventAmount))
call TriggerRegisterUnitStateEvent(udg_DmgEvTrig, u, UNIT_STATE_LIFE, GREATER_THAN, life)
endif
set u = null
endif
return false
endfunction
function CreateDmgEvTrg takes nothing returns nothing
set udg_DamageEventTrigger = CreateTrigger()
call TriggerAddCondition(udg_DamageEventTrigger, Filter(function OnUnitDamage))
endfunction
function SetupDmgEv takes nothing returns boolean
local integer i = udg_UDex
local unit u
if udg_UnitIndexEvent == 1.00 then
set u = udg_UDexUnits[i]
if GetUnitAbilityLevel(u, 'Aloc') == 0 and TriggerEvaluate(gg_trg_Damage_Engine_Config) then
set udg_UnitDamageRegistered[i] = true
call TriggerRegisterUnitEvent(udg_DamageEventTrigger, u, EVENT_UNIT_DAMAGED)
call UnitAddAbility(u, udg_SpellDamageAbility)
call UnitMakeAbilityPermanent(u, true, udg_SpellDamageAbility)
endif
set u = null
else
set udg_HideDamageFrom[i] = false
if udg_UnitDamageRegistered[i] then
set udg_UnitDamageRegistered[i] = false
set udg_DamageEventsWasted = udg_DamageEventsWasted + 1
if udg_DamageEventsWasted == 32 then //After 32 registered units have been removed...
set udg_DamageEventsWasted = 0
//Rebuild the mass EVENT_UNIT_DAMAGED trigger:
call DestroyTrigger(udg_DamageEventTrigger)
call CreateDmgEvTrg()
set i = udg_UDexNext[0]
loop
exitwhen i == 0
if udg_UnitDamageRegistered[i] then
call TriggerRegisterUnitEvent(udg_DamageEventTrigger, udg_UDexUnits[i], EVENT_UNIT_DAMAGED)
endif
set i = udg_UDexNext[i]
endloop
endif
endif
endif
return false
endfunction
//===========================================================================
function InitTrig_Damage_Engine takes nothing returns nothing
local unit u = CreateUnit(Player(15), 'uloc', 0, 0, 0)
local integer i = 16
//Create this trigger with UnitIndexEvents in order add and remove units
//as they are created or removed.
local trigger t = CreateTrigger()
call TriggerRegisterVariableEvent(t, "udg_UnitIndexEvent", EQUAL, 1.00)
call TriggerRegisterVariableEvent(t, "udg_UnitIndexEvent", EQUAL, 2.00)
call TriggerAddCondition(t, Filter(function SetupDmgEv))
set t = null
//Run the configuration trigger to set all configurables:
if gg_trg_Damage_Engine_Config == null then
//It's possible this InitTrig_ function ran first, in which case use ExecuteFunc.
call ExecuteFunc("Trig_Damage_Engine_Config_Actions")
else
call TriggerExecute(gg_trg_Damage_Engine_Config)
endif
//Create trigger for storing all EVENT_UNIT_DAMAGED events.
call CreateDmgEvTrg()
//Create GUI-friendly trigger for cleaning up after UnitDamageTarget.
set udg_ClearDamageEvent = CreateTrigger()
call TriggerAddCondition(udg_ClearDamageEvent, Filter(function PreCheckDamagedLifeEvent))
//Disable SpellDamageAbility for every player.
loop
set i = i - 1
call SetPlayerAbilityAvailable(Player(i), udg_SpellDamageAbility, false)
exitwhen i == 0
endloop
//Preload abilities.
call UnitAddAbility(u, udg_DamageBlockingAbility)
call UnitAddAbility(u, udg_SpellDamageAbility)
call RemoveUnit(u)
set u = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function DashingSteelInit takes nothing returns nothing
set udg_DS_Hash = InitHashtable()
// ------Configs-------
// The Ability's ID, in this case its A000
// To find it, go to the object editor click View > Display Values as Raw Data
set udg_DS_Ability = 'A000'
// Dummy, the dummy's ID in this case it's h003
// To find it, go to the object editor click View > Display Values as Raw Data
set udg_DS_Dummy = 'h003'
// Model of the ^ above, or the missile that is thrown when DashCount stacks are full.
set udg_DS_MissileModel = "Abilities\\Spells\\Other\\Tornado\\TornadoElementalSmall.mdl"
// attachment point of the missile above.
set udg_DS_DummyAttachment = "origin"
// Size of ^ above, in percentage of original size of the effect.
set udg_DS_ModelSize = 125.00
// Red 1-100 of dummy
set udg_DS_ModelColoring[1] = 45.00
// Green 1-100 of dummy
set udg_DS_ModelColoring[2] = 45.00
// Blue 1-100 of dummy
set udg_DS_ModelColoring[3] = 100.00
// Transparency 1-100 of dummy
set udg_DS_ModelColoring[4] = 0.00
// Distance every iteration
set udg_DS_DashSpeed = 25.00
set udg_DS_TornadoSpeed = 18.00
// Make sure to change cast range respectively in the object editor
// to the same as TornadoTravelDist
set udg_DS_TornadoTravelDist = 875.00
set udg_DS_MaxDashDistance = 395.00
// --------------------
set udg_DS_Animation = "attack"
set udg_DS_EndAnimationSpeed = 200.00
// --------------------
set udg_DS_CasterEffect = "Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl"
set udg_DS_TargetEffect = "Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl"
set udg_DS_DashEffect = "Abilities\\Weapons\\DragonHawkMissile\\DragonHawkMissile.mdl"
set udg_DS_CasterEffectAttachment = "overhead"
set udg_DS_TargetEffectAttachment = "origin"
// Damage per level
set udg_DS_Damage[1] = 55.00
set udg_DS_Damage[2] = 75.00
set udg_DS_Damage[3] = 95.00
// How much damage the tornado does per level, 1 = same damage as dash.
set udg_DS_TornadoMultiplier[1] = 2.00
set udg_DS_TornadoMultiplier[2] = 2.00
set udg_DS_TornadoMultiplier[3] = 2.00
// Damage and Attack types
set udg_DS_AttackType = ATTACK_TYPE_HERO
set udg_DS_DamageType = DAMAGE_TYPE_NORMAL
// ---Damage Range-----
set udg_DS_DRange = 225.00
set udg_DS_NadoKnockupRange = 155.00
//Determines how many dashes until you get a tornado
set udg_DS_DashCountMax[1] = 2
set udg_DS_DashCountMax[2] = 2
set udg_DS_DashCountMax[3] = 2
// --EndConfig---------
set udg_DS_DashCount = 0
endfunction
//===========================================================================
function InitTrig_DashingSteelInit takes nothing returns nothing
set gg_trg_DashingSteelInit = CreateTrigger( )
call TriggerAddAction( gg_trg_DashingSteelInit, function DashingSteelInit )
endfunction
//TESH.scrollpos=50
//TESH.alwaysfold=0
function GSInit takes nothing returns nothing
set udg_TMP_Hash = InitHashtable()
// -------Configs--------
// How fast is the loop trigger?
set udg_TMP_LoopTimer = 0.03
// The Ability's ID, in this case it's A004
// To find it, go to the object editor click View > Display Values as Raw Data
set udg_TMP_Ability = 'A004'
// Dummy, the dummy's ID in this case it's h003
// To find it, go to the object editor click View > Display Values as Raw Data
set udg_TMP_Dummy = 'h003'
// Model of the spinning units
set udg_TMP_SpinModel = "Abilities\\Spells\\Other\\Tornado\\TornadoElementalSmall.mdl"
// End effect
set udg_TMP_EndEffect = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
// Attachment point to the dummy.
set udg_TMP_DummyAttachment = "origin"
// Size of ^ above, in percentage of original size of the effect.
set udg_TMP_ModelSize = 60.00
// Red 1-100 of dummy
set udg_TMP_ModelColoring[1] = 45.00
// Green 1-100 of dummy
set udg_TMP_ModelColoring[2] = 45.00
// Blue 1-100 of dummy
set udg_TMP_ModelColoring[3] = 100.00
// Transparency 1-100 of dummy
set udg_TMP_ModelColoring[4] = 0.00
// Number of Tornadoes spinning
set udg_TMP_WindNumber = 12
// Degrees will be 360 divided by WindNumber so that it is evenly distributed
// However you may change it to anything you'd like
set udg_TMP_WindDegrees = ( 360.00 / I2R(udg_TMP_WindNumber) )
// The Starting Distance from the caster
set udg_TMP_WindDistance = 1.00
// End damage, for the damage during spinning go to the object editor spell
set udg_TMP_Damage[1] = 10.00
set udg_TMP_Damage[2] = 20.00
set udg_TMP_Damage[3] = 30.00
// ----------------
set udg_TMP_DamageType = DAMAGE_TYPE_NORMAL
set udg_TMP_AttackType = ATTACK_TYPE_HERO
// Range of knockup/end damage, the range of spin damage in the object editor
set udg_TMP_Range = 312.00
// --------------------
set udg_TMP_MinDistance = 150.00
// How far out the tornadoes will go
set udg_TMP_MaxDistance = 300.00
// Speed per iteration of the tornadoes going outward
set udg_TMP_WindBaseSpeed = 120.00
set udg_TMP_WindSpeed = ( udg_TMP_WindBaseSpeed * 0.04 )
// Spin speed per iteration of each tornado
set udg_TMP_SpinSpeed = ( 300.00 * 0.02 )
// Max time allowed for tornadoes to be going outward before they are forced
// to be at max distance
set udg_TMP_MaxWindTime = 2000.00
// Duration, also a duration in object editor
set udg_TMP_Duration[1] = 3.00
set udg_TMP_Duration[2] = 3.00
set udg_TMP_Duration[3] = 3.00
// Special Effect on each Wind, I wouldnt recommend using any at all it might lag a bit
set udg_TMP_WindSFX = ""
endfunction
//===========================================================================
function InitTrig_TempestInit takes nothing returns nothing
set gg_trg_TempestInit = CreateTrigger( )
call TriggerAddAction( gg_trg_TempestInit, function GSInit)
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function WTinit takes nothing returns nothing
// The Ability's ID, in this case its A005
// To find it, go to the object editor click View > Display Values as Raw Data
set udg_WT_Ability = 'A005'
// ----Counter proc chance per level--------
set udg_WT_Chance[1] = 7
set udg_WT_Chance[2] = 9
set udg_WT_Chance[3] = 11
// -----Double strike proc chance per level-------
set udg_WT_ChanceStrike[1] = 15
set udg_WT_ChanceStrike[2] = 20
set udg_WT_ChanceStrike[3] = 25
// -----Counter damage per level-------
set udg_WT_Damage[1] = 100.00
set udg_WT_Damage[2] = 150.00
set udg_WT_Damage[3] = 200.00
// Counter's Animation
set udg_WT_CounterAnimation = "spin"
// -----Double Strike damage per level-------
set udg_WT_DamageStrike[1] = 15.00
set udg_WT_DamageStrike[2] = 25.00
set udg_WT_DamageStrike[3] = 35.00
// Attack and Damage type
set udg_WT_AttackType = ATTACK_TYPE_HERO
set udg_WT_DamageType = DAMAGE_TYPE_NORMAL
// Double Strike's Animation
set udg_WT_StrikeAnimation = "attack slam"
// -Counter Damage Range-------
set udg_WT_Radius = 250.00
// -----Counter Effects-------
// Caster effect
set udg_WT_EffectCaster = "Abilities\\Spells\\NightElf\\Taunt\\TauntCaster.mdl"
// Target Effect
set udg_WT_EffectTarget = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
// ------Double Strike Effects------
// Caster Effect
set udg_WT_SEffectCaster = "Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl"
// Target Effect
set udg_WT_SEffectTarget = "Abilities\\Spells\\Human\\Feedback\\ArcaneTowerAttack.mdl"
// Caster Effect Attachment Point
set udg_WT_EffectCasterAttachment = "origin"
// Target Effect Attachment Point
set udg_WT_EffectTargetAttachment = "origin"
endfunction
function InitTrig_WindTechniqueInit takes nothing returns nothing
set gg_trg_WindTechniqueInit = CreateTrigger( )
call TriggerAddAction( gg_trg_WindTechniqueInit, function WTinit )
endfunction
//TESH.scrollpos=10
//TESH.alwaysfold=0
function LastBreathInit takes nothing returns nothing
set udg_LB_Hash = InitHashtable()
// How fast is the LastBreathLoop trigger?
set udg_LB_LoopSpeed = 0.03
// The Ability's ID, in this case its A001
// To find it, go to the object editor click View > Display Values as Raw Data
set udg_LB_Ability = 'A001'
//-------per level------------
set udg_LB_Damage[1] = 290.00
set udg_LB_Damage[2] = 365.00
// Damage and Attack type
set udg_LB_DamageType = DAMAGE_TYPE_NORMAL
set udg_LB_AttackType = ATTACK_TYPE_HERO
//----per level---------------
set udg_LB_Range[1] = 800.00
set udg_LB_Range[2] = 800.00
// How far away from the target during the 3 slashes, and the degree around the target
set udg_LB_DistanceFromTarget = 195.00
set udg_LB_Degrees = 0
// If you want degrees to be a random number set to true, if you want degrees to
// be one value, set to false when you change LB_Degrees
set udg_LB_Randomize = true
//During Last Breath the unit strikes 3 times, this is the animations.
set udg_LB_Animation[1] = "attack"
set udg_LB_Animation[2] = "attack"
set udg_LB_Animation[3] = "attack slam"
//--------------------
set udg_LB_CasterHeight = 300.00
//--------------------
//Teleport effect from original location
set udg_LB_EffectCaster = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
//Teleport effect at new location
set udg_LB_EffectCaster2 = "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl"
// Attachment for the above effect
set udg_LB_CasterEffectAttachment ="origin"
// First impact effect
set udg_LB_TargetEffect[1] = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
// Attachment for the above effect
set udg_LB_TargetEffectAttachment[1] = "origin"
// Second impact effect
set udg_LB_TargetEffect[2] = "Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl"
// Attachment for the above effect
set udg_LB_TargetEffectAttachment[2] = "origin"
// Third impact effect
set udg_LB_TargetEffect[3] = "Objects\\Spawnmodels\\Human\\HumanLargeDeathExplode\\HumanLargeDeathExplode.mdl"
// Attachment for the above effect
set udg_LB_TargetEffectAttachment[3] = "origin"
// Slam ending impact effect
set udg_LB_EffectTargetSlam = "Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl"
// Attachment for the above effect
set udg_LB_TargetEffectAttachment[4] = "origin"
//Time suspended in air per level.
set udg_LB_KnockDuration[1] = 1.00
set udg_LB_KnockDuration[2] = 1.00
//--------------------
set udg_LB_TargetHeight = 300.00
//How fast the units go back to the ground.
set udg_LB_SlamSpeedTarget = 600.00
set udg_LB_SlamSpeedCaster = 985.00
endfunction
//===========================================================================
function InitTrig_LastBreathInit takes nothing returns nothing
set gg_trg_LastBreathInit = CreateTrigger( )
call TriggerAddAction( gg_trg_LastBreathInit, function LastBreathInit )
endfunction
//TESH.scrollpos=45
//TESH.alwaysfold=0
//************************************************************************************************
//* ____ ___ ___ *
//* /_ _| _ \/ __/ Tree Revival System *
//* | || /\__ \ by Spinnaker *
//* |_||_|\_\___/ v1.2.3.1 *
//* *
//************************************************************************************************
//*********************************************************
//* Globals required
//*********************************************************
//* udg_TRtrig Trigger for handling the revive actions
//* udg_TRhash Hashtable for timer issues
//* udg_TRindexD Stores revival instances
//* udg_TRindexN Parameter for timers manipulation
//* udg_TRtimers Timer array variable for recycle issues
//* udg_TRdummyh Dummy harvester for IsDestructibleTree function
//* udg_TRisEnabled Boolean parameter for enabling/disabling the system
//*********************************************************
//* Important
//*********************************************************
// Note: Units which step on position of tree which is currently
// being resurrected may get stuck between trees in that area
//*********************************************************
//* Constant configurable functions
//*********************************************************
//* Rawdata of undead locust unit type
constant function TR_dummyhId takes nothing returns integer
return 'uloc'
endfunction
//* Rawdata of dummy ghoul harvest ability
constant function TR_harvestId takes nothing returns integer
return 'Ahrl'
endfunction
//* Harvest order ID
constant function TR_orderId takes nothing returns integer
return 852018
endfunction
//* Delay before tree gets resurrected
constant function TR_ReviveDelay takes nothing returns real
return 5.
endfunction
//* Tells if birth animation should be shown while resurrecting a tree
constant function TR_ShowAnimation takes nothing returns boolean
return true
endfunction
//*********************************************************
//* System itself
//*********************************************************
function TR_recycleTimer takes timer t returns nothing
debug if t == null then
debug call BJDebugMsg("Attempt to release a null timer")
else
call PauseTimer(t)
set udg_TRtimers[udg_TRindexN] = t
set udg_TRindexN = udg_TRindexN + 1
endif
endfunction
function TR_getTimer takes nothing returns timer
if 0 == udg_TRindexN then
return CreateTimer()
endif
set udg_TRindexN = udg_TRindexN - 1
return udg_TRtimers[udg_TRindexN]
endfunction
function TR_Callback takes nothing returns nothing
local destructable d = LoadDestructableHandle(udg_TRhash, 0, GetHandleId(GetExpiredTimer()))
call DestructableRestoreLife(d, GetDestructableMaxLife(d), TR_ShowAnimation())
call TR_recycleTimer(GetExpiredTimer())
set udg_TRindexD = udg_TRindexD - 1
if udg_TRindexD == 0 then
call FlushChildHashtable(udg_TRhash, 0)
endif
set d = null
endfunction
function TR_CallRevive takes nothing returns boolean
local timer t
if udg_TRisEnabled then
set t = TR_getTimer()
set udg_TRindexD = udg_TRindexD + 1
call SaveDestructableHandle(udg_TRhash, 0, GetHandleId(t), GetTriggerDestructable())
call TimerStart(t, TR_ReviveDelay(), false, function TR_Callback)
set t = null
endif
return false
endfunction
function TR_IsDestructableTree takes destructable dest returns boolean
return IssueTargetOrderById(udg_TRdummyh, TR_orderId(), dest)
endfunction
function TR_AddTree takes nothing returns nothing
if TR_IsDestructableTree(GetEnumDestructable()) then
call TriggerRegisterDeathEvent(udg_TRtrig, GetEnumDestructable())
endif
endfunction
//***************************************************************************
function InitTrig_TreeRevival takes nothing returns nothing
set udg_TRtrig = CreateTrigger()
set udg_TRhash = InitHashtable()
//* By default enabled
set udg_TRisEnabled = true
//* Actions required for IsDestructibleTree function
set udg_TRdummyh = CreateUnit(Player(15), TR_dummyhId(), 0., 0., 0.)
call ShowUnit(udg_TRdummyh, false)
call UnitAddAbility(udg_TRdummyh, TR_harvestId())
call UnitRemoveAbility(udg_TRdummyh, 'Amov')
//* Revival setup
call EnumDestructablesInRect(bj_mapInitialPlayableArea, null, function TR_AddTree)
call TriggerAddCondition(udg_TRtrig, Condition(function TR_CallRevive))
endfunction