Name | Type | is_array | initial_value |
Choice | dialog | No | |
Choice_Button | button | Yes | |
Floating_Texts | texttag | Yes | |
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 | |
Temp_Boolean | boolean | Yes | |
Temp_Group | group | No | |
Temp_Group_2 | group | No | |
Temp_Integer | integer | No | |
Temp_Integer_2 | integer | No | |
Temp_Loc | location | No | |
Temp_Loc_2 | location | No | |
Temp_Loc_3 | location | No | |
Temp_Real | real | Yes | |
ToN_AlliedHealPerTree | real | No | |
ToN_AlliedHealPerTree_PerLvl | real | No | |
ToN_AlliedHealSFX | string | No | |
ToN_AlliedHealSFXPosition | string | No | |
ToN_AlliedRadius | real | No | |
ToN_AlliedRadius_PerLvl | real | No | |
ToN_AlliedSFX_Ability | abilcode | No | |
ToN_AlliedTreeDamage | real | No | |
ToN_AlliedTreeDamage_PerLvl | real | No | |
ToN_AlliedTreeLimit | integer | No | |
ToN_AlliedTreeLimit_PerLvl | integer | No | |
ToN_AllyBuildArmorTime_PerLvl | real | No | |
ToN_AllyBuildingArmor_Ability | abilcode | No | |
ToN_AllyBuildingArmorSFX_Scale | real | No | |
ToN_AllyBuildingArmorSFX_Unit | unitcode | No | |
ToN_AllyBuildingArmorTime | real | No | |
ToN_AllyBuildingRadius | real | No | |
ToN_AllyBuildingRadius_PerLvl | real | No | |
ToN_AllyBuildingSFX_Ability | abilcode | No | |
ToN_AllyBuildingTreeDamage | real | No | |
ToN_AllyBuildTreeDamage_PerLvl | real | No | |
ToN_BuildingArmorRootsHappened | boolean | Yes | |
ToN_CaptureHappened | boolean | Yes | |
ToN_CustomSummonedTreeType | destructablecode | Yes | |
ToN_DefaultSummonedTreeTypes | boolean | No | |
ToN_DummyUnit_Main | unitcode | No | |
ToN_DummyUnit_Pulse | unitcode | No | |
ToN_DummyUnit_Scale | unitcode | No | |
ToN_FoeBuildingRadius | real | No | |
ToN_FoeBuildingRadius_PerLvl | real | No | |
ToN_FoeBuildingRoot_Ability | abilcode | No | |
ToN_FoeBuildingRootSFX_Scale | real | No | |
ToN_FoeBuildingRootSFX_Unit | unitcode | No | |
ToN_FoeBuildingRootTime | real | No | |
ToN_FoeBuildingRootTime_PerLvl | real | No | |
ToN_FoeBuildingSFX_Ability | abilcode | No | |
ToN_FoeBuildingTreeDamage | real | No | |
ToN_FoeBuildTreeDamage_PerLvl | real | No | |
ToN_FoeDamage_AttackType | attacktype | No | |
ToN_FoeDamage_DamageType | damagetype | No | |
ToN_FoeDamagePerTree | real | No | |
ToN_FoeDamagePerTree_PerLvl | real | No | |
ToN_FoeDamageSFX | string | No | |
ToN_FoeDamageSFXPosition | string | No | |
ToN_FoeRadius | real | No | |
ToN_FoeRadius_PerLvl | real | No | |
ToN_FoeSFX_Ability | abilcode | No | |
ToN_FoeTreeDamage | real | No | |
ToN_FoeTreeDamage_PerLvl | real | No | |
ToN_FoeTreeLimit | integer | No | |
ToN_FoeTreeLimit_PerLvl | integer | No | |
ToN_GroundCorpseLimit | integer | No | |
ToN_GroundCorpseLimit_PerLvl | integer | No | |
ToN_GroundDelaySFX1Size | real | No | |
ToN_GroundDelaySFX1Size_PerLvl | real | No | |
ToN_GroundDelaySFX2Size | real | No | |
ToN_GroundDelaySFXRotationRate | real | No | |
ToN_GroundDelaySFXSinusMin | real | No | |
ToN_GroundDelaySFXSinusRate | real | No | |
ToN_GroundGrowDelaySFX_Ability | abilcode | No | |
ToN_GroundGrowSoundSFX_Ability | abilcode | No | |
ToN_GroundGrowthDelay | real | No | |
ToN_GroundGrowthDelay_PerLvl | real | No | |
ToN_GroundGrowthDelaySFX_1 | string | No | |
ToN_GroundGrowthDelaySFX_Trans | real | No | |
ToN_GroundGrowthDelaySFX_Unit1 | unitcode | No | |
ToN_GroundGrowthDelaySFX_Unit2 | unitcode | No | |
ToN_GroundGrowthSFX_Unit | unitcode | No | |
ToN_GroundGrowthSFXUnitSizeMax | real | No | |
ToN_GroundGrowthSFXUnitSizeMin | real | No | |
ToN_GroundGrowthTime | real | No | |
ToN_GroundGrowthTime_PerLvl | real | No | |
ToN_GroundHappened | boolean | Yes | |
ToN_GroundRadius | real | No | |
ToN_GroundRadius_PerLvl | real | No | |
ToN_GroundSummonedTreeSize_Max | real | No | |
ToN_GroundSummonedTreeSize_Min | real | No | |
ToN_GroundTreeHeal | real | No | |
ToN_GroundTreeHeal_PerLvl | real | No | |
ToN_GroundTreeLimit | integer | No | |
ToN_GroundTreeLimit_PerLvl | integer | No | |
ToN_GroundTreePerCorpse | integer | No | |
ToN_GroundTreePerCorpse_PerLvl | integer | No | |
ToN_GroundTreePerTree | integer | No | |
ToN_GroundTreePerTree_PerLvl | integer | No | |
ToN_HealDamageHappened | boolean | Yes | |
ToN_MainGroup | group | No | |
ToN_ManaCost | real | No | |
ToN_ManaCost_PerLvl | real | No | |
ToN_MaxCostumTreeTypes | integer | No | |
ToN_MaxTreeTypes | integer | No | |
ToN_NeutralCaptureSFX | string | No | |
ToN_NeutralCaptureSFX_Position | string | No | |
ToN_NeutralHPTreshold | real | No | |
ToN_NeutralHPTreshold_PerLvl | real | No | |
ToN_NeutralRadius | real | No | |
ToN_NeutralRadius_PerLvl | real | No | |
ToN_NeutralSFX_Ability | abilcode | No | |
ToN_NeutralTreeDamage | real | No | |
ToN_NeutralTreeDamage_PerLvl | real | No | |
ToN_NeutralTreeLimit | integer | No | |
ToN_NeutralTreeLimit_PerLvl | integer | No | |
ToN_Pulse_Ability | abilcode | No | |
ToN_PulseDamage | real | No | |
ToN_PulseDamage_AttackType | attacktype | No | |
ToN_PulseDamage_DamageType | damagetype | No | |
ToN_PulseDamage_PerLvl | real | No | |
ToN_PulseDamageSourceIsCaster | boolean | No | |
ToN_PulseDuration | real | No | |
ToN_PulseDuration_PerLvl | real | No | |
ToN_PulseInterval | real | No | |
ToN_PulseInterval_PerLvl | real | No | |
ToN_PulseTreeDamage | real | No | |
ToN_PulseTreeDamage_PerLvl | real | No | |
ToN_PulseTreeSelectionRadius | real | No | |
ToN_SelfHealPerTree | real | No | |
ToN_SelfHealPerTree_PerLvl | real | No | |
ToN_SelfHealSFX | string | No | |
ToN_SelfHealSFXPosition | string | No | |
ToN_SelfRadius | real | No | |
ToN_SelfRadius_PerLvl | real | No | |
ToN_SelfSFX_Ability | abilcode | No | |
ToN_SelfTreeDamage | real | No | |
ToN_SelfTreeDamage_PerLvl | real | No | |
ToN_SelfTreeLimit | integer | No | |
ToN_SelfTreeLimit_PerLvl | integer | No | |
ToN_TargetAlliedEnabled | boolean | No | |
ToN_TargetAllyBuildingEnabled | boolean | No | |
ToN_TargetedTree | destructable | Yes | |
ToN_TargetEnemyBuildingEnabled | boolean | No | |
ToN_TargetEnemyEnabled | boolean | No | |
ToN_TargetGroundEnabled | boolean | No | |
ToN_TargetIsPossible | boolean | Yes | |
ToN_TargetIsTree | boolean | Yes | |
ToN_TargetNeutralEnabled | boolean | No | |
ToN_TargetSelfEnabled | boolean | No | |
ToN_TargetTreeEnabled | boolean | No | |
ToN_TargetTreeType | destructablecode | Yes | |
ToN_TempAbility_A | abilcode | Yes | |
ToN_TempAbility_B | abilcode | Yes | |
ToN_TempBoolean | boolean | Yes | |
ToN_TempInteger_A | integer | Yes | |
ToN_TempInteger_B | integer | Yes | |
ToN_TempInteger_C | integer | Yes | |
ToN_TempInteger_D | integer | Yes | |
ToN_TempInteger_E | integer | No | |
ToN_TempInteger_F | integer | No | |
ToN_TempInteger_G | integer | No | |
ToN_TempInteger_H | integer | No | |
ToN_TempLoc_A | location | Yes | |
ToN_TempLoc_B | location | No | |
ToN_TempLoc_C | location | No | |
ToN_TempLoc_D | location | No | |
ToN_TempLoc_E | location | No | |
ToN_TempReal_A | real | Yes | |
ToN_TempReal_B | real | Yes | |
ToN_TempReal_C | real | Yes | |
ToN_TempReal_D | real | Yes | |
ToN_TempReal_E | real | Yes | |
ToN_TempReal_F | real | Yes | |
ToN_TempReal_G | real | No | |
ToN_TempReal_H | real | No | |
ToN_TempReal_I | real | No | |
ToN_TempSFX | effect | Yes | |
ToN_TempString_A | string | Yes | |
ToN_TempString_B | string | Yes | |
ToN_TempUnit_A | unit | Yes | |
ToN_TempUnit_B | unit | Yes | |
ToN_TempUnit_C | unit | Yes | |
ToN_TempUnit_D | unit | No | |
ToN_TempUnitGroup | group | No | |
ToN_TouchOfNature_Ability | abilcode | No | |
ToN_TreeLimitIsReached | boolean | Yes | |
ToN_TreePulseHappened | boolean | Yes | |
ToN_WaitingGroup | group | No | |
UDex | integer | No | |
UDexGen | integer | No | |
UDexNext | integer | Yes | |
UDexPrev | integer | Yes | |
UDexRecycle | integer | No | |
UDexUnits | unit | Yes | |
UDexWasted | integer | No | |
UnitIndexerEnabled | boolean | No | |
UnitIndexEvent | real | No |
//TESH.scrollpos=15
//TESH.alwaysfold=0
//
//
//---Credits:
//
// "Bribe" for "Unit Indexer" trigger
// "Weep" for "GUI Friendly Damage Detection"
//
//---Spell Author:
//
// "Loner-Magixxar"
//
//---Spell Name:
//
// Touch of Nature (ToN) - Entry for "The Hive Workshop Zephyr Contest #15" -
// https://www.hiveworkshop.com/threads/zephyr-contest-15-model-based.292294/
//
//---Spell Theme:
//
// Model Based
//
//---Caster Model:
//
// Dark Ancient - Created by "Direfury" -
// https://www.hiveworkshop.com/threads/dark-ancient.286343/
//
//---Caster Race:
//
// Heavy Nature
//
//---Spell Race:
//
// Nature/Ancient/Elves
//
//---Spell Type:
//
// Diversity (Depending on the target, it has different effects in the game)
//
//---Spell Target Categories:
//
// 1. Self (Caster)
// 2. Allied/Owned Non-Structure Units
// 3. Allied/Owned Structures
// 4. Enemy Non-Structure Units
// 5. Enemy/Neutral Structures
// 6. Neutral Passive Non-Structure Units
// 7. Trees
// 8. Ground (No Target)[Dead Trees, Corpses, and Trees]
// (I excluded mechanical non-structure units from the targets)
//
//---Spell Functions for Each Category:
//
//=========1. Self (Caster)
//
// -Concept: By Gathering forces from the trees around himself, the caster
// heals himself.
//
// -Trigger: Picks evey tree in the area, counts their number, and damages
// them. Then spawns a dummy unit for each tree to cast a spell on
// the caster for the SFX and then removes them. Then increases
// the caster's HP based on the counted number and creates a SFX
// on the caster.
//
//=========2. Allied/Owned Non-Structure Units:
//
// -Concept: By Gathering forces from the trees around the target, the caster
// heals the targeted allied/owned unit.
//
// -Trigger: Picks evey tree in the area, counts their number, and damages
// them. Then spawns a dummy unit for each tree to cast a spell on
// the unit for the SFX and then removes them. Then increases
// the unit's HP based on the counted number and creates a SFX
// on the unit.
//
//=========3. Allied/Owned Structures:
//
// -Concept: By damaging one tree near the target building, wraps the
// building in roots and increases its armor and HP recovery.
//
// -Trigger: Picks one tree in the area and damages it. Then spawns a dummy
// unit to fist cast a spell on the unit for the SFX and then cast
// an armor spell on the building. Then the building is added to a
// group and the time of the armor and the SFX unit are saved along
// with the building. After the timer for the buff runs out, the
// buff is removed and the building gets out of the buff group.
//
//=========4. Enemy Non-Structure Units:
//
// -Concept: By Gathering forces from the trees around the target, the caster
// damages the targeted enemy unit.
//
// -Trigger: Picks evey tree in the area, counts their number, and damages
// them. Then spawns a dummy unit for each tree to cast a spell on
// the unit for the SFX and then removes them. Then inflicts damage
// on the unit based on the counted number and creates a SFX on the
// unit.
//
//=========5. Enemy/Neutral Structures:
//
// -Concept: By damaging one tree near the target building, wraps the
// building in roots and decreases its armor and HP regeneration.
//
// -Trigger: Picks one tree in the area and damages it. Then spawns a dummy
// unit to fist cast a spell on the unit for the SFX and then cast
// a root spell on the building. Then the building is added to a
// group and the time of the armor and the SFX unit are saved along
// with the building. After the timer for the buff runs out, the
// buff is removed and the building gets out of the buff group.
//
//=========6. Neutral Passive Non-Structure Units:
//
// -Concept: By Gathering forces from the trees around the target, the caster
// captures the targeted neutral unit's soul.
//
// -Trigger: Picks evey tree in the area, counts their number. If the number of
// trees is enough to capture the unit, the counted trees will get
// damaged, a dummy unit will be spwned for each tree and cast a dummy
// spell on the target for the SFX and then the owner of the target
// is changed to the caster's.
//
//=========7. Trees:
//
// -Concept: Picks a target tree and releases its energy as damage to the
// sorrounding enemy units.
//
// -Trigger: Picks a tree and spawns a dummy unit on it that will cast
// a spell periodically. The unit will be added to a unit group.
// The tree itself will get damaged by each pulse. Finally the dummy
// unit is removed.
//
//=========7. Ground (No Target)[Dead Trees, Corpses, and Trees]:
//
// -Concept: Fertilizes the selected area around the targeted location, healing
// alive trees, and sprouting new trees from dead ones and corpses.
//
// -Trigger: Picks the area around the targeted location and first spawns some
// SFXs and dummy units as SFXs. Then moves the dummy units. Some
// dummy abilities are cast for SFX and sound. During the period of
// the first phase of the SFXs, the alive trees in the area get healed.
// Then the SFXs get removed and new SFXs appear for the phase 2,
// in which dummy units as sprouting SFX will appear and dead trees and
// coprses get removed. Then these SFX units get bigger by the time and
// when the 2nd phase ends, these SFX dummy units get removed and new
// trees will get spawned in their places.
//TESH.scrollpos=9
//TESH.alwaysfold=0
//
//
//---Step One:
//
// Go to your Map > File > Preferences and tick "Automatically create unknown
// variables while pasting trigger data"
//
//---Step Two:
//
// Copy the following custom buff, units, and abilities from this map to your
// own map:
//
// ===Units:
//
// -ToN_DummyUnit_Armor [Serves as the SFX for structure armor]
// -ToN_DummyUnit_Growth Delay Center [Serves as the central SFX for ground target]
// -ToN_DummyUnit_Growth Delay Margin [Serves as the moving SFXs for ground target]
// -ToN_DummyUnit_Growth Process [Serves as the sprouting SFX of spawned trees]
// -ToN_DummyUnit_Main [Casts all the other abilities]
// -ToN_DummyUnit_Pulse [Casts the pulsing ability for trees]
// -ToN_DummyUnit_Root [Serves as the SFX for roots around the buildings]
// -ToN_DummyUnit_ScaleFinder [Finds the scales of buildings, roughly]
// -Dark Ancient (ToN) [Optional; This is not neccassary for the spell,
// but the spell is made for this unit. If you want
// the model as well, export the only imported file
// in this map and import it to your map, then copy
// this unit to you map. You can also download the
// model file from its sorce in the following link:
// https://www.hiveworkshop.com/threads/dark-ancient.286343/]
//
// ===Abilities:
//
// -ToN_Touch of Nature [Main ability]
// -ToN_Allied Building SFX [SFX]
// -ToN_Allied SFX [SFX]
// -ToN_Foe Building SFX [SFX]
// -ToN_Foe SFX [SFX]
// -ToN_Ground Growth Delay Sound Effect [Sound]
// -ToN_Ground Growth SFX/Sound Effect [SFX and sound]
// -ToN_Neutral SFX [SFX]
// -ToN_Self SFX [SFX]
// -ToN_Tree Pulse [Casts the pulsing ability for trees]
// -ToN_Allied Building Armor [Armor for allied/owned buildings]
// -ToN_Foe Building Root [Roots that damage the enemy/neutral buildings]
// ===Buff:
//
// -ToN_Rooting [Allied/owned buildings Armor buff]
//
//---Step Three:
//
// Copy all the following triggers and paste them in your map:
//
// -ToN Config [Contains configurables]
// -ToN Cast [Casts the Touch of Nature (ToN)]
// -ToN Groupings [Handles the buffs of the ability]
// -ToN_Damage [The damage dealt by the tree pulsing]
// -ToN Debug [Debugs any bugs relating to ToN]
// -Unit Indexer* [It is needed]
// -GDD Variable Creator* [It is needed]
// -GUI Friendly Damage Detection* [It is needed]
//
//---Step Four:
//
// If you want to change or modify anything in the spell, follow the
// accompanying instructions which are provided in the "ToN Config" trigger.
//
//---Step Five:
//
// Enjoy! and credit the author in case you use this spell in your maps.
//TESH.scrollpos=63
//TESH.alwaysfold=0
// 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