Name | Type | is_array | initial_value |
AoD_Ability | abilcode | No | |
AoD_Angle | real | No | |
AoD_Animater | unitcode | No | |
AoD_Arrow | unit | Yes | |
AoD_ArrowType | unitcode | No | |
AoD_BounceChance | integer | Yes | |
AoD_Caster | unit | Yes | |
AoD_Damage | real | Yes | |
AoD_Damage2 | real | Yes | |
AoD_Damage2Enabled | boolean | No | |
AoD_Damage2PerLevel | real | No | |
AoD_DamagePerLevel | real | No | |
AoD_DeathFeature | boolean | No | |
AoD_DesirablePoint | location | No | |
AoD_Effect | string | No | |
AoD_EffectInterval | integer | No | |
AoD_From | location | No | |
AoD_Index | integer | Yes | |
AoD_IndexMaxSize | integer | No | |
AoD_IndexSize | integer | No | |
AoD_KillDestructibles | boolean | No | |
AoD_Loop | integer | No | |
AoD_PercentPerLevel | integer | No | |
AoD_Region | rect | No | |
AoD_SecondaryEffect | string | No | |
AoD_Speed | real | No | |
AoD_Target | unit | Yes | |
AoD_Timing | integer | Yes | |
AoD_To | location | No | |
TempGroup | group | No | |
TempInt | integer | No | |
TempPoint | location | No | |
TempReal | real | No | |
TempUnit | unit | No | |
TempUnit2 | unit | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
library DestructableLib initializer Initialization
//* ============================================================================ *
//* Made by PitzerMike *
//* *
//* I made this to detect if a destructable is a tree or not. It works not only *
//* for the standard trees but also for custom destructables created with the *
//* object editor. It uses a footie as a dummy with the goul's harvest ability. *
//* The dummy ids can be changed though. I also added the IsDestructableDead *
//* function for completeness. *
//* ============================================================================ *
globals
private constant integer DUMMY_UNIT_ID = 'hfoo' // footman
private constant integer HARVEST_ID = 'Ahrl' // ghouls harvest
private constant player OWNING_PLAYER = Player(15)
private unit dummy = null
endglobals
function IsDestructableDead takes destructable dest returns boolean
return GetDestructableLife(dest) <= 0.405
endfunction
function IsDestructableTree takes destructable dest returns boolean
local boolean result = false
if (dest != null) then
call PauseUnit(dummy, false)
set result = IssueTargetOrder(dummy, "harvest", dest)
call PauseUnit(dummy, true) // stops order
endif
return result
endfunction
private function Initialization takes nothing returns nothing
set dummy = CreateUnit(OWNING_PLAYER, DUMMY_UNIT_ID, 0.0, 0.0, 0.0)
call ShowUnit(dummy, false) // cannot enumerate
call UnitAddAbility(dummy, HARVEST_ID)
call UnitAddAbility(dummy, 'Aloc') // unselectable, invulnerable
call PauseUnit(dummy, true)
endfunction
endlibrary