Name | Type | is_array | initial_value |
AAGROUP | group | No | |
AAPOINT | location | No | |
AATARGET | unit | No | |
Abused | boolean | No | |
AetrisEffect | real | No | |
AetrisEffectSoul | real | No | |
AF_Chance | integer | No | |
AFirePoint | location | No | |
Ally | group | No | |
AngleRing | real | No | |
APointQuick1 | location | No | |
APointQuick2 | location | No | |
APointQuick3 | location | No | |
AQuickFacing | real | No | |
Arazayah | unit | No | |
ArazayahCallUp | unit | No | |
ArazayahCallUpCD | unit | No | |
AttributePool | integer | No | |
AttributePoolMemory | integer | No | |
AvatarCounter | real | No | |
BagChange1Slot1 | item | No | |
BagChange1Slot2 | item | No | |
BagChange1Slot3 | item | No | |
BagChange1Slot4 | item | No | |
BagChange1Slot5 | item | No | |
BagChange1Slot6 | item | No | |
BagChange2Slot1 | item | No | |
BagChange2Slot2 | item | No | |
BagChange2Slot3 | item | No | |
BagChange2Slot4 | item | No | |
BagChange2Slot5 | item | No | |
BagChange2Slot6 | item | No | |
Beam | effect | No | |
BeamOrb | effect | No | |
BlizzardSnow | weathereffect | No | |
BlizzardWind | weathereffect | No | |
Blossoms15 | boolean | No | |
BlueBallEffect | effect | No | |
BoethguardTalking | unit | No | |
BoethNeckEffect | real | No | |
BoethsoulDeeps | boolean | No | |
BollardMana | real | No | |
BOLLARDPOINT | location | No | |
Bombarder | unit | No | |
BondEff1 | effect | No | |
BondEff2 | effect | No | |
BondEff3 | effect | No | |
Bonds | unit | No | |
Bubble1 | unit | No | |
Bubble1Shooter | unit | No | |
Bubble2 | unit | No | |
Bubble2Shooter | unit | No | |
Bubble3 | unit | No | |
Bubble3Shooter | unit | No | |
BubbleShock1 | unit | No | |
BubbleShock10 | unit | No | |
BubbleShock11 | unit | No | |
BubbleShock12 | unit | No | |
BubbleShock13 | unit | No | |
BubbleShock14 | unit | No | |
BubbleShock15 | unit | No | |
BubbleShock16 | unit | No | |
BubbleShock2 | unit | No | |
BubbleShock3 | unit | No | |
BubbleShock4 | unit | No | |
BubbleShock5 | unit | No | |
BubbleShock6 | unit | No | |
BubbleShock7 | unit | No | |
BubbleShock8 | unit | No | |
BubbleShock9 | unit | No | |
ChannelSummon | effect | No | |
CinematicSkipped1 | boolean | No | |
CinematicSkipped2 | boolean | No | |
CinematicSkipped3 | boolean | No | |
CinematicSkipped4 | boolean | No | |
CirrathoDeath | boolean | No | |
CO | item | No | |
ColdBomb | unit | No | |
ColdSoulReal | real | No | |
CrystalOffset | location | No | |
CrystalTarget | location | No | |
CubeBoolean1 | boolean | No | |
CubeBoolean2 | boolean | No | |
CubeBoolean3 | boolean | No | |
CubeBoolean4 | boolean | No | |
CubeBoolean5 | boolean | No | |
CubeBoolean6 | boolean | No | |
CubeBoolean7 | boolean | No | |
CubeBoolean8 | boolean | No | |
CubeEffect1 | effect | No | |
CubeEffect2 | effect | No | |
CubeEffect3 | effect | No | |
CubeEffect4 | effect | No | |
CubeEffect5 | effect | No | |
CubeEffect6 | effect | No | |
CubeEffect7 | effect | No | |
CubeEffect8 | effect | No | |
CubeTrigger1 | unit | No | |
CubeTrigger2 | unit | No | |
CubeTrigger3 | unit | No | |
CubeTrigger4 | unit | No | |
Cuirass | item | No | |
DamageDealtStatistics | real | No | |
DamageTakenStatistics | real | No | |
DH_BaseDamage | real | No | |
DH_BaseDamage_Copy | real | No | |
DH_Caster | unit | No | |
DH_Caster_Copy | unit | No | |
DH_Damage | real | No | |
DH_Damage_Copy | real | No | |
DH_DamagePerLevel | real | No | |
DH_DamagePerLevel_Copy | real | No | |
DH_Dummy | unit | No | |
DH_Dummy_Copy | unit | No | |
DH_Group | group | No | |
DH_Group2 | group | No | |
DH_Group2_Copy | group | No | |
DH_Group_Copy | group | No | |
DH_TargetLoc | location | No | |
DH_TargetLoc_Copy | location | No | |
Dialog | dialog | No | |
DialogButton1 | button | No | |
DialogButton2 | button | No | |
DialogButton3 | button | No | |
DialogButton4 | button | No | |
DialogButton5 | button | No | |
DialogButton6 | button | No | |
DialogButtonCancel | button | No | |
DragonOn | boolean | No | |
DreadGroup | group | No | |
DreadOrb1 | unit | No | |
DreadOrb2 | unit | No | |
DreadOrb3 | unit | No | |
DUM18 | unit | No | |
DUM19 | unit | No | |
ElementalSummonStats | real | No | |
EleProg | unit | No | |
EnergyOrb | unit | No | |
ErtioSphere | item | No | |
Exclamation1 | effect | No | |
Exclamation2 | effect | No | |
Exclamation3 | effect | No | |
Exclamation4 | effect | No | |
Exclamation5 | effect | No | |
Exclamation6 | effect | No | |
Eyestone | item | No | |
FrostCircle1 | location | No | |
FrostCircle2 | location | No | |
FrostCircle3 | location | No | |
FrostCircle4 | location | No | |
FrostCircle5 | location | No | |
FrostCircle6 | location | No | |
FrostskyPeak | boolean | 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 | |
Generator1 | real | No | |
Generator1End | boolean | No | |
Generator2 | real | No | |
Generator2End | boolean | No | |
Generator3 | real | No | |
Generator3End | boolean | No | |
Generator4 | real | No | |
Generator4End | boolean | No | |
Ghartek1 | unit | No | |
Ghartek2 | unit | No | |
Ghartek3 | unit | No | |
Ghartek4 | unit | No | |
Ghartek5 | unit | No | |
Ghartek6 | unit | No | |
Ghartek7 | unit | No | |
GhartekGroup | group | No | |
GlyphMine | unit | No | |
GlyphPoint | location | No | |
GlyphRuneGroup | group | No | |
GlyphRuneTarget | unit | No | |
GO | item | No | |
GornuCrystal1 | unit | No | |
GornuCrystal2 | unit | No | |
GornuCrystal3 | unit | No | |
GornuShield | unit | No | |
GornuSpawnReal | real | No | |
GornuSpawnRegion | rect | No | |
GornuSphere | unit | No | |
Grenade | unit | No | |
GrenadeGroup | group | No | |
GrenadeOrb | unit | No | |
GrenadeSummonPoint | location | No | |
GREpoint | location | No | |
GuardFreezeGroup | group | No | |
Heal1 | real | No | |
HealingStatistics | real | No | |
Hero | unit | No | |
HeroBorn | unit | No | |
HeroFaceCrystal | real | No | |
HeroLocationCrystal | location | No | |
HeroPathCrystal | real | No | |
HeroPoint | location | No | |
Horthodamus | boolean | No | |
Hostile | group | No | |
IceSlam1 | unit | No | |
IceSlam2 | unit | No | |
Icesoul | unit | No | |
IceSummon | unit | No | |
IceSummon2 | unit | No | |
Icing | unit | No | |
Io1 | unit | No | |
Io2 | unit | No | |
IoRegion | rect | No | |
ItemTakenConCryst | real | No | |
ItemTakenCryst | real | No | |
ItemTakenEssence | real | No | |
ItemTakenSphere | real | No | |
Jar1 | unit | No | |
Jar1Effect | unit | No | |
Jar2 | unit | No | |
Jar2Effect | unit | No | |
Jar3 | unit | No | |
Jar3Effect | unit | No | |
JarLighting | boolean | No | |
KB_Angle | real | Yes | |
KB_Casters | unit | Yes | |
KB_CountBuffs | integer | No | |
KB_DestroyTrees | boolean | Yes | |
KB_EffectCounter | integer | Yes | |
KB_EffectCounter2 | integer | Yes | |
KB_Effects_1 | string | Yes | |
KB_Effects_2 | string | Yes | |
KB_GeneralIntegers | integervar | Yes | |
KB_KnockbackedUnits | group | No | |
KB_Levels | integer | Yes | |
KB_MaxDistance | real | Yes | |
KB_ReachedDistance | real | Yes | |
KB_ReducedReal | real | No | |
KB_ReduceSpeedReal | real | Yes | |
KB_SpecificSpeed | real | Yes | |
KB_StartPositions | location | Yes | |
KB_TempPoint | location | Yes | |
KB_TempReal | real | No | |
KB_TotalKnockUnits | integer | No | |
KB_Units | unit | Yes | |
KBA_Caster | unit | No | |
KBA_DestroyTrees | boolean | No | |
KBA_DistancePerLevel | real | No | |
KBA_Level | integer | No | |
KBA_SpecialEffects | string | Yes | |
KBA_Speed | real | No | |
KBA_StartingPosition | location | No | |
KBA_TargetUnit | unit | No | |
KharSwarm | location | No | |
Khnartho | unit | No | |
LargestHitStatistics | real | No | |
LashPoint | location | No | |
LashSword | unit | No | |
LightPoint | unit | No | |
Loop_Integer | integer | No | |
Marun | unit | No | |
MarunCounter | integer | No | |
MaskON | boolean | No | |
Max_Hp | integer | No | |
Max_Mana | integer | No | |
MirrorGreenLowerBool | boolean | No | |
MirrorGreenUpperBool | boolean | No | |
MirrorHintPointLower | location | No | |
MirrorHintPointUpper | location | No | |
MirrorLowerGreen | unit | No | |
MirrorLowerHint | unit | No | |
MirrorLowerPurple | unit | No | |
MirrorLowerRed | unit | No | |
MirrorLowerTrigger | unit | No | |
MirrorLowerYellow | unit | No | |
MirrorPurpleLowerBool | boolean | No | |
MirrorPurpleUpperBool | boolean | No | |
MirrorRedLowerBool | boolean | No | |
MirrorRedUpperBool | boolean | No | |
MirrorUpperGreen | unit | No | |
MirrorUpperHint | unit | No | |
MirrorUpperPurple | unit | No | |
MirrorUpperRed | unit | No | |
MirrorUpperTrigger | unit | No | |
MirrorUpperYellow | unit | No | |
MirrorYellowLowerBool | boolean | No | |
MirrorYellowUpperBool | boolean | No | |
ModeAdvanced | boolean | No | |
ModeNormal | boolean | No | |
MoltenSpawn | unit | No | |
MoltenSpawn2 | unit | No | |
MoltenSpawn3 | unit | No | |
Narsetrodamus | boolean | No | |
NeedleAngle | real | No | |
NeedleGroup | group | No | |
NetherDummy | unit | No | |
NewbornLife | integer | No | |
NewbornMana | integer | No | |
Orb11 | unit | No | |
Orb12 | unit | No | |
Orb13 | unit | No | |
Orb1Fire | boolean | No | |
Orb1Frost | boolean | No | |
Orb1Poison | boolean | No | |
Orb21 | unit | No | |
Orb22 | unit | No | |
Orb23 | unit | No | |
Orb2Fire | boolean | No | |
Orb2Frost | boolean | No | |
Orb2Poison | boolean | No | |
Orb31 | unit | No | |
Orb32 | unit | No | |
Orb33 | unit | No | |
Orb3Fire | boolean | No | |
Orb3Frost | boolean | No | |
Orb3Poison | boolean | No | |
OrbGates1 | unit | No | |
OrbGates2 | unit | No | |
OrbGates3 | unit | No | |
OrbGates4 | unit | No | |
OrbGates5 | unit | No | |
OrbGates6 | unit | No | |
OrbsTarget | unit | No | |
OrbsTargetEffect | effect | No | |
Pals | group | No | |
PickedUnit | unit | No | |
PickedWanderer | unit | No | |
PlayerColors | string | Yes | |
PlayerHero | unit | Yes | |
PointPower | location | No | |
Probability1 | integer | No | |
ProfoundEff1 | unit | No | |
ProfoundEff2 | unit | No | |
ProfoundEff3 | unit | No | |
ProtectionPool | integer | No | |
Pylon11 | boolean | No | |
Pylon11Effect | effect | No | |
Pylon11Unit | unit | No | |
Pylon12 | boolean | No | |
Pylon12Effect | effect | No | |
Pylon12Unit | unit | No | |
Pylon13 | boolean | No | |
Pylon13Effect | effect | No | |
Pylon13Unit | unit | No | |
Pylon14 | boolean | No | |
Pylon14Effect | effect | No | |
Pylon14Unit | unit | No | |
Pylon21 | boolean | No | |
Pylon21Effect | effect | No | |
Pylon21Unit | unit | No | |
Pylon22 | boolean | No | |
Pylon22Effect | effect | No | |
Pylon22Unit | unit | No | |
Pylon23 | boolean | No | |
Pylon23Effect | effect | No | |
Pylon23Unit | unit | No | |
Pylon24 | boolean | No | |
Pylon24Effect | effect | No | |
Pylon24Unit | unit | No | |
Pylon31 | boolean | No | |
Pylon31Effect | effect | No | |
Pylon31Unit | unit | No | |
Pylon32 | boolean | No | |
Pylon32Effect | effect | No | |
Pylon32Unit | unit | No | |
Pylon33 | boolean | No | |
Pylon33Effect | effect | No | |
Pylon33Unit | unit | No | |
Pylon34 | boolean | No | |
Pylon34Effect | effect | No | |
Pylon34Unit | unit | No | |
PylonTele | effect | No | |
QuestMain | quest | No | |
QuestMainAdditional | quest | No | |
QuestMainAdditionalReq1 | questitem | No | |
QuestMainReq1 | questitem | No | |
QuestOptional1 | quest | No | |
QuestOptional1Req1 | questitem | No | |
QuestOptional2 | quest | No | |
QuestOptional2Req1 | questitem | No | |
QuestOptional3 | quest | No | |
QuestOptional3Req1 | questitem | No | |
QuestOptional4 | quest | No | |
QuestOptional4Req1 | questitem | No | |
QuestOptional5 | quest | No | |
QuestOptional5Req1 | questitem | No | |
QuestOptional6 | quest | No | |
QuestOptional6Req1 | questitem | No | |
RandomGrenadeUnit | unit | No | |
RandomHostile | unit | No | |
Ring1 | effect | No | |
Ring1Prog | unit | No | |
Ring2 | effect | No | |
Ring2Prog | unit | No | |
Ring3 | effect | No | |
Ring3Prog | unit | No | |
RingPoint | location | No | |
RingPointSummon | location | No | |
RitualFloor | unit | No | |
Rockwonder | boolean | No | |
RollingDoor | unit | No | |
RotationAngleT1 | real | No | |
RotationAngleT2 | real | No | |
RotationAngleT3 | real | No | |
RotationAngleT4 | real | No | |
RotatorOrb1 | boolean | No | |
RotatorOrb2 | boolean | No | |
RotatorOrb3 | boolean | No | |
RotatorOrb4 | boolean | No | |
RotatorT21 | boolean | No | |
RotatorT22 | boolean | No | |
RotatorT23 | boolean | No | |
RotatorT24 | boolean | No | |
RotatorT25 | boolean | No | |
RotatorT26 | boolean | No | |
RotatorT27 | boolean | No | |
RotatorT28 | boolean | No | |
RotatorT31 | boolean | No | |
RotatorT32 | boolean | No | |
RotatorT33 | boolean | No | |
RotatorT34 | boolean | No | |
RotatorT35 | boolean | No | |
RotatorT36 | boolean | No | |
RotatorT37 | boolean | No | |
RotatorT38 | boolean | No | |
RotatorT41 | boolean | No | |
RotatorT42 | boolean | No | |
RotatorT43 | boolean | No | |
RotatorT44 | boolean | No | |
RotatorT45 | boolean | No | |
RotatorT46 | boolean | No | |
RotatorT47 | boolean | No | |
RotatorT48 | boolean | No | |
RotatorTrigger1 | unit | No | |
RotatorTrigger2 | unit | No | |
RotatorTrigger3 | unit | No | |
RotatorTrigger4 | unit | No | |
Ruby1 | item | No | |
Ruby2 | item | No | |
Ruby3 | item | No | |
SacrificionHealValue | real | No | |
Sample_Group | group | No | |
Sample_Group_Copy | group | No | |
Sample_Point | location | No | |
Sample_Point_Copy | location | No | |
SancGolem | group | No | |
SancLion | group | No | |
SapphireGroup | group | No | |
SapphiresJewel | item | No | |
SapphireTarget1 | unit | No | |
SapphireTarget2 | unit | No | |
SapphireTarget3 | unit | No | |
SapphireTarget4 | unit | No | |
Sargon | unit | No | |
ScrollCritical | boolean | No | |
ScrollSpellcaster | boolean | No | |
ScrollSpellcasterMana | boolean | No | |
SerpentArea | location | No | |
SerpentEff | effect | No | |
ShakeON | boolean | No | |
ShatterGroup | group | No | |
ShatterPoint | location | No | |
ShatterTarget | unit | No | |
ShockwavePoint | location | No | |
ShoulderRing | effect | No | |
Sinister | unit | No | |
Some_Unit | unit | No | |
SoulboltHealText | texttag | No | |
SoulboltPowerup | boolean | No | |
SoulboltStatistics | real | No | |
SOULBOLTTARGET | unit | No | |
Soulgroup | group | No | |
SOULgroup1 | group | No | |
SOULpoint | location | No | |
Soultarget | unit | No | |
SpellOrb1 | unit | No | |
SpellOrb2 | unit | No | |
SpellOrb3 | unit | No | |
SpellOrb4 | unit | No | |
SpheroidicCounter | real | No | |
SummonedElemental1 | unit | No | |
SummonedElemental2 | unit | No | |
Syon1 | unit | No | |
Syon2 | unit | No | |
Syon3 | unit | No | |
Tele | effect | No | |
TeleProg | unit | No | |
TeleProg2 | unit | No | |
tempGroup | group | No | |
TempInteger | integer | No | |
tempItem | item | No | |
TempLoc | location | No | |
tempLoc1 | location | No | |
TempLoc2 | location | No | |
tempPlayer | player | No | |
tempPlayerId | integer | No | |
TerrainTarget1 | unit | No | |
TerrainTarget2 | unit | No | |
TerrainTarget3 | unit | No | |
TerrainTarget4 | unit | No | |
TerrainTarget5 | unit | No | |
TerrainTarget6 | unit | No | |
Text_Duration | real | No | |
TextSize_dmg | real | No | |
TextSize_spells | real | No | |
TharokPhase1 | boolean | No | |
TharokPhase2 | boolean | No | |
TharokPhase3 | boolean | No | |
TharokPhase4 | boolean | No | |
TharokStrikeGroup | group | No | |
TharokStrikeTarget1 | unit | No | |
TharokStrikeTarget2 | unit | No | |
TharokStrikeTarget3 | unit | No | |
TharokWaveChange | boolean | No | |
TharokWaveGroup | group | No | |
Timer | timer | No | |
TimerCube | timer | No | |
TimerCubeWindow | timerdialog | No | |
TimeRecord | timer | No | |
TimeRecordReal | real | No | |
TimerFarsight | timer | No | |
TimerFarsightWindow | timerdialog | No | |
TimerGlyph | timer | No | |
TimerGornu | timer | No | |
TimerOrb | timer | No | |
TimerPortal | timer | No | |
TimerPortalWindow | timerdialog | No | |
TrapCounter | real | No | |
TrapEff1 | effect | No | |
TrapEff2 | effect | No | |
TrapTrigger1 | unit | No | |
TrapTrigger2 | unit | No | |
TrapTrigger3 | unit | No | |
TrapTrigger4 | unit | No | |
TrapTrigger5 | unit | No | |
TrapTrigger6 | unit | No | |
TrapTrigger7 | unit | No | |
TrapTrigger8 | unit | No | |
TrapTrigger9 | unit | No | |
TriniusPoint | location | No | |
UraOrb | unit | No | |
UraSpot | location | No | |
UraSwarm | unit | No | |
UraSwarmPoint | location | No | |
UrsSwarmPosition | location | No | |
ValnGroup | group | No | |
ValnGroupConst | group | No | |
ValnPart1 | item | No | |
ValnPart2 | item | No | |
ValnPart3 | item | No | |
ValnTarget1 | unit | No | |
ValnTarget10 | unit | No | |
ValnTarget2 | unit | No | |
ValnTarget3 | unit | No | |
ValnTarget4 | unit | No | |
ValnTarget5 | unit | No | |
ValnTarget6 | unit | No | |
ValnTarget7 | unit | No | |
ValnTarget8 | unit | No | |
ValnTarget9 | unit | No | |
ValnTargetConst1 | unit | No | |
VitalityPool | integer | No | |
VoidAura | effect | No | |
VoidRegion | rect | No | |
VulruStar | boolean | No | |
WandererDeath | location | No | |
WandererRegion1 | location | No | |
WandererRegion2 | location | No | |
WandererRegion3 | location | No | |
WandererRegion4 | location | No | |
WandererRegion5 | location | No | |
Wanderers | group | No | |
WanderersKilled | string | No | |
WanderersKilledInteger | integer | No | |
WandererSpawn1 | location | No | |
WandererSpawn2 | location | No | |
WandererSpawn3 | location | No | |
WandererSpawn4 | location | No | |
WandererSpawn5 | location | No | |
WandererSpawnPoint1 | location | No | |
WandererSpawnPoint2 | location | No | |
WandererSpawnPoint3 | location | No | |
WandererSpawnPoint4 | location | No | |
WandererSpawnPoint5 | location | No | |
WeakBoltTarget | unit | No | |
WillpowerPool | integer | 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