Name | Type | is_array | initial_value |
ActualPosition | location | No | |
AfterDamageEvent | real | No | |
AlphaReal | real | No | |
AOEDamageEvent | real | No | |
AOEDamageSource | unit | No | |
ArenaCount | real | Yes | |
ArenaInteger | integer | Yes | |
ArenaRegion | rect | Yes | |
ARMOR_TYPE_ETHEREAL | integer | No | |
ARMOR_TYPE_FLESH | integer | No | |
ARMOR_TYPE_METAL | integer | No | |
ARMOR_TYPE_NONE | integer | No | |
ARMOR_TYPE_STONE | integer | No | |
ARMOR_TYPE_WOOD | integer | No | |
ArmorTypeDebugStr | string | Yes | |
ATTACK_TYPE_CHAOS | integer | No | |
ATTACK_TYPE_HERO | integer | No | |
ATTACK_TYPE_MAGIC | integer | No | |
ATTACK_TYPE_NORMAL | integer | No | |
ATTACK_TYPE_PIERCE | integer | No | |
ATTACK_TYPE_SIEGE | integer | No | |
ATTACK_TYPE_SPELLS | integer | No | |
AttackTypeDebugStr | string | Yes | |
BaseAbility | abilcode | No | |
BattleMode | boolean | No | |
BattleSpawnRegion1 | rect | Yes | |
BattleSpawnRegion2 | rect | Yes | |
BattleSpawnRegion3 | rect | Yes | |
BattleSpawnRegion4 | rect | Yes | |
BloodEffect1 | effect | Yes | |
BloodEffect2 | effect | Yes | |
BloodEffect3 | effect | Yes | |
BloodTimer | timer | Yes | |
Bonus | boolean | Yes | |
BonusTimer | timer | Yes | |
BoostTimer | timer | Yes | |
BubblesEffect1 | effect | Yes | |
BubblesEffect2 | effect | Yes | |
ButtonEasy | button | No | |
ButtonHard | button | No | |
ButtonNormal | button | No | |
CheckTimer | timer | Yes | |
ChooseArenaTimer | timer | No | |
ChooseArenaTimerWindow | timerdialog | No | |
CONVERTED_ATTACK_TYPE | attacktype | Yes | |
CONVERTED_DAMAGE_TYPE | damagetype | Yes | |
DAMAGE_TYPE_ACID | integer | No | |
DAMAGE_TYPE_COLD | integer | No | |
DAMAGE_TYPE_DEATH | integer | No | |
DAMAGE_TYPE_DEFENSIVE | integer | No | |
DAMAGE_TYPE_DEMOLITION | integer | No | |
DAMAGE_TYPE_DISEASE | integer | No | |
DAMAGE_TYPE_DIVINE | integer | No | |
DAMAGE_TYPE_ENHANCED | integer | No | |
DAMAGE_TYPE_FIRE | integer | No | |
DAMAGE_TYPE_FORCE | integer | No | |
DAMAGE_TYPE_LIGHTNING | integer | No | |
DAMAGE_TYPE_MAGIC | integer | No | |
DAMAGE_TYPE_MIND | integer | No | |
DAMAGE_TYPE_NORMAL | integer | No | |
DAMAGE_TYPE_PLANT | integer | No | |
DAMAGE_TYPE_POISON | integer | No | |
DAMAGE_TYPE_SHADOW_STRIKE | integer | No | |
DAMAGE_TYPE_SLOW_POISON | integer | No | |
DAMAGE_TYPE_SONIC | integer | No | |
DAMAGE_TYPE_SPIRIT_LINK | integer | No | |
DAMAGE_TYPE_UNIVERSAL | integer | No | |
DAMAGE_TYPE_UNKNOWN | integer | No | |
DamageCounterText | texttag | Yes | |
DamageEvent | real | No | |
DamageEventAmount | real | No | |
DamageEventAOE | integer | No | |
DamageEventAOEGroup | group | No | |
DamageEventArmorPierced | real | No | |
DamageEventArmorT | integer | No | |
DamageEventAttackT | integer | No | |
DamageEventDamageT | integer | No | |
DamageEventDefenseT | integer | No | |
DamageEventLevel | integer | No | |
DamageEventOverride | boolean | No | |
DamageEventPrevAmt | real | No | |
DamageEventSource | unit | No | |
DamageEventTarget | unit | No | |
DamageEventTrigger | trigger | No | |
DamageEventType | integer | No | |
DamageEventWeaponT | integer | No | |
DamageInteger | integer | Yes | |
DamageModifierEvent | real | No | |
DamageScalingUser | real | No | |
DamageScalingWC3 | real | No | |
DamageTypeBlocked | integer | No | |
DamageTypeCode | integer | No | |
DamageTypeCriticalStrike | integer | No | |
DamageTypeDebugStr | string | Yes | |
DamageTypeExplosive | integer | No | |
DamageTypeHeal | integer | No | |
DamageTypePure | integer | No | |
DamageTypePureExplosive | integer | No | |
DamageTypeReduced | integer | No | |
Dashing | boolean | Yes | |
Dashtimer | timer | Yes | |
DashtimerWindow | timerdialog | Yes | |
DD_LoopInt | integer | No | |
DD_PlayerVoted | integer | Yes | |
DD_Random_Arena | integer | Yes | |
DD_Random_Arena_Count | integer | No | |
DD_RandomArenaNumber | integer | No | |
DD_Teleport_Arena_Triggers | trigger | Yes | |
DD_VictoryGroup | group | No | |
DD_VoteInt | integer | Yes | |
DD_VoteString | string | Yes | |
DDExit | real | No | |
DDIsOpen | boolean | Yes | |
DDVote1 | real | No | |
DDVote2 | real | No | |
DDVote3 | real | No | |
DDVote4 | real | No | |
DDVoteExit | real | No | |
DeadGroup | group | No | |
DEFENSE_TYPE_DIVINE | integer | No | |
DEFENSE_TYPE_FORTIFIED | integer | No | |
DEFENSE_TYPE_HEAVY | integer | No | |
DEFENSE_TYPE_HERO | integer | No | |
DEFENSE_TYPE_LIGHT | integer | No | |
DEFENSE_TYPE_MEDIUM | integer | No | |
DEFENSE_TYPE_NORMAL | integer | No | |
DEFENSE_TYPE_UNARMORED | integer | No | |
DefenseTypeDebugStr | string | Yes | |
Difficulty | integer | No | |
DifficultyDialog | dialog | No | |
DolphinDead | boolean | Yes | |
DownDown | boolean | Yes | |
EnhancedDamageTarget | unit | No | |
FilterPath | string | Yes | |
FilterString | string | No | |
FishEatenInteger | integer | Yes | |
FishGroup | group | No | |
GameStarted | boolean | No | |
GameWin | unit | No | |
Height | real | No | |
Hero | unit | No | |
HSGroup | group | No | |
InvisLoc | location | No | |
InvisTimer | timer | Yes | |
InvisUnit | unit | No | |
InvulnerableAbility | abilcode | No | |
InvulnerableBuff | buffcode | No | |
InvulnerableGroup | group | No | |
IsDamageCode | boolean | No | |
IsDamageMelee | boolean | No | |
IsDamageRanged | boolean | No | |
IsDamageSpell | boolean | No | |
KillSoundPoint | location | No | |
LastDolphin | boolean | No | |
LastDolphinStanding | boolean | No | |
LeftDown | boolean | Yes | |
LethalDamageEvent | real | No | |
LethalDamageHP | real | No | |
ModeDialog | dialog | No | |
ModeDialogButtonBattle | button | No | |
ModeDialogButtonLastMan | button | No | |
ModeDialogButtonScore | button | No | |
ModeDialogButtonTimed | button | No | |
ModeTimer | timer | Yes | |
ModeTimerWindow | timerdialog | No | |
MoreSharksGroup | group | No | |
MovePosition | location | No | |
MSort_Ascending | boolean | No | |
MSort_EndIndex | integer | No | |
MSort_IndexInitial | integer | Yes | |
MSort_Indices | integer | Yes | |
MSort_Left | real | Yes | |
MSort_Right | real | Yes | |
MSort_StartIndex | integer | No | |
MSort_Values | real | Yes | |
NameText | texttag | Yes | |
NextDamageType | integer | No | |
NextMoveTime | real | No | |
OffsetLoc | location | No | |
OrderedDistance | integer | No | |
OrderedUnit | unit | Yes | |
PlayerCount | integer | No | |
PlayerForce | force | No | |
Playlist | string | No | |
PointDegrees | integer | Yes | |
RainSound | sound | No | |
RandomArena | real | No | |
RandomPlayer | player | No | |
RandomPoint | location | No | |
RandomUnit | unit | No | |
Reverse | boolean | Yes | |
RightDown | boolean | Yes | |
RoundsDialog | dialog | No | |
RoundsDialogButton | button | Yes | |
RoundsLeft | integer | No | |
RoundsWon | integer | Yes | |
RoundsWon_Copy | integer | Yes | |
ScoreBoard | multiboard | No | |
Scoreboard | leaderboard | No | |
SharkAmount | real | No | |
SharkGroup | group | No | |
Shield | boolean | Yes | |
ShieldEffect | effect | Yes | |
SoloPlayDied | boolean | No | |
SonarCooldown | boolean | Yes | |
SonarCooldownTimer | timer | Yes | |
SonarCooldownTimerWindow | timerdialog | Yes | |
SonarPoint | location | Yes | |
SonarProjectile | unit | Yes | |
SonarTarget | unit | Yes | |
SpawnRegion | rect | Yes | |
SpawnSharkTimerLastDolphin | timer | No | |
SpawnTimer | timer | No | |
SpawnTimerWindow | timerdialog | No | |
SpectateAmount | integer | No | |
SpectateGroup | group | Yes | |
SpeedEffect | effect | Yes | |
StatsString | string | Yes | |
StatsStringInteger | integer | Yes | |
SuddenDeathArena | rect | No | |
SuddenDeathBoolean | boolean | No | |
TempForce | force | No | |
TempGroup | group | No | |
TempIndex | integer | No | 0 |
TempLoc | location | No | |
TempUnit | unit | No | |
TempUnitArray | unit | Yes | |
TimeAttack | boolean | No | |
u | unit | No | |
u2 | unit | No | |
u3 | unit | No | |
u4 | unit | No | |
u5 | unit | No | |
u6 | unit | No | |
UpDown | boolean | Yes | |
VelmaCount | real | No | |
VictoryTimer | timer | No | |
VictoryTimerWindow | timerdialog | No | |
VictoryUnit | unit | No | |
VictoryUnitAmount | integer | No | |
VictoryUnitGroup | group | No | |
Visibility | fogmodifier | Yes | |
WEAPON_TYPE_AM_CHOP | integer | No | |
WEAPON_TYPE_CH_SLICE | integer | No | |
WEAPON_TYPE_CL_SLICE | integer | No | |
WEAPON_TYPE_CM_SLICE | integer | No | |
WEAPON_TYPE_MH_BASH | integer | No | |
WEAPON_TYPE_MH_CHOP | integer | No | |
WEAPON_TYPE_MH_SLICE | integer | No | |
WEAPON_TYPE_MH_STAB | integer | No | |
WEAPON_TYPE_ML_CHOP | integer | No | |
WEAPON_TYPE_ML_SLICE | integer | No | |
WEAPON_TYPE_MM_BASH | integer | No | |
WEAPON_TYPE_MM_CHOP | integer | No | |
WEAPON_TYPE_MM_SLICE | integer | No | |
WEAPON_TYPE_MM_STAB | integer | No | |
WEAPON_TYPE_NONE | integer | No | |
WEAPON_TYPE_RH_BASH | integer | No | |
WEAPON_TYPE_WH_BASH | integer | No | |
WEAPON_TYPE_WH_SLICE | integer | No | |
WEAPON_TYPE_WL_BASH | integer | No | |
WEAPON_TYPE_WL_SLICE | integer | No | |
WEAPON_TYPE_WL_STAB | integer | No | |
WEAPON_TYPE_WM_BASH | integer | No | |
WEAPON_TYPE_WM_SLICE | integer | No | |
WEAPON_TYPE_WM_STAB | integer | No | |
WeaponTypeDebugStr | string | Yes | |
X_Loc | location | No | |
X_Real | real | No | |
Y_Loc | location | No | |
Y_Real | real | No |
//TESH.scrollpos=89
//TESH.alwaysfold=0
// Merge Sort [GUI Friendly] v1.01
// by Flux
// http://www.hiveworkshop.com/forums/members/flux/
//
// Merge Sort is an efficient sorting algorithm
// that has a worst case performance of O(n logn)
// This system allows you to sort values of an array
// in either ascending or descending order
// Additionally, it this system allows you to get the
// sorted indices of the array values.
//
// Purely written in JASS and doesn't require anything
function MSort_Display takes nothing returns nothing
local integer i = udg_MSort_StartIndex
call BJDebugMsg("========== |cffffcc00[Merge Sort]:|r Data ===============")
loop
exitwhen i > udg_MSort_EndIndex
call BJDebugMsg("MSort_Values[" + I2S(i) + "] = " + R2S(udg_MSort_Values[i]) + ", MSort_Indices[" + I2S(i) + "] = " + I2S(udg_MSort_Indices[i]))
set i = i + 1
endloop
call BJDebugMsg("============== End Display =================\n")
endfunction
function MSort_Merge takes integer leftStart, integer leftEnd, integer rightStart, integer rightEnd returns nothing
local integer i = leftStart
local integer j = rightStart
local integer k = i
loop
exitwhen i > leftEnd or j > rightEnd
if udg_MSort_Ascending then
if udg_MSort_Left[i] < udg_MSort_Right[j] then
set udg_MSort_Values[k] = udg_MSort_Left[i]
set udg_MSort_Indices[k] = udg_MSort_IndexInitial[i]
set k = k + 1
set i = i + 1
else
set udg_MSort_Values[k] = udg_MSort_Right[j]
set udg_MSort_Indices[k] = udg_MSort_IndexInitial[j]
set k = k + 1
set j = j + 1
endif
else
if udg_MSort_Left[i] > udg_MSort_Right[j] then
set udg_MSort_Values[k] = udg_MSort_Left[i]
set udg_MSort_Indices[k] = udg_MSort_IndexInitial[i]
set k = k + 1
set i = i + 1
else
set udg_MSort_Values[k] = udg_MSort_Right[j]
set udg_MSort_Indices[k] = udg_MSort_IndexInitial[j]
set k = k + 1
set j = j + 1
endif
endif
endloop
//Fill up remaining
loop
exitwhen i > leftEnd
set udg_MSort_Values[k] = udg_MSort_Left[i]
set udg_MSort_Indices[k] = udg_MSort_IndexInitial[i]
set k = k + 1
set i = i + 1
endloop
loop
exitwhen j > rightEnd
set udg_MSort_Values[k] = udg_MSort_Right[j]
set udg_MSort_Indices[k] = udg_MSort_IndexInitial[j]
set k = k + 1
set j = j + 1
endloop
//Update IndexInitial
set i = leftStart
loop
exitwhen i == k
set udg_MSort_IndexInitial[i] = udg_MSort_Indices[i]
set i = i + 1
endloop
endfunction
//Recursive Function
function MSort_Merge_Sort takes integer start, integer end returns nothing
local integer i = start
local integer mid
if end - start >= 1 then
set mid = (end + start)/2
call MSort_Merge_Sort(start, mid)
call MSort_Merge_Sort(mid+1, end)
loop
exitwhen i > mid
set udg_MSort_Left[i] = udg_MSort_Values[i]
set i = i + 1
endloop
loop
exitwhen i > end
set udg_MSort_Right[i] = udg_MSort_Values[i]
set i = i + 1
endloop
call MSort_Merge(start, mid, mid+1, end)
//call MSort_Display()
// ^uncomment to display values
endif
endfunction
function Trig_Merge_Sort_Main takes nothing returns boolean
call MSort_Merge_Sort(udg_MSort_StartIndex, udg_MSort_EndIndex)
return false
endfunction
//===========================================================================
function InitTrig_Merge_Sort takes nothing returns nothing
set gg_trg_Merge_Sort = CreateTrigger()
call TriggerAddCondition(gg_trg_Merge_Sort, Condition(function Trig_Merge_Sort_Main))
endfunction
//TESH.scrollpos=28
//TESH.alwaysfold=0
//
// MERGE SORT READ ME
//
// ***********************************************
// ************** HOW TO IMPORT ******************
// ***********************************************
//
// 1. Copy the Merge Sort Variable Creator in your map.
// Make sure you set the "Automatically create unknown variables
// while pasting trigger data" in Files -> Preferences.
// After copying, delete Merge Sort Variable Creator
// 2. Copy the 'Merge Sort' trigger to your map.
//
//
//
// **********************************************
// *************** HOW TO USE *******************
// **********************************************
//
// 1. Store the values you want to sort to MSort_Values
// and initialize MSort_IndexInitial[n] = n
// Example:
// MSort_Values[0] = 3
// MSort_IndexInitial[0] = 0
// MSort_Values[1] = 9
// MSort_IndexInitial[1] = 1
// MSort_Values[2] = 4
// MSort_IndexInitial[2] = 2
// MSort_Values[3] = 5
// MSort_IndexInitial[3] = 3
// MSort_Values[4] = 2
// MSort_IndexInitial[4] = 4
//
// 2. Set MSort_Ascending, MSort_StartIndex, MSort_EndIndex
// Example:
// MSort_Ascending = true
// MSort_StartIndex = 0
// MSort_EndIndex = 4
//
// 3. Run Merge Sort <gen> (checking Conditions)
//
// 4. The Array new values are now:
//
// MSort_Values[0] = 2
// MSort_Values[1] = 3
// MSort_Values[2] = 4
// MSort_Values[3] = 5
// MSort_Values[4] = 9
//
// MSort_Indices[0] = 4 ; from MSort_Values[4] = 2
// MSort_Indices[1] = 0 ; from MSort_Values[0] = 3
// MSort_Indices[2] = 2 ; from MSort_Values[2] = 4
// MSort_Indices[3] = 3 ; from MSort_Values[3] = 5
// MSort_Indices[4] = 1 ; from MSort_Values[1] = 9
//
//===========================================================================
//
// Damage Engine 5.4.2.3 - update requires copying of the JASS script
//
//===========================================================================
library DamageEngine initializer Init
globals
private timer alarm = CreateTimer()
private boolean alarmSet = false
//Values to track the original pre-spirit Link/defensive damage values
private boolean canKick = true
private boolean totem = false
private real lastAmount = 0.00
private real lastPrevAmt = 0.00
private integer lastType = 0
private boolean lastCode = false
private real lastPierced = 0.00
private integer armorType = 0
private integer lastArmor = 0
private integer lastPrevArmor = 0
private integer defenseType = 0
private integer lastDefense = 0
private integer lastPrevDefense = 0
//Stuff to track recursive UnitDamageTarget calls.
private boolean eventsRun = false
private boolean kicking = false
private integer damageStack = 0
private unit array sourceStack
private unit array targetStack
private real array amountStack
private attacktype array attackTStack
private damagetype array damageTStack
private weapontype array weaponTStack
private integer array userTrigStack
private integer array typeStack
//Added in 5.4 to silently eliminate infinite recursion.
private integer userTrigs = 9
private integer eventTrig = 0
private integer array nextTrig
private trigger array userTrig
private boolean array trigFrozen
//Added/re-tooled in 5.4.1 to allow forced recursion (for advanced users only).
private constant integer LIMBO = 16 //Recursion will never go deeper than LIMBO.
private integer array levelsDeep //How deep the user recursion currently is.
public boolean inception = false //You must set DamageEngine_inception = true before dealing damage to utlize this.
//When true, it allows your trigger to potentially go recursive up to LIMBO.
private boolean dreaming = false
private boolean array inceptionTrig //Added in 5.4.2 to simplify the inception variable for very complex DamageEvent trigger.
private integer sleepLevel = 0
private group proclusGlobal = CreateGroup() //track sources of recursion
private group fischerMorrow = CreateGroup() //track targets of recursion
//Improves readability in the code to have these as named constants.
private constant integer MOD_EVENT = 1
private constant integer SHIELD_EVENT = 4
private constant integer DAMAGE_EVENT = 5
private constant integer ZERO_EVENT = 6
private constant integer AFTER_EVENT = 7
private constant integer LETHAL_EVENT = 8
private constant integer AOE_EVENT = 9
//private string crashStr = ""
endglobals
//GUI Vars:
/*
Retained from 3.8 and prior:
----------------------------
unit udg_DamageEventSource
unit udg_DamageEventTarget
unit udg_EnhancedDamageTarget
group udg_DamageEventAOEGroup
integer udg_DamageEventAOE
integer udg_DamageEventLevel
real udg_DamageModifierEvent
real udg_DamageEvent
real udg_AfterDamageEvent
real udg_DamageEventAmount
real udg_DamageEventPrevAmt
real udg_AOEDamageEvent
boolean udg_DamageEventOverride
boolean udg_NextDamageType
boolean udg_DamageEventType
boolean udg_IsDamageSpell
//Added in 5.0:
boolean udg_IsDamageMelee
boolean udg_IsDamageRanged
unit udg_AOEDamageSource
real udg_LethalDamageEvent
real udg_LethalDamageHP
real udg_DamageScalingWC3
integer udg_DamageEventAttackT
integer udg_DamageEventDamageT
integer udg_DamageEventWeaponT
//Added in 5.1:
boolean udg_IsDamageCode
//Added in 5.2:
integer udg_DamageEventArmorT
integer udg_DamageEventDefenseT
//Addded in 5.3:
real DamageEventArmorPierced
real udg_DamageScalingUser
//Added in 5.4.2 to allow GUI users to re-issue the exact same attack and damage type at the attacker.
attacktype array udg_CONVERTED_ATTACK_TYPE
damagetype array udg_CONVERTED_DAMAGE_TYPE
*/
private function RunTrigs takes integer i returns nothing
local integer cat = i
if dreaming then
//call BJDebugMsg("Tried to run triggers while triggers were already running.")
return
endif
set dreaming = true
//call BJDebugMsg("Start of event running")
loop
set i = nextTrig[i]
exitwhen i == 0
exitwhen cat == MOD_EVENT and (udg_DamageEventOverride or udg_DamageEventType*udg_DamageEventType == 4)
exitwhen cat == SHIELD_EVENT and udg_DamageEventAmount <= 0.00
exitwhen cat == LETHAL_EVENT and udg_LethalDamageHP > 0.405
//set crashStr = "Bout to inspect " + I2S(i)
if not trigFrozen[i] and IsTriggerEnabled(userTrig[i]) then
set eventTrig = i
//set crashStr = "Bout to evaluate " + I2S(i)
if TriggerEvaluate(userTrig[i]) then
//set crashStr = "Bout to execute " + I2S(i)
call TriggerExecute(userTrig[i])
endif
//set crashStr = "Ran " + I2S(i)
//call BJDebugMsg("Ran " + I2S(i))
//if not (udg_DamageEventPrevAmt == 0.00 or udg_DamageScalingWC3 == 0.00 or udg_DamageEventAmount == 0.00) then
// if cat == MOD_EVENT then
// set udg_DamageScalingUser = udg_DamageEventAmount/udg_DamageEventPrevAmt
// elseif cat == SHIELD_EVENT then
// set udg_DamageScalingUser = udg_DamageEventAmount/udg_DamageEventPrevAmt/udg_DamageScalingWC3
// endif
//elseif udg_DamageEventPrevAmt == 0.00 then
// call BJDebugMsg("Prev amount 0.00 and User Amount " + R2S(udg_DamageEventAmount))
//elseif udg_DamageEventAmount == 0.00 then
// call BJDebugMsg("User amount 0.00 and Prev Amount " + R2S(udg_DamageEventPrevAmt))
//elseif udg_DamageScalingWC3 == 0.00 then
// call BJDebugMsg("WC3 amount somehow 0.00")
//endif
//set crashStr = "Filtered " + I2S(i)
//elseif i > 9 then
// if trigFrozen[i] then
// call BJDebugMsg("User Trigger is frozen")
// else
// call BJDebugMsg("User Trigger is off")
// endif
endif
endloop
//call BJDebugMsg("End of event running")
set dreaming = false
endfunction
private function OnAOEEnd takes nothing returns nothing
if udg_DamageEventAOE > 1 then
call RunTrigs(AOE_EVENT)
set udg_DamageEventAOE = 1
endif
set udg_DamageEventLevel = 1
set udg_EnhancedDamageTarget = null
set udg_AOEDamageSource = null
call GroupClear(udg_DamageEventAOEGroup)
endfunction
private function AfterDamage takes nothing returns nothing
if udg_DamageEventPrevAmt != 0.00 and udg_DamageEventDamageT != udg_DAMAGE_TYPE_UNKNOWN then
call RunTrigs(AFTER_EVENT)
endif
endfunction
private function Finish takes nothing returns nothing
local integer i = 0
local integer exit
if eventsRun then
//call BJDebugMsg("events ran")
set eventsRun = false
call AfterDamage()
endif
if canKick and not kicking then
//call BJDebugMsg("can kick")
if damageStack > 0 then
set kicking = true
//call BJDebugMsg("Clearing queued damage instances: " + I2S(damageStack))
loop
set exit = damageStack
set sleepLevel = sleepLevel + 1
loop
set udg_NextDamageType = typeStack[i]
//call BJDebugMsg("Stacking on " + R2S(amountStack[i]))
call UnitDamageTarget(sourceStack[i], targetStack[i], amountStack[i], true, false, attackTStack[i], damageTStack[i], weaponTStack[i])
call AfterDamage()
set i = i + 1 //Need to loop bottom to top to make sure damage order is preserved.
exitwhen i == exit
endloop
//call BJDebugMsg("Exit at: " + I2S(i))
exitwhen i == damageStack
endloop
//call BJDebugMsg("Terminate at at: " + I2S(i))
set sleepLevel = 0
loop
set i = i - 1
set trigFrozen[userTrigStack[i]] = false //Only re-enable recursive triggers AFTER all damage is dealt.
set levelsDeep[userTrigStack[i]] = 0 //Reset this stuff if the user tried some nonsense
exitwhen i == 0
endloop
//call BJDebugMsg("Cleared queued damage instances: " + I2S(damageStack))
set damageStack = 0 //Can only be set after all the damage has successfully ended.
set kicking = false
endif
call GroupClear(proclusGlobal)
call GroupClear(fischerMorrow)
//elseif kicking then
// call BJDebugMsg("Somehow still kicking")
//else
// call BJDebugMsg("Cannot kick")
endif
endfunction
private function ResetArmor takes nothing returns nothing
if udg_DamageEventArmorPierced != 0.00 then
call BlzSetUnitArmor(udg_DamageEventTarget, BlzGetUnitArmor(udg_DamageEventTarget) + udg_DamageEventArmorPierced)
endif
if armorType != udg_DamageEventArmorT then
call BlzSetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_ARMOR_TYPE, armorType) //revert changes made to the damage instance
endif
if defenseType != udg_DamageEventDefenseT then
call BlzSetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_DEFENSE_TYPE, defenseType)
endif
endfunction
private function FailsafeClear takes nothing returns nothing
//call BJDebugMsg("Damage from " + GetUnitName(udg_DamageEventSource) + " to " + GetUnitName(udg_DamageEventTarget) + " has been messing up Damage Engine.")
//call BJDebugMsg(R2S(udg_DamageEventAmount) + " " + " " + R2S(udg_DamageEventPrevAmt) + " " + udg_AttackTypeDebugStr[udg_DamageEventAttackT] + " " + udg_DamageTypeDebugStr[udg_DamageEventDamageT])
call ResetArmor()
set canKick = true
set totem = false
set udg_DamageEventAmount = 0.00
set udg_DamageScalingWC3 = 0.00
if udg_DamageEventDamageT != udg_DAMAGE_TYPE_UNKNOWN then
call RunTrigs(DAMAGE_EVENT) //Run the normal on-damage event based on this failure.
set eventsRun = true //Run the normal after-damage event based on this failure.
endif
call Finish()
endfunction
private function WakeUp takes nothing returns nothing
set alarmSet = false //The timer has expired. Flag off to allow it to be restarted when needed.
//if dreaming then
// set dreaming= false
// call BJDebugMsg("Timer set dreaming to False")
// call BJDebugMsg(crashStr)
//endif
if totem then
//Something went wrong somewhere; the WarCraft 3 engine didn't run the DAMAGED event despite running the DAMAGING event.
call FailsafeClear()
else
if not canKick and damageStack > 0 then
//call BJDebugMsg("Damage Engine recursion deployment was failing with application of: " + R2S(udg_DamageEventAmount))
set canKick = true
endif
call Finish() //Wrap up any outstanding damage instance
endif
call OnAOEEnd() //Reset things so they don't perpetuate for AoE/Level target detection
set udg_DamageEventPrevAmt = 0.00 //Added in 5.4.2.1 to try to squash the Cold Arrows glitch (failed to do it)
endfunction
private function CalibrateMR takes nothing returns nothing
set udg_IsDamageMelee = false
set udg_IsDamageRanged = false
set udg_IsDamageSpell = udg_DamageEventAttackT == 0 //In Patch 1.31, one can just check the attack type to find out if it's a spell.
if udg_DamageEventDamageT == udg_DAMAGE_TYPE_NORMAL and not udg_IsDamageSpell then //This damage type is the only one that can get reduced by armor.
set udg_IsDamageMelee = IsUnitType(udg_DamageEventSource, UNIT_TYPE_MELEE_ATTACKER)
set udg_IsDamageRanged = IsUnitType(udg_DamageEventSource, UNIT_TYPE_RANGED_ATTACKER)
if udg_IsDamageMelee and udg_IsDamageRanged then
set udg_IsDamageMelee = udg_DamageEventWeaponT > 0// Melee units play a sound when damaging
set udg_IsDamageRanged = not udg_IsDamageMelee // In the case where a unit is both ranged and melee, the ranged attack plays no sound.
endif // The Huntress has a melee sound for her ranged projectile, however it is only an issue
endif //if she also had a melee attack, because by default she is only UNIT_TYPE_RANGED_ATTACKER.
endfunction
private function OnPreDamage takes nothing returns boolean
local unit src = GetEventDamageSource()
local unit tgt = GetTriggerUnit()
local real amt = GetEventDamage()
local attacktype at = BlzGetEventAttackType()
local damagetype dt = BlzGetEventDamageType()
local weapontype wt = BlzGetEventWeaponType()
//call BJDebugMsg("First damage event running")
if dreaming then
//call BJDebugMsg("Dreaming")
if amt != 0.00 then
//Store recursive damage into a queue from index "damageStack" (0-15)
//This damage will be fired after the current damage instance has wrapped up its events.
//This damage can only be caused by triggers.
set amountStack[damageStack] = amt
set sourceStack[damageStack] = src
set targetStack[damageStack] = tgt
set attackTStack[damageStack] = at
set damageTStack[damageStack] = dt
set weaponTStack[damageStack] = wt
set userTrigStack[damageStack] = eventTrig
if udg_NextDamageType == 0 then
set typeStack[damageStack] = udg_DamageTypeCode
else
set typeStack[damageStack] = udg_NextDamageType
endif
//Next block added in 5.4.1 to allow *some* control over whether recursion should kick
//in. Also it's important to track whether the source and target were both involved at
//some earlier point, so this is a more accurate and lenient method than before.
set inception = inception or inceptionTrig[eventTrig]
call GroupAddUnit(proclusGlobal, udg_DamageEventSource)
call GroupAddUnit(fischerMorrow, udg_DamageEventTarget)
if kicking and IsUnitInGroup(src, proclusGlobal) and IsUnitInGroup(tgt, fischerMorrow) then
if inception and not trigFrozen[eventTrig] then
set inceptionTrig[eventTrig] = true
if levelsDeep[eventTrig] < sleepLevel then
set levelsDeep[eventTrig] = levelsDeep[eventTrig] + 1
if levelsDeep[eventTrig] >= LIMBO then
set trigFrozen[eventTrig] = true
endif
endif
else
set trigFrozen[eventTrig] = true
endif
endif
set damageStack = damageStack + 1
//call BJDebugMsg("damageStack: " + I2S(damageStack) + " levelsDeep: " + I2S(levelsDeep[eventTrig]) + " sleepLevel: " + I2S(sleepLevel))
call BlzSetEventDamage(0.00) //queue the damage instance instead of letting it run recursively
endif
else
if not kicking then
//Added 25 July 2017 to detect AOE damage or multiple single-target damage
if alarmSet then
if totem then
if dt != DAMAGE_TYPE_SPIRIT_LINK and dt != DAMAGE_TYPE_DEFENSIVE and dt != DAMAGE_TYPE_PLANT then
//if 'totem' is still set and it's not due to spirit link distribution or defense retaliation,
//the next function must be called as a debug. This reverts an issue I created in patch 5.1.3.
call FailsafeClear()
else
set totem = false
set lastAmount = udg_DamageEventAmount
set lastPrevAmt = udg_DamageEventPrevAmt //Store the actual pre-armor value.
set lastType = udg_DamageEventType //also store the damage type.
set lastCode = udg_IsDamageCode //store this as well.
set lastArmor = udg_DamageEventArmorT
set lastPrevArmor = armorType
set lastDefense = udg_DamageEventDefenseT
set lastPrevDefense = defenseType
set lastPierced = udg_DamageEventArmorPierced
set canKick = false
endif
else
call Finish()
endif
if src != udg_AOEDamageSource then //Source has damaged more than once
call OnAOEEnd() //New damage source - unflag everything
set udg_AOEDamageSource = src
elseif tgt == udg_EnhancedDamageTarget then
set udg_DamageEventLevel= udg_DamageEventLevel + 1 //The number of times the same unit was hit.
elseif not IsUnitInGroup(tgt, udg_DamageEventAOEGroup) then
set udg_DamageEventAOE = udg_DamageEventAOE + 1 //Multiple targets hit by this source - flag as AOE
endif
else
call TimerStart(alarm, 0.00, false, function WakeUp)
set alarmSet = true
set udg_AOEDamageSource = src
set udg_EnhancedDamageTarget= tgt
endif
call GroupAddUnit(udg_DamageEventAOEGroup, tgt)
endif
set udg_DamageEventType = udg_NextDamageType
set udg_IsDamageCode = udg_NextDamageType != 0
set udg_DamageEventOverride = dt == null //Got rid of NextDamageOverride in 5.1 for simplicity
set udg_DamageEventPrevAmt = amt
set udg_DamageEventSource = src
set udg_DamageEventTarget = tgt
set udg_DamageEventAmount = amt
set udg_DamageEventAttackT = GetHandleId(at)
set udg_DamageEventDamageT = GetHandleId(dt)
set udg_DamageEventWeaponT = GetHandleId(wt)
call CalibrateMR() //Set Melee and Ranged settings.
set udg_DamageEventArmorT = BlzGetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_ARMOR_TYPE) //Introduced in Damage Engine 5.2.0.0
set udg_DamageEventDefenseT = BlzGetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_DEFENSE_TYPE)
set armorType = udg_DamageEventArmorT
set defenseType = udg_DamageEventDefenseT
set udg_DamageEventArmorPierced = 0.00
set udg_DamageScalingUser = 1.00
set udg_DamageScalingWC3 = 1.00
if amt != 0.00 then
if not udg_DamageEventOverride then
call RunTrigs(MOD_EVENT)
//All events have run and the pre-damage amount is finalized.
call BlzSetEventAttackType(ConvertAttackType(udg_DamageEventAttackT))
call BlzSetEventDamageType(ConvertDamageType(udg_DamageEventDamageT))
call BlzSetEventWeaponType(ConvertWeaponType(udg_DamageEventWeaponT))
if udg_DamageEventArmorPierced != 0.00 then
call BlzSetUnitArmor(udg_DamageEventTarget, BlzGetUnitArmor(udg_DamageEventTarget) - udg_DamageEventArmorPierced)
endif
if armorType != udg_DamageEventArmorT then
call BlzSetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_ARMOR_TYPE, udg_DamageEventArmorT) //Introduced in Damage Engine 5.2.0.0
endif
if defenseType != udg_DamageEventDefenseT then
call BlzSetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_DEFENSE_TYPE, udg_DamageEventDefenseT) //Introduced in Damage Engine 5.2.0.0
endif
call BlzSetEventDamage(udg_DamageEventAmount)
endif
//call BJDebugMsg("Ready to deal " + R2S(udg_DamageEventAmount))
set totem = true
else
call RunTrigs(ZERO_EVENT)
set canKick = true
call Finish()
endif
endif
set src = null
set tgt = null
set inception = false
set udg_NextDamageType = 0
return false
endfunction
//The traditional on-damage response, where armor reduction has already been factored in.
private function OnDamage takes nothing returns boolean
local real r = GetEventDamage()
//call BJDebugMsg("Second damage event running")
if dreaming or udg_DamageEventPrevAmt == 0.00 then
//if dreaming then
// call BJDebugMsg("Dreaming")
//else
// call BJDebugMsg("Prev amount is zero")
//endif
return false
endif
if totem then
set totem = false //This should be the case in almost all circumstances
else
call AfterDamage() //Wrap up the outstanding damage instance
set canKick = true
//Unfortunately, Spirit Link and Thorns Aura/Spiked Carapace fire the DAMAGED event out of sequence with the DAMAGING event,
//so I have to re-generate a buncha stuff here.
set udg_DamageEventSource = GetEventDamageSource()
set udg_DamageEventTarget = GetTriggerUnit()
set udg_DamageEventAmount = lastAmount
set udg_DamageEventPrevAmt = lastPrevAmt
set udg_DamageEventAttackT = GetHandleId(BlzGetEventAttackType())
set udg_DamageEventDamageT = GetHandleId(BlzGetEventDamageType())
set udg_DamageEventWeaponT = GetHandleId(BlzGetEventWeaponType())
set udg_DamageEventType = lastType
set udg_IsDamageCode = lastCode
set udg_DamageEventArmorT = lastArmor
set udg_DamageEventDefenseT = lastDefense
set udg_DamageEventArmorPierced = lastPierced
set armorType = lastPrevArmor
set defenseType = lastPrevDefense
call CalibrateMR() //Apply melee/ranged settings once again.
endif
call ResetArmor()
if udg_DamageEventAmount != 0.00 and r != 0.00 then
set udg_DamageScalingWC3 = r / udg_DamageEventAmount
elseif udg_DamageEventAmount > 0.00 then
set udg_DamageScalingWC3 = 0.00
else
set udg_DamageScalingWC3 = 1.00
set udg_DamageScalingUser = udg_DamageEventAmount / udg_DamageEventPrevAmt
endif
set udg_DamageEventAmount = udg_DamageEventAmount*udg_DamageScalingWC3
if udg_DamageEventAmount > 0.00 then
//This event is used for custom shields which have a limited hit point value
//The shield here kicks in after armor, so it acts like extra hit points.
call RunTrigs(SHIELD_EVENT)
set udg_LethalDamageHP = GetWidgetLife(udg_DamageEventTarget) - udg_DamageEventAmount
if udg_LethalDamageHP <= 0.405 then
call RunTrigs(LETHAL_EVENT) //Added 10 May 2019 to detect and potentially prevent lethal damage. Instead of
//modifying the damage, you need to modify LethalDamageHP instead (the final HP of the unit).
set udg_DamageEventAmount = GetWidgetLife(udg_DamageEventTarget) - udg_LethalDamageHP
if udg_DamageEventType < 0 and udg_LethalDamageHP <= 0.405 then
call SetUnitExploded(udg_DamageEventTarget, true) //Explosive damage types should blow up the target.
endif
endif
set udg_DamageScalingUser = udg_DamageEventAmount/udg_DamageEventPrevAmt/udg_DamageScalingWC3
endif
call BlzSetEventDamage(udg_DamageEventAmount) //Apply the final damage amount.
if udg_DamageEventDamageT != udg_DAMAGE_TYPE_UNKNOWN then
call RunTrigs(DAMAGE_EVENT)
endif
set eventsRun = true
if udg_DamageEventAmount == 0.00 then
call Finish()
endif
return false
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_DAMAGED) //Thanks to this I no longer have to create an event for every unit in the map.
call TriggerAddCondition(trig, Filter(function OnDamage))
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_DAMAGING) //The new 1.31 event which fires before damage.
call TriggerAddCondition(trig, Filter(function OnPreDamage))
set trig = null
endfunction
public function DebugStr takes nothing returns nothing
local integer i = 0
loop
set udg_CONVERTED_ATTACK_TYPE[i] = ConvertAttackType(i)
exitwhen i == 6
set i = i + 1
endloop
set i = 0
loop
set udg_CONVERTED_DAMAGE_TYPE[i] = ConvertDamageType(i)
exitwhen i == 26
set i = i + 1
endloop
set udg_AttackTypeDebugStr[0] = "SPELLS" //ATTACK_TYPE_NORMAL in JASS
set udg_AttackTypeDebugStr[1] = "NORMAL" //ATTACK_TYPE_MELEE in JASS
set udg_AttackTypeDebugStr[2] = "PIERCE"
set udg_AttackTypeDebugStr[3] = "SIEGE"
set udg_AttackTypeDebugStr[4] = "MAGIC"
set udg_AttackTypeDebugStr[5] = "CHAOS"
set udg_AttackTypeDebugStr[6] = "HERO"
set udg_DamageTypeDebugStr[0] = "UNKNOWN"
set udg_DamageTypeDebugStr[4] = "NORMAL"
set udg_DamageTypeDebugStr[5] = "ENHANCED"
set udg_DamageTypeDebugStr[8] = "FIRE"
set udg_DamageTypeDebugStr[9] = "COLD"
set udg_DamageTypeDebugStr[10] = "LIGHTNING"
set udg_DamageTypeDebugStr[11] = "POISON"
set udg_DamageTypeDebugStr[12] = "DISEASE"
set udg_DamageTypeDebugStr[13] = "DIVINE"
set udg_DamageTypeDebugStr[14] = "MAGIC"
set udg_DamageTypeDebugStr[15] = "SONIC"
set udg_DamageTypeDebugStr[16] = "ACID"
set udg_DamageTypeDebugStr[17] = "FORCE"
set udg_DamageTypeDebugStr[18] = "DEATH"
set udg_DamageTypeDebugStr[19] = "MIND"
set udg_DamageTypeDebugStr[20] = "PLANT"
set udg_DamageTypeDebugStr[21] = "DEFENSIVE"
set udg_DamageTypeDebugStr[22] = "DEMOLITION"
set udg_DamageTypeDebugStr[23] = "SLOW_POISON"
set udg_DamageTypeDebugStr[24] = "SPIRIT_LINK"
set udg_DamageTypeDebugStr[25] = "SHADOW_STRIKE"
set udg_DamageTypeDebugStr[26] = "UNIVERSAL"
set udg_WeaponTypeDebugStr[0] = "NONE" //WEAPON_TYPE_WHOKNOWS in JASS
set udg_WeaponTypeDebugStr[1] = "METAL_LIGHT_CHOP"
set udg_WeaponTypeDebugStr[2] = "METAL_MEDIUM_CHOP"
set udg_WeaponTypeDebugStr[3] = "METAL_HEAVY_CHOP"
set udg_WeaponTypeDebugStr[4] = "METAL_LIGHT_SLICE"
set udg_WeaponTypeDebugStr[5] = "METAL_MEDIUM_SLICE"
set udg_WeaponTypeDebugStr[6] = "METAL_HEAVY_SLICE"
set udg_WeaponTypeDebugStr[7] = "METAL_MEDIUM_BASH"
set udg_WeaponTypeDebugStr[8] = "METAL_HEAVY_BASH"
set udg_WeaponTypeDebugStr[9] = "METAL_MEDIUM_STAB"
set udg_WeaponTypeDebugStr[10] = "METAL_HEAVY_STAB"
set udg_WeaponTypeDebugStr[11] = "WOOD_LIGHT_SLICE"
set udg_WeaponTypeDebugStr[12] = "WOOD_MEDIUM_SLICE"
set udg_WeaponTypeDebugStr[13] = "WOOD_HEAVY_SLICE"
set udg_WeaponTypeDebugStr[14] = "WOOD_LIGHT_BASH"
set udg_WeaponTypeDebugStr[15] = "WOOD_MEDIUM_BASH"
set udg_WeaponTypeDebugStr[16] = "WOOD_HEAVY_BASH"
set udg_WeaponTypeDebugStr[17] = "WOOD_LIGHT_STAB"
set udg_WeaponTypeDebugStr[18] = "WOOD_MEDIUM_STAB"
set udg_WeaponTypeDebugStr[19] = "CLAW_LIGHT_SLICE"
set udg_WeaponTypeDebugStr[20] = "CLAW_MEDIUM_SLICE"
set udg_WeaponTypeDebugStr[21] = "CLAW_HEAVY_SLICE"
set udg_WeaponTypeDebugStr[22] = "AXE_MEDIUM_CHOP"
set udg_WeaponTypeDebugStr[23] = "ROCK_HEAVY_BASH"
set udg_DefenseTypeDebugStr[0] = "LIGHT"
set udg_DefenseTypeDebugStr[1] = "MEDIUM"
set udg_DefenseTypeDebugStr[2] = "HEAVY"
set udg_DefenseTypeDebugStr[3] = "FORTIFIED"
set udg_DefenseTypeDebugStr[4] = "NORMAL" //Typically deals flat damage to all armor types
set udg_DefenseTypeDebugStr[5] = "HERO"
set udg_DefenseTypeDebugStr[6] = "DIVINE"
set udg_DefenseTypeDebugStr[7] = "UNARMORED"
set udg_ArmorTypeDebugStr[0] = "NONE" //ARMOR_TYPE_WHOKNOWS in JASS, added in 1.31
set udg_ArmorTypeDebugStr[1] = "FLESH"
set udg_ArmorTypeDebugStr[2] = "METAL"
set udg_ArmorTypeDebugStr[3] = "WOOD"
set udg_ArmorTypeDebugStr[4] = "ETHEREAL"
set udg_ArmorTypeDebugStr[5] = "STONE"
endfunction
//This function exists mainly to make it easier to switch from another DDS, like PDD.
function UnitDamageTargetEx takes unit src, unit tgt, real amt, boolean a, boolean r, attacktype at, damagetype dt, weapontype wt returns boolean
if udg_NextDamageType == 0 then
set udg_NextDamageType = udg_DamageTypeCode
endif
call UnitDamageTarget(src, tgt, amt, a, r, at, dt, wt)
return dreaming
endfunction
public function SetupEvent takes trigger whichTrig, string var, integer index returns nothing
local integer max = 1
local integer off = 0
local integer exit = 0
local integer i
if var == "udg_DamageModifierEvent" then //MOD_EVENT 1-4 -> Events 1-4
if index < 3 then
set exit = index + 1
endif
if nextTrig[1] == 0 then
set nextTrig[1] = 2
set nextTrig[2] = 3
set trigFrozen[2] = true
set trigFrozen[3] = true
endif
set max = 4
elseif var == "udg_DamageEvent" then //DAMAGE_EVENT 1,2 -> Events 5,6
set max = 2
set off = 4
elseif var == "udg_AfterDamageEvent" then //AFTER_EVENT -> Event 7
set off = 6
elseif var == "udg_LethalDamageEvent" then //LETHAL_EVENT -> Event 8
set off = 7
elseif var == "udg_AOEDamageEvent" then //AOE_EVENT -> Event 9
set off = 8
else
return
endif
set i = IMaxBJ(IMinBJ(index, max), 1) + off
//call BJDebugMsg("Root index: " + I2S(i))
loop
set index = i
set i = nextTrig[i]
exitwhen i == exit
endloop
set userTrigs = userTrigs + 1 //User list runs from index 10 and up
set nextTrig[index] = userTrigs
set nextTrig[userTrigs] = exit
set userTrig[userTrigs] = whichTrig
//call BJDebugMsg("Registered " + I2S(userTrigs) + " to " + I2S(index))
endfunction
private function PreSetup takes trigger whichTrig, string var, limitop op, real value returns nothing
call SetupEvent(whichTrig, var, R2I(value))
endfunction
hook TriggerRegisterVariableEvent PreSetup
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library KeyboardSystem initializer Init
// Keyboard System by The_Witcher
// This System helps you to get rid of all the triggers
// you would need for creating an effective arrow key
// system.
// This system has aditionally the power to add a key twice press event to a trigger
// you just need to adjust this little variable:
globals
// this is the time the player has to "double press" a key
// if a key is pressed twice in this time the registered triggers are executed
private constant real DELAY = 0.2
endglobals
// Use this function to see which keys are hold down:
//
// IsKeyDown( key, pl) returns boolean
// string player
//
// key can be KEY_LEFT, KEY_RIGHT, KEY_UP or KEY_DOWN
// pl is the player who is checked
// if the function returns true the key is hold down by player pl
//
// And this 2 functions to register a double press event to a trigger
//
// TriggerRegisterKeyDoublePressEvent(t, key)
//
// TriggerRegisterPlayerKeyDoublePressEvent(t, key, pl)
//
// TriggerRegisterKeyDoubleInterruptEvent(t, key)
//
// TriggerRegisterPlayerKeyDoubleInterruptEvent(t, key, pl)
//
// t is the trigger you want to register that event to
// key is the pressed key (again can be KEY_LEFT, KEY_RIGHT, KEY_UP or KEY_DOWN)
// pl is in the second function the player who has to press
// the keys to fire the trigger
// the first function fires the trigger regardless of which player pressed the key
//
//
//--------------Don't edit anything below---------------------------
globals
private timer array time[13]
private trigger array TRIGGERS
private trigger array TRIGGERS2
private integer total = 0
private integer total2 = 0
private integer array PLAYER
private integer array PLAYER2
private string array KEY
private string array KEY2
constant string KEY_LEFT = "left"
constant string KEY_RIGHT = "right"
constant string KEY_UP = "up"
constant string KEY_DOWN = "down"
private hashtable h = InitHashtable()
endglobals
function IsKeyDown takes string key, player pl returns boolean
return LoadBoolean(h,GetPlayerId(pl),StringHash(key))
endfunction
function TriggerRegisterKeyDoublePressEvent takes trigger t, string key returns nothing
set TRIGGERS[total] = t
set KEY[total] = key
set PLAYER[total] = 100
set total = total + 1
endfunction
function TriggerRegisterPlayerKeyDoublePressEvent takes trigger t, string key, player pl returns nothing
set TRIGGERS[total] = t
set KEY[total] = key
set PLAYER[total] = GetPlayerId(pl)
set total = total + 1
endfunction
function TriggerRegisterKeyDoubleInterruptEvent takes trigger t, string key returns nothing
set TRIGGERS2[total2] = t
set KEY2[total2] = key
set PLAYER2[total2] = 100
set total2 = total2 + 1
endfunction
function TriggerRegisterPlayerKeyDoubleInterruptEvent takes trigger t, string key, player pl returns nothing
set TRIGGERS2[total2] = t
set KEY2[total2] = key
set PLAYER2[total2] = GetPlayerId(pl)
set total2 = total2 + 1
endfunction
//! textmacro TriggerActions takes NAME, VarTrue, VarFalse
private function $NAME$press takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
local integer x = 0
call SaveBoolean(h,i,StringHash("$VarTrue$"),true)
call SaveBoolean(h,i,StringHash("$VarFalse$"),false)
if LoadStr(h,i,StringHash("LastKey")) != "$VarTrue$" then
call TimerStart(time[i],0,false,null)
endif
if TimerGetRemaining(time[i]) > 0 and LoadStr(h,i,StringHash("LastKey")) == "$VarTrue$" then
call SaveInteger(h,i,StringHash("Debug"),0)
call SaveBoolean(h,i,StringHash("$VarTrue$Double"),true)
loop
exitwhen x >= total
if TriggerEvaluate(TRIGGERS[x]) and KEY[x] == "$VarTrue$" and (PLAYER[x] == 100 or PLAYER[x] == i) then
call TriggerExecute(TRIGGERS[x])
endif
set x = x + 1
endloop
endif
if LoadInteger(h,i,StringHash("Debug")) == 1 then
call TimerStart(time[i],DELAY,false,null)
else
call SaveInteger(h,i,StringHash("Debug"),1)
endif
call SaveStr(h,i,StringHash("LastKey"),"$VarTrue$")
endfunction
private function $NAME$release takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
local integer x = 0
call SaveBoolean(h,i,StringHash("$VarTrue$"),false)
if LoadBoolean(h,i,StringHash("$VarTrue$Double")) then
call SaveBoolean(h,i,StringHash("$VarTrue$Double"),false)
loop
exitwhen x >= total2
if TriggerEvaluate(TRIGGERS2[x]) and KEY2[x] == "$VarTrue$" and (PLAYER2[x] == 100 or PLAYER2[x] == i) then
call TriggerExecute(TRIGGERS2[x])
endif
set x = x + 1
endloop
endif
endfunction
//! endtextmacro
//! runtextmacro TriggerActions("LEFT","left","right")
//! runtextmacro TriggerActions("RIGHT","right","left")
//! runtextmacro TriggerActions("UP","up","down")
//! runtextmacro TriggerActions("DOWN","down","up")
//! textmacro Initiate takes NAME
set i = 0
set t = CreateTrigger()
set tt = CreateTrigger()
call TriggerAddAction(t,function $NAME$press)
call TriggerAddAction(tt,function $NAME$release)
loop
exitwhen i > 12
call TriggerRegisterPlayerEvent(t,Player(i),EVENT_PLAYER_ARROW_$NAME$_DOWN)
call TriggerRegisterPlayerEvent(tt,Player(i),EVENT_PLAYER_ARROW_$NAME$_UP)
set i = i + 1
endloop
//! endtextmacro
private function Init takes nothing returns nothing
local trigger t
local trigger tt
local integer i
//! runtextmacro Initiate("LEFT")
//! runtextmacro Initiate("RIGHT")
//! runtextmacro Initiate("UP")
//! runtextmacro Initiate("DOWN")
set i = 0
loop
exitwhen i > 12
set time[i] = CreateTimer()
set i = i + 1
endloop
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ArrowKeyMovement initializer Init requires KeyboardSystem, ArrowKeyMovementPlugins
// Arrow key movement by The_Witcher
// this system allows each player to control 1 unit
// with his arrow keys even if he doesn't own the unit!
// It features turning on the left and right arrow, walking foreward
// by pressing the up arrow and walking backwards by pressing the down arrow...
//
// You can improve this system with plugins but you need vJass knowledge for that!
//
// --> The TurnRate of a unit inside the object editor STILL influences the turn rate from this system <--
//
// Included functions:
//
// SetMovementUnit ( whichunit, forWhichPlayer, walkAnimationIndex )
// unit player integer
// this gives the player the arrow key movement control over the unit
// while the unit moves the animation of the given index is played
// (just try around to find the index... start at 0 and increase
// by 1 until you find the walk index of that unit)
//
//
// ReleaseMovementUnit ( fromWhichPlayer )
// player
// this function removes the control from a player
//
//
// GetMovementUnit ( fromWhichPlayer ) returns unit
// player
// I think its self explaining...
//
//
// SetMovementUnitAnimation ( fromWhichPlayer, animation )
// player integer
// this function allows ingame changing of the played animation of a unit
// ------- SETUP PART ---------
globals
// the timer interval... increase if laggy
private constant real INTERVAL = 0.01
// the facing change in degrees each interval (must be a positive value)
private constant real DEFAULT_VIEW_CHANGE = 20
// when you move backwards you move slower than normal...
private constant real BACKWARDS_MOVING_FACTOR = 0
// if the unit turns it will turn faster the longer it does...
// some people may need that but then it should be 1.02 (1.0 means disabled)
private constant real TURN_ACCELERATION = 1
// (can only be 1 or -1) if you walk backwards you have 2 ways of turning
// 1. way: pressing left will make the char turn left
// 2. way: pressing left will make the char turn so he moves to the left
private constant integer REVERSED_BACKWARDS_MOVING = -1
endglobals
// whenever this function returns false for a unit it won't be moved even if the player
// presses the keys! change to create your own "No Movement" conditions
private function MoveConditions takes unit u returns boolean
return not IsUnitType(u,UNIT_TYPE_SLEEPING) and not IsUnitType(u,UNIT_TYPE_STUNNED) and not (IsUnitType(u,UNIT_TYPE_DEAD) or GetUnitTypeId(u) == 0 )
endfunction
// --------- don't modify anything below this line ------------
struct ArrowKeyMovement
private static ArrowKeyMovement array all [12] // = bj_MAX_PLAYERS
private static timer tim
integer walking
unit u
integer animation
real SpeedFactor
real ViewChange
real SpecialDirection
boolean SpecialDirectionActive
static method operator [] takes player p returns ArrowKeyMovement
local integer i = GetPlayerId(p)
if .all[i] == 0 then
set .all[i] = ArrowKeyMovement.create()
set .all[i].SpeedFactor = 1
set .all[i].SpecialDirection = 0
set .all[i].SpecialDirectionActive = false
set .all[i].ViewChange = DEFAULT_VIEW_CHANGE
endif
return .all[i]
endmethod
private static method Walking takes nothing returns nothing
local integer i = 0
local real x
local real y
local real X
local real Y
local boolean boolX
local boolean boolY
local boolean left
local boolean right
local boolean up
local boolean down
local ArrowKeyMovement mov
loop
exitwhen i >= 12 // = bj_MAX_PLAYERS
set mov = .all[i]
if mov.u != null and MoveConditions(mov.u) then
// special movement <-- plugins
if mov.SpecialDirectionActive then
if mov.walking != 1 then
call SetUnitTimeScale(mov.u,mov.SpeedFactor)
call SetUnitAnimationByIndex(mov.u,mov.animation)
set mov.walking = 1
else
call SetUnitTimeScale(mov.u,mov.SpeedFactor)
endif
set x = GetUnitX(mov.u)
set y = GetUnitY(mov.u)
set X = x + GetUnitMoveSpeed(mov.u)*INTERVAL * Cos(mov.SpecialDirection*bj_DEGTORAD) * mov.SpeedFactor
set Y = y + GetUnitMoveSpeed(mov.u)*INTERVAL * Sin(mov.SpecialDirection*bj_DEGTORAD) * mov.SpeedFactor
call SetUnitPosition(mov.u,X,Y)
if (RAbsBJ(GetUnitX(mov.u)-X)>0.5)or(RAbsBJ(GetUnitY(mov.u)-Y)>0.5)then
call SetUnitPosition(mov.u,X,y)
set boolX = RAbsBJ(GetUnitX(mov.u)-X)<=0.5
call SetUnitPosition(mov.u,x,Y)
set boolY = RAbsBJ(GetUnitY(mov.u)-Y)<=0.5
if boolX then
call SetUnitPosition(mov.u,X,y)
elseif boolY then
call SetUnitPosition(mov.u,x,Y)
else
call SetUnitPosition(mov.u,x,y)
endif
endif
else
// Normal movement
set left = IsKeyDown(KEY_LEFT,Player(i))
set right = IsKeyDown(KEY_RIGHT,Player(i))
set up = IsKeyDown(KEY_UP,Player(i))
set down = IsKeyDown(KEY_DOWN,Player(i))
//right down
if right then
if down then
call SetUnitFacing(mov.u,GetUnitFacing(mov.u)-mov.ViewChange * -REVERSED_BACKWARDS_MOVING)
else
call SetUnitFacing(mov.u,GetUnitFacing(mov.u)-mov.ViewChange)
endif
set mov.ViewChange = mov.ViewChange * TURN_ACCELERATION
elseif not left then
set mov.ViewChange = DEFAULT_VIEW_CHANGE
endif
//left down
if left then
if down then
call SetUnitFacing(mov.u,GetUnitFacing(mov.u)+mov.ViewChange * -REVERSED_BACKWARDS_MOVING)
else
call SetUnitFacing(mov.u,GetUnitFacing(mov.u)+mov.ViewChange)
endif
set mov.ViewChange = mov.ViewChange * TURN_ACCELERATION
elseif not right then
set mov.ViewChange = DEFAULT_VIEW_CHANGE
endif
if mov.ViewChange > 179 then
set mov.ViewChange = 179
endif
//up down
if up then
if mov.walking != 1 then
call SetUnitTimeScale(mov.u,mov.SpeedFactor)
call SetUnitAnimationByIndex(mov.u,mov.animation)
set mov.walking = 1
else
call SetUnitTimeScale(mov.u,mov.SpeedFactor)
endif
set x = GetUnitX(mov.u)
set y = GetUnitY(mov.u)
set X = x + GetUnitMoveSpeed(mov.u)*INTERVAL * Cos(GetUnitFacing(mov.u)*bj_DEGTORAD) * mov.SpeedFactor
set Y = y + GetUnitMoveSpeed(mov.u)*INTERVAL * Sin(GetUnitFacing(mov.u)*bj_DEGTORAD) * mov.SpeedFactor
//down down
elseif down then
if mov.walking != 2 then
call SetUnitTimeScale(mov.u,-BACKWARDS_MOVING_FACTOR * mov.SpeedFactor)
call SetUnitAnimationByIndex(mov.u,mov.animation)
set mov.walking = 2
else
call SetUnitTimeScale(mov.u,-BACKWARDS_MOVING_FACTOR * mov.SpeedFactor)
endif
set x = GetUnitX(mov.u)
set y = GetUnitY(mov.u)
set X = x - GetUnitMoveSpeed(mov.u) * INTERVAL * Cos(GetUnitFacing(mov.u)*bj_DEGTORAD) * BACKWARDS_MOVING_FACTOR * mov.SpeedFactor
set Y = y - GetUnitMoveSpeed(mov.u) * INTERVAL * Sin(GetUnitFacing(mov.u)*bj_DEGTORAD) * BACKWARDS_MOVING_FACTOR * mov.SpeedFactor
endif
//move
if down or up then
call SetUnitPosition(mov.u,X,Y)
if (RAbsBJ(GetUnitX(mov.u)-X)>0.5)or(RAbsBJ(GetUnitY(mov.u)-Y)>0.5)then
call SetUnitPosition(mov.u,X,y)
set boolX = RAbsBJ(GetUnitX(mov.u)-X)<=0.5
call SetUnitPosition(mov.u,x,Y)
set boolY = RAbsBJ(GetUnitY(mov.u)-Y)<=0.5
if boolX then
call SetUnitPosition(mov.u,X,y)
elseif boolY then
call SetUnitPosition(mov.u,x,Y)
else
call SetUnitPosition(mov.u,x,y)
endif
endif
else
if mov.walking != 0 then
call SetUnitAnimation(mov.u,"stand")
call SetUnitTimeScale(mov.u,1)
set mov.walking = 0
endif
endif
endif
endif
set i = i + 1
endloop
endmethod
static method onInit takes nothing returns nothing
set .tim = CreateTimer()
call TimerStart(.tim,INTERVAL,true,function ArrowKeyMovement.Walking)
endmethod
endstruct
function GetMovementUnit takes player p returns unit
return ArrowKeyMovement[p].u
endfunction
function SetMovementUnitAnimation takes player p, integer animation returns nothing
set ArrowKeyMovement[p].animation = animation
endfunction
function ReleaseMovementUnit takes player p returns nothing
if ArrowKeyMovement[p].u != null then
set ArrowKeyMovement[p].walking = 0
call SetUnitAnimation(ArrowKeyMovement[p].u,"stand")
call SetUnitTimeScale(ArrowKeyMovement[p].u,1)
set ArrowKeyMovement[p].u = null
endif
endfunction
function SetMovementUnit takes unit u, player p, integer anim returns nothing
if u == null then
call ReleaseMovementUnit(p)
return
endif
if ArrowKeyMovement[p].u != null then
call ReleaseMovementUnit(p)
endif
call SetUnitAnimation(ArrowKeyMovement[p].u,"stand")
set ArrowKeyMovement[p].u = u
set ArrowKeyMovement[p].animation = anim
endfunction
//! runtextmacro ArrowKeyMovement_Plugins_Functions()
private function Init takes nothing returns nothing
//! runtextmacro Init_ArrowKeyMovement_Plugins()
endfunction
endlibrary
//TESH.scrollpos=0
//TESH.alwaysfold=0
library ArrowKeyMovementPlugins
// code your own plugins for my Arrow key movement system!
// how you do that is explained in detail in the "How to use the Movement System Plugins"
// comment included in this map
//
//
// the plugins I coded for the test map are:
// 1. running fast/dashing when double pressing up
// 2. turning around (180°) when double pressing down
// 3. moving left without changing face direction when double pressing left
// 4. moving right without changing face direction when double pressing right
//! textmacro Init_ArrowKeyMovement_Plugins
local trigger t
// This is the initialization for turning around on double down press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleDownPress)
call TriggerRegisterKeyDoublePressEvent(t,KEY_DOWN)
// This is the initialization for dashing on double up press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleUpPress)
call TriggerRegisterKeyDoublePressEvent(t,KEY_UP)
// This is the initialization for sliding left on double left press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleLeftPress)
call TriggerRegisterKeyDoublePressEvent(t,KEY_LEFT)
// This is the initialization for sliding right on double right press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleRightPress)
call TriggerRegisterKeyDoublePressEvent(t,KEY_RIGHT)
// This is the initialization for stoping the dash of double up press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleUpRelease)
call TriggerRegisterKeyDoubleInterruptEvent(t,KEY_UP)
// This is the initialization for stoping slide of double left press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleLeftRelease)
call TriggerRegisterKeyDoubleInterruptEvent(t,KEY_LEFT)
// This is the initialization for stoping slide of double right press
set t = CreateTrigger()
call TriggerAddAction(t, function OnDoubleRightRelease)
call TriggerRegisterKeyDoubleInterruptEvent(t,KEY_RIGHT)
//! endtextmacro
//! textmacro ArrowKeyMovement_Plugins_Functions
// This is the function for turning around on double down press
private function OnDoubleDownPress takes nothing returns nothing
local ArrowKeyMovement mov = ArrowKeyMovement[GetTriggerPlayer()]
set mov.SpecialDirectionActive = false
call SetUnitFacing(mov.u,GetUnitFacing(mov.u)-0)
endfunction
// This is the function for dashing on double up press
private function OnDoubleUpPress takes nothing returns nothing
local ArrowKeyMovement mov = ArrowKeyMovement[GetTriggerPlayer()]
set mov.SpecialDirectionActive = false
set mov.SpeedFactor = 1
endfunction
// This is the function for sliding left on double left press
private function OnDoubleLeftPress takes nothing returns nothing
local ArrowKeyMovement mov = ArrowKeyMovement[GetTriggerPlayer()]
set mov.SpecialDirectionActive = false
set mov.SpecialDirection = GetUnitFacing(mov.u) + 0
set mov.SpeedFactor = 1
endfunction
// This is the function for sliding right on double right press
private function OnDoubleRightPress takes nothing returns nothing
local ArrowKeyMovement mov = ArrowKeyMovement[GetTriggerPlayer()]
set mov.SpecialDirectionActive = false
set mov.SpecialDirection = GetUnitFacing(mov.u) - 0
set mov.SpeedFactor = 1
endfunction
// This is the function for stoping the dash of double up press
private function OnDoubleUpRelease takes nothing returns nothing
set ArrowKeyMovement[GetTriggerPlayer()].SpeedFactor = 1
endfunction
// This is the function for stoping slide of double left press
private function OnDoubleLeftRelease takes nothing returns nothing
local ArrowKeyMovement mov = ArrowKeyMovement[GetTriggerPlayer()]
set mov.SpecialDirectionActive = false
set mov.SpeedFactor = 1
endfunction
// This is the function for stoping slide of double right press
private function OnDoubleRightRelease takes nothing returns nothing
local ArrowKeyMovement mov = ArrowKeyMovement[GetTriggerPlayer()]
set mov.SpecialDirectionActive = false
set mov.SpeedFactor = 1
endfunction
//! endtextmacro
endlibrary
globals
framehandle DDMain = null
trigger TriggerDDMain = null
framehandle DDExit = null
framehandle BackdropDDExit = null
trigger TriggerDDExit = null
endglobals
library DD initializer init
function DDExitFunc takes nothing returns nothing
call BlzFrameSetEnable(DDExit, false)
call BlzFrameSetEnable(DDExit, true)
set udg_DDExit = GetConvertedPlayerId(GetTriggerPlayer())
endfunction
private function init takes nothing returns nothing
set DDMain = BlzCreateFrameByType("BACKDROP", "DDMain", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), "", 1)
call BlzFrameSetAbsPoint(DDMain, FRAMEPOINT_TOPLEFT, 0.141890, 0.578872)
call BlzFrameSetAbsPoint(DDMain, FRAMEPOINT_BOTTOMRIGHT, 0.665550, 0.0594820)
call BlzFrameSetTexture(DDMain, "DD_Info.blp", 0, true)
set DDExit = BlzCreateFrame("ScriptDialogButton", DDMain, 0, 0)
call BlzFrameSetAbsPoint(DDExit, FRAMEPOINT_TOPLEFT, 0.639680, 0.576743)
call BlzFrameSetAbsPoint(DDExit, FRAMEPOINT_BOTTOMRIGHT, 0.661753, 0.554690)
set BackdropDDExit = BlzCreateFrameByType("BACKDROP", "BackdropDDExit", DDExit, "", 1)
call BlzFrameSetAllPoints(BackdropDDExit, DDExit)
call BlzFrameSetTexture(BackdropDDExit, "DD_Exit.blp", 0, true)
set TriggerDDExit = CreateTrigger()
call BlzTriggerRegisterFrameEvent(TriggerDDExit, DDExit, FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(TriggerDDExit, function DDExitFunc)
endfunction
endlibrary
globals
framehandle DDVoteMain = null
trigger TriggerDDVoteMain = null
framehandle array DDArena
framehandle array BackdropDDArena
trigger array TriggerDDArena
framehandle DDVoteExit = null
framehandle BackdropDDVoteExit = null
trigger TriggerDDVoteExit = null
framehandle array DDVoteCount
trigger array TriggerDDVoteCount
endglobals
library DDVote initializer init
function DDArena00Func takes nothing returns nothing
call BlzFrameSetEnable(DDArena[0], false)
call BlzFrameSetEnable(DDArena[0], true)
set udg_DDVote1 = GetConvertedPlayerId(GetTriggerPlayer())
endfunction
function DDArena01Func takes nothing returns nothing
call BlzFrameSetEnable(DDArena[1], false)
call BlzFrameSetEnable(DDArena[1], true)
set udg_DDVote2 = GetConvertedPlayerId(GetTriggerPlayer())
endfunction
function DDArena02Func takes nothing returns nothing
call BlzFrameSetEnable(DDArena[2], false)
call BlzFrameSetEnable(DDArena[2], true)
set udg_DDVote3 = GetConvertedPlayerId(GetTriggerPlayer())
endfunction
function DDArena03Func takes nothing returns nothing
call BlzFrameSetEnable(DDArena[3], false)
call BlzFrameSetEnable(DDArena[3], true)
set udg_DDVote4 = GetConvertedPlayerId(GetTriggerPlayer())
endfunction
function DDVoteExitFunc takes nothing returns nothing
call BlzFrameSetEnable(DDVoteExit, false)
call BlzFrameSetEnable(DDVoteExit, true)
set udg_DDVoteExit = GetConvertedPlayerId(GetTriggerPlayer())
endfunction
private function init takes nothing returns nothing
set DDVoteMain = BlzCreateFrameByType("BACKDROP", "DDVoteMain", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), "", 1)
call BlzFrameSetAbsPoint(DDVoteMain, FRAMEPOINT_TOPLEFT, 0.109160, 0.586693)
call BlzFrameSetAbsPoint(DDVoteMain, FRAMEPOINT_BOTTOMRIGHT, 0.698280, 0.0224330)
call BlzFrameSetTexture(DDVoteMain, "DD_ArenaMain.png", 0, true)
set DDArena[0] = BlzCreateFrame("ScriptDialogButton", DDVoteMain, 0, 0)
call BlzFrameSetAbsPoint(DDArena[0], FRAMEPOINT_TOPLEFT, 0.175380, 0.520890)
call BlzFrameSetAbsPoint(DDArena[0], FRAMEPOINT_BOTTOMRIGHT, 0.389260, 0.304160)
set BackdropDDArena[0] = BlzCreateFrameByType("BACKDROP", "BackdropDDArena[0]", DDArena[0], "", 1)
call BlzFrameSetAllPoints(BackdropDDArena[0], DDArena[0])
call BlzFrameSetTexture(BackdropDDArena[0], "DD_Arena1.blp", 0, true)
set TriggerDDArena[0] = CreateTrigger()
call BlzTriggerRegisterFrameEvent(TriggerDDArena[0], DDArena[0], FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(TriggerDDArena[0], function DDArena00Func)
set DDArena[1] = BlzCreateFrame("ScriptDialogButton", DDVoteMain, 0, 0)
call BlzFrameSetAbsPoint(DDArena[1], FRAMEPOINT_TOPLEFT, 0.419260, 0.520890)
call BlzFrameSetAbsPoint(DDArena[1], FRAMEPOINT_BOTTOMRIGHT, 0.633140, 0.304160)
set BackdropDDArena[1] = BlzCreateFrameByType("BACKDROP", "BackdropDDArena[1]", DDArena[1], "", 1)
call BlzFrameSetAllPoints(BackdropDDArena[1], DDArena[1])
call BlzFrameSetTexture(BackdropDDArena[1], "DD_Arena2.blp", 0, true)
set TriggerDDArena[1] = CreateTrigger()
call BlzTriggerRegisterFrameEvent(TriggerDDArena[1], DDArena[1], FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(TriggerDDArena[1], function DDArena01Func)
set DDArena[2] = BlzCreateFrame("ScriptDialogButton", DDVoteMain, 0, 0)
call BlzFrameSetAbsPoint(DDArena[2], FRAMEPOINT_TOPLEFT, 0.175380, 0.274160)
call BlzFrameSetAbsPoint(DDArena[2], FRAMEPOINT_BOTTOMRIGHT, 0.389260, 0.0574300)
set BackdropDDArena[2] = BlzCreateFrameByType("BACKDROP", "BackdropDDArena[2]", DDArena[2], "", 1)
call BlzFrameSetAllPoints(BackdropDDArena[2], DDArena[2])
call BlzFrameSetTexture(BackdropDDArena[2], "DD_Arena3.blp", 0, true)
set TriggerDDArena[2] = CreateTrigger()
call BlzTriggerRegisterFrameEvent(TriggerDDArena[2], DDArena[2], FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(TriggerDDArena[2], function DDArena02Func)
set DDArena[3] = BlzCreateFrame("ScriptDialogButton", DDVoteMain, 0, 0)
call BlzFrameSetAbsPoint(DDArena[3], FRAMEPOINT_TOPLEFT, 0.419260, 0.274160)
call BlzFrameSetAbsPoint(DDArena[3], FRAMEPOINT_BOTTOMRIGHT, 0.633140, 0.0574300)
set BackdropDDArena[3] = BlzCreateFrameByType("BACKDROP", "BackdropDDArena[3]", DDArena[3], "", 1)
call BlzFrameSetAllPoints(BackdropDDArena[3], DDArena[3])
call BlzFrameSetTexture(BackdropDDArena[3], "DD_Arena4.blp", 0, true)
set TriggerDDArena[3] = CreateTrigger()
call BlzTriggerRegisterFrameEvent(TriggerDDArena[3], DDArena[3], FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(TriggerDDArena[3], function DDArena03Func)
set DDVoteExit = BlzCreateFrame("ScriptDialogButton", DDVoteMain, 0, 0)
call BlzFrameSetAbsPoint(DDVoteExit, FRAMEPOINT_TOPLEFT, 0.661750, 0.580538)
call BlzFrameSetAbsPoint(DDVoteExit, FRAMEPOINT_BOTTOMRIGHT, 0.691434, 0.550880)
set BackdropDDVoteExit = BlzCreateFrameByType("BACKDROP", "BackdropDDVoteExit", DDVoteExit, "", 1)
call BlzFrameSetAllPoints(BackdropDDVoteExit, DDVoteExit)
call BlzFrameSetTexture(BackdropDDVoteExit, "DD_Exit.blp", 0, true)
set TriggerDDVoteExit = CreateTrigger()
call BlzTriggerRegisterFrameEvent(TriggerDDVoteExit, DDVoteExit, FRAMEEVENT_CONTROL_CLICK)
call TriggerAddAction(TriggerDDVoteExit, function DDVoteExitFunc)
set DDVoteCount[0] = BlzCreateFrameByType("TEXT", "name", DDArena[0], "", 0)
call BlzFrameSetAbsPoint(DDVoteCount[0], FRAMEPOINT_TOPLEFT, 0.362620, 0.328732)
call BlzFrameSetAbsPoint(DDVoteCount[0], FRAMEPOINT_BOTTOMRIGHT, 0.432645, 0.258770)
call BlzFrameSetText(DDVoteCount[0], "|cffFFCC009|r")
call BlzFrameSetEnable(DDVoteCount[0], false)
call BlzFrameSetScale(DDVoteCount[0], 1.00)
call BlzFrameSetTextAlignment(DDVoteCount[0], TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_LEFT)
set DDVoteCount[1] = BlzCreateFrameByType("TEXT", "name", DDArena[1], "", 0)
call BlzFrameSetAbsPoint(DDVoteCount[1], FRAMEPOINT_TOPLEFT, 0.609990, 0.329102)
call BlzFrameSetAbsPoint(DDVoteCount[1], FRAMEPOINT_BOTTOMRIGHT, 0.680015, 0.259140)
call BlzFrameSetText(DDVoteCount[1], "|cffFFCC009|r")
call BlzFrameSetEnable(DDVoteCount[1], false)
call BlzFrameSetScale(DDVoteCount[1], 1.00)
call BlzFrameSetTextAlignment(DDVoteCount[1], TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_LEFT)
set DDVoteCount[2] = BlzCreateFrameByType("TEXT", "name", DDArena[2], "", 0)
call BlzFrameSetAbsPoint(DDVoteCount[2], FRAMEPOINT_TOPLEFT, 0.363380, 0.0839000)
call BlzFrameSetAbsPoint(DDVoteCount[2], FRAMEPOINT_BOTTOMRIGHT, 0.433405, 0.0139380)
call BlzFrameSetText(DDVoteCount[2], "|cffFFCC009|r")
call BlzFrameSetEnable(DDVoteCount[2], false)
call BlzFrameSetScale(DDVoteCount[2], 1.00)
call BlzFrameSetTextAlignment(DDVoteCount[2], TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_LEFT)
set DDVoteCount[3] = BlzCreateFrameByType("TEXT", "name", DDArena[3], "", 0)
call BlzFrameSetAbsPoint(DDVoteCount[3], FRAMEPOINT_TOPLEFT, 0.609990, 0.0838050)
call BlzFrameSetAbsPoint(DDVoteCount[3], FRAMEPOINT_BOTTOMRIGHT, 0.680015, 0.0138430)
call BlzFrameSetText(DDVoteCount[3], "|cffFFCC009|r")
call BlzFrameSetEnable(DDVoteCount[3], false)
call BlzFrameSetScale(DDVoteCount[3], 1.00)
call BlzFrameSetTextAlignment(DDVoteCount[3], TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_LEFT)
endfunction
endlibrary