Name | Type | is_array | initial_value |
AbyssalGuise_DummyAttacker | unit | No | |
AbyssalGuise_Hero | unit | No | |
AbyssalGuise_HeroPosition | location | No | |
ActiveSkill_Chosen | integer | No | |
ActiveSkill_UpgDialog | dialog | No | |
ActiveSkill_UpgDialogButtons | button | Yes | |
ActiveSkill_UpgStrings | string | Yes | |
AdventureMusic | sound | Yes | |
AllBossMechanics | trigger | Yes | |
AllItemRarities | integer | Yes | |
AllItems | itemcode | Yes | |
AllPackData | real | Yes | |
AllRegionEnvironmentalValues | real | Yes | |
AllSpawnAreas | rect | Yes | |
AngelofBattleCaster | unit | No | |
AngelofBattleCastPoint | location | No | |
AngelofBattleSFX | effect | No | |
AngelofBattleSpawnPoint | location | No | |
AngelofBattleUnit | unit | No | |
ArcaneKnowledgeDropChance | integer | No | |
ArcaneKnowledgeDropChances | integer | Yes | |
ArcaneKnowledgeDropPoint | location | No | |
ArcaneScholar_SpawnChance | integer | No | 4 |
ArcaneScholar_Units | unitcode | Yes | |
Area11SwampSpawnRegions | rect | Yes | |
Area11TowerSpawnRegions | rect | Yes | |
AreaPackSpawnPoint | location | No | |
AreaSpawnPoint | location | No | |
ArmorCalc_ADDEDDAMAGE | real | No | |
ArmorCalc_DAMAGETOTAL | real | No | |
ArmorCalc_GAMEPLAYCONSTANT | real | No | 0.09 |
ArmorCalc_REDUCTION | real | No | |
ArmorCalc_UNMITIGATEDCRIT | real | No | |
ArmorCalc_UNMITIGATEDDAMAGE | real | No | |
BacktoSchoolsButton | button | No | |
BerserkersFuryCaster | unit | No | |
BerserkersFuryCastPoint | location | No | |
BerserkersFuryDummyDamager | unit | No | |
BerserkersFuryHasStopped | boolean | Yes | |
BerserkersFuryRemaining | integer | No | |
BerserkersFurySFX | effect | Yes | |
BerserkersFuryTarget | unit | Yes | |
BerserkersFuryTarget_Angle | real | Yes | |
BerserkersFuryTarget_Distance | real | Yes | |
BerserkersFuryTargetGroup | group | No | |
BerserkersFuryTargetLooper1 | integer | No | 1 |
BerserkersFuryTargetPoint | location | No | |
BerserkersFuryTargetPosition | location | No | |
BlinkSpell_Destination | location | No | |
BlinkSpell_Origin | location | No | |
BlinkSpell_TargetPoint | location | No | |
Boss10_FirestormCaster | unit | No | |
Boss10_FirestormDamage | real | No | |
Boss11_FirestormDamage | real | No | |
Boss11_FirestormDamagers | group | No | |
Boss11_FirestormPoint | location | No | |
Boss1_AddExplosionTargets | group | No | |
Boss1_AddUnit | unit | Yes | |
Boss1_ExplosionDamage | real | No | |
Boss1_ExplosionOrigin | location | No | |
Boss1_ExplosionSFXArray | effect | Yes | |
Boss1_OriginPoint | location | No | |
Boss1_SFXLoopIndex | integer | No | 1 |
Boss1_SlamLoopIndex | integer | No | 1 |
Boss1_SlamTargets | group | No | |
Boss1_SpiderSpawnPoint | location | No | |
Boss2_DummySFXUnits | unit | Yes | |
Boss2_ExplosionDamage | real | No | |
Boss2_ExplosionPoint | location | Yes | |
Boss2_ExplosionTargets | group | No | |
Boss2_OriginPoint | location | No | |
Boss2_SFXArray | effect | Yes | |
Boss2_SpawnSFX | effect | No | |
Boss3_FlyawayDestination | location | No | |
Boss3_FlyawayOrigin | location | No | |
Boss3FireSpawnPoint | location | No | |
Boss4_LightningTotemSFX | effect | No | |
Boss5_PylonSpawnPoint | location | No | |
Boss5_TombsAlive | real | No | |
Boss5AddSpawnPoint | location | No | |
Boss6_SwarmDamage | real | No | |
Boss6_SwarmDamagers | group | No | |
Boss6_SwarmOriginSFX | effect | No | |
Boss6TargetPoint | location | No | |
Boss7_BlizzardDamage | real | No | |
Boss7_BlizzardDamagers | group | No | |
Boss7_BlizzardPoint | location | No | |
Boss8_SilenceTargetPoint | location | No | |
Boss8_SpawnPoint | location | No | |
Boss9_FormLooper | integer | No | |
Boss9_OozeDestination | location | No | |
BossAddstoRemove | group | No | |
BossPhaseNumber | integer | No | 1 |
BossPosition | location | No | |
BossSpawnPoint | location | No | |
BossSpawnPoint2 | location | No | |
BossSpecialEffects | effect | Yes | |
BossStartTriggers | trigger | Yes | |
BossUnit | unit | No | |
BossUnitCount | real | No | |
Brutality_DummySpell | abilcode | No | A000 |
Brutality_ScalingFactor | real | No | 1.00 |
BrutalityCaster | unit | No | |
BrutalityCastOrigin | location | No | |
BrutalityDummyCaster | unit | No | |
ChaosGhost_Auras | abilcode | Yes | |
ChaosGhost_MovePoint | location | No | |
ChaosGhost_SpawnPoint | location | No | |
ChaosGhost_Units | unit | Yes | |
ChaosPillar_AddSpawnPoint | location | No | |
ChaosPillar_AddsRemaining_Int | integer | No | |
ChaosPillar_AddsRemaining_Real | real | No | |
ChaosPillar_CurrentWave | integer | No | |
ChaosPillar_Integers | integer | Yes | |
ChaosPillar_Location | location | Yes | |
ChaosPillar_Pillar | unit | No | |
ChaosPillar_SFXLooper | integer | No | 1 |
ChaosPillar_SFXOther | effect | No | |
ChaosPillar_SpawnSFX | effect | Yes | |
ChaosPillar_UnitTypes | unitcode | Yes | |
ChaosPillarAdd1_SpawnedCount | integer | No | |
ChaosPillarAdd2_SpawnedCount | integer | No | |
ChaosResurection_SpawnPoint | location | No | |
ChaosResurrection_RandomCenter | integer | No | 5 |
ChaosResurrection_SFX | effect | No | |
ChaosResurrectionUnits | unitcode | Yes | |
ChaoticProliferationLevel | integer | Yes | |
ChaoticStrike_AttackCount | real | No | |
ChaoticStrike_Attacker | unit | No | |
ChaoticStrike_Center | location | No | |
ChaoticStrike_DmgAmount | real | No | |
ChaoticStrike_FirstTarget | unit | No | |
ChaoticStrike_PossibleTargets | group | No | |
ChaoticStrikes_MaxTargets | integer | No | 4 |
ChaoticStrikesUpg_Enduring | boolean | No | |
ChosenHero_Number | integer | No | |
ChosenHeroUnit | unit | No | |
ChosenRegionNumber | integer | No | |
ChosenRegionTier | integer | No | |
ChosenSkillInteger | integer | No | |
CinematicRequest | dialog | No | |
CinematicRequestButtons | button | Yes | |
ClassUlt_Abilities | abilcode | Yes | |
ClassUlt_Effect | effect | No | |
ClassUlt_Names | string | Yes | |
CleaveDamagerDummy | unit | No | |
CleaveDamageTargets | group | No | |
CleaveDmgAmount | real | No | |
CleaveOriginPoint | location | No | |
Convocation_AreaTargets | group | No | |
Convocation_AttackerSpawnPoint | location | No | |
Convocation_AttackerTargetPoin | location | No | |
Convocation_Caster | unit | No | |
Convocation_CastOrigin | location | No | |
Convocation_SpiritsSpawned | integer | No | |
Convocation_TargetPoint | location | No | |
CorpseSweepGroup | group | No | |
CountHeroItems | integer | No | |
CriticalStrikeChance_Bonus | integer | No | |
DamageScaling_AGI | real | No | |
DamageScaling_Hero | unit | No | |
DamageScaling_INT | real | No | |
DamageScaling_STR | real | No | |
DevotedBlade_AreaGroup | group | No | |
DevotedBlade_BladeCenter | location | No | |
DevotedBlade_Caster | unit | No | |
DevotedBlade_DamagedGroup | group | No | |
DevotedBlade_DamagedSFX | effect | Yes | |
DevotedBlade_DamagedSFXLooper | integer | No | |
DevotedBlade_DamagedUnitPoint | location | No | |
DevotedBlade_DamagerDummy | unit | No | |
DevotedBlade_FacingAngle | real | No | |
DevotedBlade_Looping | real | No | |
DevotedBlade_Origin | location | No | |
DevotedBlade_SFXUnit | unit | No | |
DevotedBlade_SpawnPoint | location | No | |
DevotedBlade_TargetAngle | real | No | |
DevotedBlade_TargetPoint | location | No | |
DivineImmo_Caster | unit | No | |
DivineImmo_CasterOrigin | location | No | |
DivineImmo_TargetGroup | group | No | |
EarthquakeTotem_OriginUnit | unit | No | |
EarthquakeTotem_PullUpg | boolean | No | false |
EarthquakeTotem_ReachUpg | boolean | No | |
EarthquakeTotemCaster | unit | No | |
EarthquakeTotemEffect | effect | No | |
EarthquakeTotemLocation | location | No | |
EarthquakeTotemTargets | group | No | |
EarthquakeTotemUnit | unit | No | |
Engineering_BallistaUnit | unit | No | |
Engineering_Caster | unit | No | |
Engineering_PossibleTargets | group | No | |
Engineering_SFX | effect | No | |
Engineering_TargetPoint | location | No | |
FinalBoss_AddSpawnPoint | location | No | |
FinalBoss_AddSpawnSFX | effect | Yes | |
FinalBoss_AddTypes | unitcode | Yes | |
FinalBoss_ArenaCenter | location | No | |
FinalBoss_Dead | boolean | No | |
FinalBoss_ReflectDamage | real | No | |
FinalBoss_SpawnRegions | rect | Yes | |
FinalBoss_Unit | unit | No | |
Fireblast_DamageModifier | real | No | 1.00 |
FireblastCastDummy_FIRST | unit | No | |
FireblastCaster | unit | No | |
FireblastCastOrigin_FIRST | location | No | |
FireblastCastOrigin_SECOND | location | No | |
FireblastSplashTargets | group | No | |
FirstSpawnPoint | location | No | |
GameMultiboard | multiboard | No | |
GDD__Integers | integer | Yes | |
GDD__LeftMapGroup | group | No | |
GDD__TriggerArray | trigger | Yes | |
GDD__UnitArray | unit | Yes | |
GDD_Damage | real | No | |
GDD_DamagedUnit | unit | No | |
GDD_DamageSource | unit | No | |
GDD_Event | real | No | |
GenericDamagerDummy | unit | No | |
GenericPoint | location | No | |
HammerStormCaster | unit | No | |
HammerStormCastPoint | location | No | |
HammerStormPossibleTargets | group | No | |
HammerStormTarget | unit | No | |
HeroChoiceButtons | button | Yes | |
HeroChoiceDialog | dialog | No | |
HeroHasDied | boolean | No | |
HeroPosition | location | No | |
HeroUnits | group | No | |
HitDmgAmount | real | No | |
HolyBinding_AoE | real | No | 250.00 |
HolyBinding_Duration | real | No | 2.00 |
HolyBindingCaster | unit | No | |
HolyBindingDamagerDummy | unit | No | |
HolyBindingTargetPoint | location | No | |
HolyBindingTargets | group | No | |
IceLordsHowl_CastPoint | location | No | |
IceLordsHowl_DummyCaster | unit | No | |
IceLordsHowlProcCenter | integer | No | 5 |
IceLordsHowlResetUnits | group | No | |
IceLordsUnit | unit | No | |
Info_PassivesDiscovered | boolean | No | |
ItemCountGeneral | integer | No | |
ItemCraftingRecipeRefund | integer | Yes | |
ItemCraftingRecipes | itemcode | Yes | |
ItemDiceRoll | integer | No | |
ItemDropPoint | location | No | |
ItemRarityStringbyRegion | string | Yes | |
ItemRefundAmounts | integer | Yes | |
ItemSlotLooper | integer | No | 1 |
ItemTeleportPoint | location | No | |
ItemTP_SFX | effect | Yes | |
ItemTP_SFXLooper | integer | No | |
ItemTransmuteEffectLooper | integer | No | |
ItemTransmuteEffectPoint | location | No | |
ItemTransmuteEffects | effect | Yes | |
ItemTransmuterActive | boolean | Yes | |
ItemTransmuters | itemcode | Yes | |
ItemTransmutersOff | itemcode | Yes | |
Journal_CapIncreaseAmnts | integer | Yes | |
Journal_ChargedCount | integer | No | |
Journal_RechargeRatesChaotic | integer | Yes | |
Journal_TotalCount | integer | No | |
Journal_UpgradeItems | itemcode | Yes | |
Lifesteal_Bonus | real | No | |
LifeStealAmount | real | No | |
LockedSkillsNumbers | integer | Yes | |
MarksmansCaster | unit | No | |
MarksmansCastPoint | location | No | |
MarksmansDummyCaster | unit | No | |
MarksmansSFX | effect | No | |
MarksmansTarget | unit | No | |
MarksmansTargetPoint | location | No | |
MonsterArmorUpgrades | techcode | Yes | |
MonsterAtkSpeedUpgrades | techcode | Yes | |
MonsterHPRegenUpgrades | techcode | Yes | |
MonsterHPUpgrades | techcode | Yes | |
MonsterMoveSpeedUpgrades | techcode | Yes | |
MonsterPackCountMod | real | No | 1.00 |
MonsterPackSizeMod | real | Yes | 1.00 |
NonTooltipBacktoTownButton | button | No | |
NonTooltipPassiveStrings | string | Yes | |
NonTooltipPassiveWindowTrig | trigger | Yes | |
NonTooltipUpgradeButtons | button | Yes | |
NonTooltipUpgradeTypesButton | button | Yes | |
NumberofSkillsChosen | integer | No | 0 |
Orgh_Caster | unit | No | |
Orgh_CastPoint | location | No | |
Orgh_DamagerDummy | unit | No | |
Orgh_DummyAttacker | unit | No | |
Orgh_LoopInteger | real | No | |
Orgh_TargetGroup | group | No | |
Orgh_TargetPoint | location | No | |
PassivesExplanations_Buttons | button | Yes | |
PassivesExplanations_Triggers | trigger | Yes | |
PassiveUpgradeLevel | integer | Yes | |
PlayerPreviousGold | integer | No | |
Quest_GoldGathered | quest | No | |
Quest_GoldMilestoneHit | boolean | Yes | |
Quest_GoldMilestones | real | Yes | 0.00 |
Quest_KnowledgeGathered | quest | No | |
Quest_KnowledgeMilestoneHit | boolean | Yes | |
Quest_KnowledgeMilestones | real | Yes | |
Quest_MonstersKilled | quest | No | |
Quest_RegionsExplored | quest | No | |
Quest_TotalGoldGathered | real | No | |
Quest_TotalKnowledgeGathered | real | No | |
Quest_TotalMonstersKilled | real | No | |
Quest_TotalRegionsExplored | real | No | |
QuestOrderStrings | string | Yes | |
QuestsLooper | integer | Yes | 1 |
Region11_CameraTriggers | trigger | Yes | |
Region11Boss_Phase1Cycler | integer | No | 1 |
Region11Boss_Phase2Cycler | integer | No | |
Region11ShardDropPoint | location | No | |
RegionBossUnitTypes | unitcode | Yes | |
RegionDifficultyStrings | string | Yes | |
RegionExploreDialog | dialog | No | |
RegionExploreDialogButtons | button | Yes | |
RegionHasFogorWater | boolean | Yes | |
RegionLastIndex | integer | Yes | |
RegionMonsterUnitTypes | unitcode | Yes | |
RegionNameStrings | string | Yes | |
RegionStatsLog_GoldCurrent | integer | No | |
RegionStatsLog_GoldGained | integer | No | |
RegionStatsLog_GoldStarting | integer | No | |
RegionStatsLog_XPCurrent | integer | No | |
RegionStatsLog_XPGained | integer | No | |
RegionStatsLog_XPStarting | integer | No | |
RegionTierProbabilityCenter | integer | Yes | 6 |
RegionTimesOfDay | real | Yes | |
RemainingMonsters | real | No | |
RichRegenerationAmount | real | No | |
RichRegenerationCaster | unit | No | |
RichRegenerationLooper | integer | No | |
RicochetAxe_ArmorShredUpgrade | boolean | No | |
RicochetAxe_DamageRedUpgrade | boolean | No | |
RicochetAxeCaster | unit | No | |
RicochetAxeCastOrigin | location | No | |
RicochetAxeDummyCaster | unit | No | |
RicochetAxeFirstTarget | unit | No | |
Riposte_AbsorbUpg | boolean | No | |
Riposte_BuffingSkill | abilcode | No | A00I |
Riposte_Caster | unit | No | |
Riposte_CastOrigin | location | No | |
Riposte_DummyBuffer | unit | No | |
Riposte_DummyDamager | unit | No | |
SeekArcanePowerDialogue | dialog | No | |
SeekRegionDummyCost | integer | Yes | |
SeekRegionDummyUnits | unitcode | Yes | |
ShadowFuryCaster | unit | No | |
ShadowFuryCastPoint | location | No | |
ShadowFuryInstances | integer | No | |
ShadowFuryPossibleTargets | group | No | |
ShadowFuryTarget | unit | No | |
ShadowFuryTargetPoint | location | No | |
ShadowFuryTeleportPoint | location | No | |
ShoppingEffects | effect | Yes | |
SkillDialogueButtons | button | Yes | |
SkillDmgAmount | real | No | |
SkillsDialogue | dialog | No | |
SnakeGodsEyeCaster | unit | No | |
SnakeGodsEyeCenterPoint | location | No | |
SnakeGodsEyeLooper | integer | No | |
SnakeGodsEyeSpawnPoint | location | No | |
SnakeGodsEyeUnitArray | unit | Yes | |
SpawnOffsetMax | real | No | |
SpawnOffsetMin | real | No | |
SpawnPoint_Integer | integer | No | |
SpawnPoints | location | Yes | |
TempInstability_Caster | unit | No | |
TempInstability_CastPoint | location | No | |
TempInstability_ExcessTargets | group | No | |
TempInstability_MainCaster | unit | No | |
TempInstability_Target | unit | No | |
TempInstability_TargetPoint | location | No | |
Thunderquake_Caster | unit | No | |
Thunderquake_Origin | location | No | |
Thunderquake_RockSpawnPoint | location | No | |
Thunderquake_TargetDestination | location | No | |
Thunderquake_TargetOrigin | location | No | |
Thunderquake_Targets | group | No | |
TooltipAbilities | abilcode | Yes | |
TooltipAbilityNames | string | Yes | |
TownTelePoint | location | No | |
TransientShopItemType | itemcode | Yes | |
TreantTotem_Caster | unit | No | |
TreantTotem_DmgAmount | real | No | |
TreantTotem_ExplosionOrigin | location | No | |
TreantTotem_ExplosionSFX | effect | Yes | |
TreantTotem_ExplosionSFXIndex | integer | No | 1 |
TreantTotem_ExplosionTargets | group | No | |
TreantTotem_Location | location | No | |
TreantTotem_RangedUpg | boolean | No | |
TreantTotem_SFX | effect | Yes | |
TreantTotem_SFXIndex | integer | No | |
TreantTotem_SpawnPoint | location | No | |
TreantTotem_SummonedUnit | unitcode | No | e005 |
TreantTotem_Target | unit | No | |
TreantTotem_TargetGroup | group | No | |
TreantTotem_Unit | unit | No | |
Tutorial_ChaoticRegionExplored | boolean | No | |
Tutorials_OnBoolean | boolean | No | |
TutorialToggle | dialog | No | |
TutorialToggleButtons | button | Yes | |
Upg_Level_upgrades | techcode | Yes | |
Upg_Level_variables | real | Yes | |
UpgradesDialog | dialog | No | |
UpgradesDialogMage | dialog | No | |
UpgradesDialogRogue | dialog | No | |
UpgradesDialogWarrior | dialog | No | |
VendorBankPoint | location | No |
// GUI-Friendly Damage Detection -- v1.2.1 -- by Weep
// http:// www.thehelper.net/forums/showthread.php?t=137957
//
// Requires: only this trigger and its variables.
//
// -- What? --
// This snippet provides a leak-free, GUI-friendly implementation of an "any unit takes
// damage" event. It requires no JASS knowledge to use.
//
// It uses the Game - Value Of Real Variable event as its method of activating other
// triggers, and passes the event responses through a few globals.
//
// -- Why? --
// The traditional GUI method of setting up a trigger than runs when any unit is damaged
// leaks trigger events. This snippet is easy to implement and removes the need to do
// you own GUI damage detection setup.
//
// -- How To Implement --
// 0. Before you copy triggers that use GDD into a new map, you need to copy over GDD
// with its GDD Variable Creator trigger, or there will be a problem: the variables
// won't be automatically created correctly.
//
// 1. Be sure "Automatically create unknown variables while pasting trigger data" is
// enabled in the World Editor general preferences.
// 2. Copy this trigger category ("GDD") and paste it into your map.
// (Alternately: create the variables listed in the globals block below, create a
// trigger named "GUI Friendly Damage Detection", and paste in this entire text.)
// 3. Create your damage triggers using Game - Value Of Real Variable as the event,
// select GDD_Event as the variable, and leave the rest of the settings to the default
// "becomes Equal to 0.00".
// The event responses are the following variables:
// GDD_Damage is the amount of damage, replacing Event Response - Damage Taken.
// GDD_DamagedUnit is the damaged unit, replacing Event Response - Triggering Unit.
// Triggering Unit can still be used, if you need to use waits.
// Read the -- Notes -- section below for more info.
// GDD_DamageSource is the damaging unit, replacing Event Response - Damage Source.
//
// -- Notes --
// GDD's event response variables are not wait-safe; you can't use them after a wait in
// a trigger. If you need to use waits, Triggering Unit (a.k.a. GetTriggerUnit()) can
// be used in place of GDD_DamageSource. There is no usable wait-safe equivalent to
// Event Damage or Damage Source; you'll need to save the values yourself.
//
// Don't write any values to the variables used as the event responses, or it will mess
// up any other triggers using this snippet for their triggering. Only use their values.
//
// This uses arrays, so can detect damage for a maximum of 8190 units at a time, and
// cleans up data at a rate of 33.33 per second, by default. This should be enough for
// most maps, but if you want to change the rate, change the value returned in the
// GDD_RecycleRate function at the top of the code, below.
//
// By default, GDD will not register units that have Locust at the moment of their
// entering the game, and will not recognize when they take damage (which can only
// happen if the Locust ability is later removed from the unit.) To allow a unit to have
// Locust yet still cause GDD damage events if Locust is removed, you can either design
// the unit to not have Locust by default and add it via triggers after creation, or
// edit the GDD_Filter function at the top of the code, below.
//
// -- Credits --
// Captain Griffin on wc3c.net for the research and concept of GroupRefresh.
//
// Credit in your map not needed, but please include this README.
//
// -- Version History --
// 1.2.1: Minor code cleaning. Added configuration functions. Updated documentation.
// 1.2.0: Made this snippet work properly with recursive damage.
// 1.1.1: Added a check in order to not index units with the Locust ability (dummy units).
// If you wish to check for damage taken by a unit that is unselectable, do not
// give the unit-type Locust in the object editor; instead, add the Locust ability
// 'Aloc' via a trigger after its creation, then remove it.
// 1.1.0: Added a check in case a unit gets moved out of the map and back.
// 1.0.0: First release.
//===================================================================
// Configurables.
function GDD_RecycleRate takes nothing returns real //The rate at which the system checks units to see if they've been removed from the game
return 0.03
endfunction
function GDD_Filter takes unit u returns boolean //The condition a unit has to pass to have it registered for damage detection
return GetUnitAbilityLevel(u, 'Aloc') == 0 //By default, the system ignores Locust units, because they normally can't take damage anyway
endfunction
//===================================================================
// This is just for reference.
// If you use JassHelper, you could uncomment this section instead of creating the variables in the trigger editor.
// globals
// real udg_GDD_Event = 0.
// real udg_GDD_Damage = 0.
// unit udg_GDD_DamagedUnit
// unit udg_GDD_DamageSource
// trigger array udg_GDD__TriggerArray
// integer array udg_GDD__Integers
// unit array udg_GDD__UnitArray
// group udg_GDD__LeftMapGroup = CreateGroup()
// endglobals
//===================================================================
// System code follows. Don't touch!
function GDD_Event takes nothing returns boolean
local unit damagedcache = udg_GDD_DamagedUnit
local unit damagingcache = udg_GDD_DamageSource
local real damagecache = udg_GDD_Damage
set udg_GDD_DamagedUnit = GetTriggerUnit()
set udg_GDD_DamageSource = GetEventDamageSource()
set udg_GDD_Damage = GetEventDamage()
set udg_GDD_Event = 1.
set udg_GDD_Event = 0.
set udg_GDD_DamagedUnit = damagedcache
set udg_GDD_DamageSource = damagingcache
set udg_GDD_Damage = damagecache
set damagedcache = null
set damagingcache = null
return false
endfunction
function GDD_AddDetection takes nothing returns boolean
// if(udg_GDD__Integers[0] > 8190) then
// call BJDebugMsg("GDD: Too many damage events! Decrease number of units present in the map or increase recycle rate.")
// ***Recycle rate is specified in the GDD_RecycleRate function at the top of the code. Smaller is faster.***
// return
// endif
if(IsUnitInGroup(GetFilterUnit(), udg_GDD__LeftMapGroup)) then
call GroupRemoveUnit(udg_GDD__LeftMapGroup, GetFilterUnit())
elseif(GDD_Filter(GetFilterUnit())) then
set udg_GDD__Integers[0] = udg_GDD__Integers[0]+1
set udg_GDD__UnitArray[udg_GDD__Integers[0]] = GetFilterUnit()
set udg_GDD__TriggerArray[udg_GDD__Integers[0]] = CreateTrigger()
call TriggerRegisterUnitEvent(udg_GDD__TriggerArray[udg_GDD__Integers[0]], udg_GDD__UnitArray[udg_GDD__Integers[0]], EVENT_UNIT_DAMAGED)
call TriggerAddCondition(udg_GDD__TriggerArray[udg_GDD__Integers[0]], Condition(function GDD_Event))
endif
return false
endfunction
function GDD_PreplacedDetection takes nothing returns nothing
local group g = CreateGroup()
local integer i = 0
loop
call GroupEnumUnitsOfPlayer(g, Player(i), Condition(function GDD_AddDetection))
set i = i+1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call DestroyGroup(g)
set g = null
endfunction
function GDD_GroupRefresh takes nothing returns nothing
// Based on GroupRefresh by Captain Griffen on wc3c.net
if (bj_slotControlUsed[5063] == true) then
call GroupClear(udg_GDD__LeftMapGroup)
set bj_slotControlUsed[5063] = false
endif
call GroupAddUnit(udg_GDD__LeftMapGroup, GetEnumUnit())
endfunction
function GDD_Recycle takes nothing returns nothing
if(udg_GDD__Integers[0] <= 0) then
return
elseif(udg_GDD__Integers[1] <= 0) then
set udg_GDD__Integers[1] = udg_GDD__Integers[0]
endif
if(GetUnitTypeId(udg_GDD__UnitArray[udg_GDD__Integers[1]]) == 0) then
call DestroyTrigger(udg_GDD__TriggerArray[udg_GDD__Integers[1]])
set udg_GDD__TriggerArray[udg_GDD__Integers[1]] = null
set udg_GDD__TriggerArray[udg_GDD__Integers[1]] = udg_GDD__TriggerArray[udg_GDD__Integers[0]]
set udg_GDD__UnitArray[udg_GDD__Integers[1]] = udg_GDD__UnitArray[udg_GDD__Integers[0]]
set udg_GDD__UnitArray[udg_GDD__Integers[0]] = null
set udg_GDD__Integers[0] = udg_GDD__Integers[0]-1
endif
set udg_GDD__Integers[1] = udg_GDD__Integers[1]-1
endfunction
function GDD_LeaveMap takes nothing returns boolean
local boolean cached = bj_slotControlUsed[5063]
if(udg_GDD__Integers[2] < 64) then
set udg_GDD__Integers[2] = udg_GDD__Integers[2]+1
else
set bj_slotControlUsed[5063] = true
call ForGroup(udg_GDD__LeftMapGroup, function GDD_GroupRefresh)
set udg_GDD__Integers[2] = 0
endif
call GroupAddUnit(udg_GDD__LeftMapGroup, GetFilterUnit())
set bj_slotControlUsed[5063] = cached
return false
endfunction
// ===========================================================================
function InitTrig_GUI_Friendly_Damage_Detection takes nothing returns nothing
local region r = CreateRegion()
call RegionAddRect(r, GetWorldBounds())
call TriggerRegisterEnterRegion(CreateTrigger(), r, Condition(function GDD_AddDetection))
call TriggerRegisterLeaveRegion(CreateTrigger(), r, Condition(function GDD_LeaveMap))
call GDD_PreplacedDetection()
call TimerStart(CreateTimer(), GDD_RecycleRate(), true, function GDD_Recycle)
set r = null
endfunction