Name | Type | is_array | initial_value |
AnyPlayer | player | No | |
CastingUnit | unit | No | |
CenterPoint | location | No | |
CP_HiddenItems | item | Yes | |
CP_HiddenItemsIndex | integer | No | |
CP_Item | item | No | |
CP_PointIsWalkable | boolean | No | |
CP_Rect | rect | No | |
CreepWave | unitcode | Yes | |
DuelGroupAlpha | group | No | |
DuelGroupOmega | group | No | |
EC_Ability | abilcode | No | |
EC_AbilityCL | abilcode | No | |
EC_AbilityLvl | integer | Yes | |
EC_Attach_SFXCaster | string | No | |
EC_AttackType | attacktype | No | |
EC_Caster | unit | Yes | |
EC_CasterLoc | location | Yes | |
EC_CLAmount | integer | Yes | |
EC_CLAoE | real | No | |
EC_CLCounter | real | Yes | |
EC_CLGroup | group | No | |
EC_CLInterval | real | No | |
EC_CounterDuration | real | Yes | |
EC_Damage | real | Yes | |
EC_DamageType | damagetype | No | |
EC_Dummy | unitcode | No | |
EC_DummyUnit | unit | No | |
EC_Duration | real | Yes | |
EC_Effect | unit | Yes | |
EC_IndexMax | integer | No | |
EC_KBAoE | real | No | |
EC_KBDistance | real | No | |
EC_KBSFX | string | No | |
EC_KBTime | real | No | |
EC_LoopInt | integervar | No | |
EC_NodeNext | integer | Yes | |
EC_NodePrev | integer | Yes | |
EC_Order_ID | string | No | |
EC_Owner | player | Yes | |
EC_PeriodicTimer | real | No | |
EC_RecycledSize | integer | No | |
EC_RecycledStack | integer | Yes | |
EC_SFX | effect | Yes | |
EC_SFX_Loop | effect | Yes | |
EC_SFXCaster | string | No | |
EC_SFXHeight | real | No | |
EC_SFXOverhead | string | No | |
EC_SFXSize | real | No | |
EC_SFXStart | string | No | |
EC_SizeSFX | real | No | |
EC_Spell_ID | integer | No | |
EC_SpellCount | integer | No | |
EC_Targets | group | No | |
EC_TempLoc | location | No | |
EC_TempUnit | unit | No | |
Gamescore | multiboard | No | |
HeroGroupAlpha | group | No | |
HeroGroupKhael | group | No | |
HeroGroupOmega | group | No | |
herotype | unitcode | Yes | |
i | integer | No | |
iconstring | string | Yes | |
Increment_var | integer | No | |
Instagator | player | No | |
IsUnitBeingKnockedBack | boolean | Yes | |
K2DAmphibious | boolean | Yes | |
K2DAngle | real | Yes | |
K2DBounce | boolean | Yes | |
K2DCollision | real | Yes | |
K2DCos | real | Yes | |
K2DCosD1 | real | Yes | |
K2DCosD2 | real | Yes | |
K2DCosH | real | Yes | |
K2DDebrisKiller | unit | No | |
K2DDestRadius | real | Yes | |
K2DDistanceLeft | real | Yes | |
K2DFlying | boolean | Yes | |
K2DFreeze | boolean | Yes | |
K2DFriction | real | Yes | |
K2DFXModel | string | Yes | |
K2DFXRate | real | Yes | |
K2DFXTimeLeft | real | Yes | |
K2DHeight | real | Yes | |
K2DHeightThreshold | real | Yes | |
K2DImpact | trigger | Yes | |
K2DItem | item | No | |
K2DItemOffset | boolean | No | |
K2DItemsFound | boolean | No | |
K2DKillTrees | boolean | Yes | |
K2DLastX | real | Yes | |
K2DLastY | real | Yes | |
K2DMaxDestRadius | real | No | |
K2DMaxX | real | No | |
K2DMaxY | real | No | |
K2DMinX | real | No | |
K2DMinY | real | No | |
K2DNext | integer | Yes | |
K2DOverride | boolean | Yes | |
K2DPause | boolean | Yes | |
K2DPrev | integer | Yes | |
K2DRadius | integer | Yes | |
K2DRegion | rect | No | |
K2DSimple | boolean | Yes | |
K2DSin | real | Yes | |
K2DSinD1 | real | Yes | |
K2DSinD2 | real | Yes | |
K2DSinH | real | Yes | |
K2DSource | unit | Yes | |
K2DTimeLeft | real | Yes | |
K2DTimeout | real | No | |
K2DTimer | timer | No | |
K2DUnbiasedCollision | boolean | Yes | |
K2DVelocity | real | Yes | |
K2DX | real | No | |
K2DY | real | No | |
KB3D_Accel | real | No | |
KB3D_AllowOutSiding | boolean | No | |
KB3D_Angle | real | No | |
KB3D_AoE | real | No | |
KB3D_AoEDamage | real | No | |
KB3D_AoEEndDamage | real | No | |
KB3D_AoEEndFx | string | No | |
KB3D_AoEKB | boolean | No | |
KB3D_AoEKB_Power | real | No | |
KB3D_Arc | real | No | |
KB3D_Attach | string | No | |
KB3D_AttackType | attacktype | No | |
KB3D_B | boolean | No | |
KB3D_Bounce_Fx | string | No | |
KB3D_Bounce_Power | real | No | |
KB3D_Bounce_Target | boolean | No | |
KB3D_Bounce_Unit | boolean | No | |
KB3D_Counter | integer | No | |
KB3D_D_ALLY | boolean | No | |
KB3D_D_ENEMY | boolean | No | |
KB3D_D_FLYING | boolean | No | |
KB3D_D_MAGIC_IMMINUE | boolean | No | |
KB3D_D_MECHANICAL | boolean | No | |
KB3D_D_RESISTANT | boolean | No | |
KB3D_D_STRUCTURE | boolean | No | |
KB3D_Damager | unit | No | |
KB3D_DamageType | damagetype | No | |
KB3D_DestroyDestructables | boolean | No | |
KB3D_DestroyTree | boolean | No | |
KB3D_DisableUnit | boolean | No | |
KB3D_EndFx | string | No | |
KB3D_EndOnObstacle | boolean | No | |
KB3D_EndOnTargetBounce | boolean | No | |
KB3D_EndTrigger | trigger | No | |
KB3D_EndwhenDead | boolean | No | |
KB3D_EndWhenHit | boolean | No | |
KB3D_FaceAngle | boolean | No | |
KB3D_Fx | string | No | |
KB3D_Fx_Attach | string | No | |
KB3D_g | group | No | |
KB3D_GroundDamage | boolean | No | |
KB3D_HA | hashtable | No | |
KB3D_Harvester | unit | No | |
KB3D_HomingMissile | boolean | No | |
KB3D_iKB | boolean | No | |
KB3D_ImpactDamage | real | No | |
KB3D_Instances | integer | No | |
KB3D_JumpOverCliff | boolean | No | |
KB3D_KBTarget | boolean | No | |
KB3D_KillatEnd | boolean | No | |
KB3D_KillatTime | real | No | |
KB3D_KillifOutSider | boolean | No | |
KB3D_KillWhenHit | boolean | No | |
KB3D_Line_Fx | string | No | |
KB3D_LineDamage | real | No | |
KB3D_LoopDamage | real | No | |
KB3D_Range | real | No | |
KB3D_Reals | real | Yes | |
KB3D_Registration | trigger | No | |
KB3D_Speed | real | No | |
KB3D_Speed_Changer | boolean | No | |
KB3D_StopTime | real | No | |
KB3D_TargetDamage | real | No | |
KB3D_Targeted_Unit | unit | No | |
KB3D_Time | real | No | |
KB3D_Timer | timer | No | |
KB3D_TrailFx | string | No | |
KB3D_Unit | unit | No | |
KB3D_UnpathableStop | boolean | No | |
KB3D_Zoffset | real | No | |
Kill2 | integer | No | |
Kill3 | integer | No | |
Kill4 | integer | No | |
Kill5 | integer | No | |
Kill6 | integer | No | |
Kill7 | integer | No | |
Kill8 | integer | No | |
Kill9 | integer | No | |
KillAlpha | integer | No | 0 |
KillOmega | integer | No | 0 |
Knockback2DAmphibious | boolean | No | |
Knockback2DAngle | real | No | |
Knockback2DBounces | boolean | No | |
Knockback2DCollision | real | No | |
Knockback2DDefaultBounce | boolean | No | |
Knockback2DDefaultDestRadius | real | No | |
Knockback2DDefaultFriction | real | No | |
Knockback2DDefaultFX | string | No | |
Knockback2DDefaultFXRate | real | No | |
Knockback2DDefaultGravity | real | No | |
Knockback2DDefaultKillTrees | boolean | No | |
Knockback2DDefaultPause | boolean | No | |
Knockback2DDestRadius | real | No | |
Knockback2DDistance | real | No | |
Knockback2DFriction | real | No | |
Knockback2DFXRate | real | No | |
Knockback2DGravity | real | No | |
Knockback2DHeight | real | No | |
Knockback2DKillTrees | boolean | No | |
Knockback2DLoopFX | string | No | |
Knockback2DOnImpact | trigger | No | |
Knockback2DOverride | boolean | No | |
Knockback2DPause | boolean | No | |
Knockback2DRobustPathing | integer | No | |
Knockback2DSimple | boolean | No | |
Knockback2DSource | unit | No | |
Knockback2DTime | real | No | |
Knockback2DTreeOrDebris | string | No | |
Knockback2DUnbiasedCollision | boolean | No | |
Knockback2DUnit | unit | No | |
Level1 | integer | No | 1 |
Level2 | integer | No | 1 |
Level3 | integer | No | 1 |
Level4 | integer | No | 1 |
Level5 | integer | No | 1 |
Level6 | integer | No | 1 |
Level7 | integer | No | 1 |
Level8 | integer | No | 1 |
Level_var | integer | No | |
Location1 | location | No | |
Location2 | location | No | |
LoopInt | integer | No | |
PlayerGroupAlpha | force | No | |
PlayerGroupOmega | force | No | |
Radians_QuarterPi | real | No | |
Radians_QuarterTurn | real | No | |
Radians_Turn | real | No | |
RH_Ability | abilcode | No | |
RH_AbilityMaxLevel | integer | No | |
RH_AttackType | attacktype | No | |
RH_Caster | unit | Yes | |
RH_CasterPlayer | player | Yes | |
RH_CasterX | real | Yes | |
RH_CasterY | real | Yes | |
RH_ChannelDuration | real | Yes | |
RH_ChannelDurationCounter | real | Yes | |
RH_ChannelOrder | string | No | |
RH_CustomInteger | integervar | No | |
RH_CustomLocation | location | No | |
RH_CustomReal | real | Yes | |
RH_CustomReal2 | real | Yes | |
RH_DamageType | damagetype | No | |
RH_DestroyTrees | boolean | No | |
RH_DummyPlayerColor | boolean | No | |
RH_DummyType | unitcode | No | |
RH_Effect | string | Yes | |
RH_EffectAttach | string | Yes | |
RH_EffectCount | integer | No | |
RH_Group | group | No | |
RH_HammerCollisionSize | real | Yes | |
RH_HammerCount | integer | Yes | |
RH_HammerCustomBoolean | boolean | Yes | |
RH_HammerHeight | real | Yes | |
RH_HammerHitDamage | real | Yes | |
RH_HammerHitKnockback | boolean | No | |
RH_HammerModelHandler | effect | Yes | |
RH_HammerMotionEffectChance | integer | No | |
RH_HammerRevolve | boolean | Yes | |
RH_HammerRevolveAngle | real | Yes | |
RH_HammerRevolveAngleSpeed | real | Yes | |
RH_HammerRotate | boolean | No | |
RH_HammerSize | real | Yes | |
RH_HammerSpreadAngle | real | Yes | |
RH_HammerSpreadDistance | real | Yes | |
RH_HammerSpreadDistanceCounter | real | Yes | |
RH_HammerSpreadSpeed | real | Yes | |
RH_HammerTrailHandler | effect | Yes | |
RH_HammerUnit | unit | No | |
RH_ID | integer | No | |
RH_KB_Acceleration | real | No | |
RH_KB_DestroyTrees | boolean | No | |
RH_KB_OnCast | boolean | No | |
RH_KB_OnCastAcceleration | real | No | |
RH_KB_OnCastRange | real | No | |
RH_KB_OnCastSpeed | real | No | |
RH_KB_Range | real | No | |
RH_KB_Speed | real | No | |
RH_KB_Unit | unit | No | |
RH_Level | integer | Yes | |
RH_LoopInterval | real | No | |
RH_Map | real | Yes | |
RH_TreeChecker | unit | No | |
RH_Trees | destructable | No | |
RH_Unit | unit | No | |
TargetUnit | unit | No | |
TempInt | integer | No | |
TempReal | real | No | |
UDex | integer | No | |
UDexGen | integer | No | |
UDexNext | integer | Yes | |
UDexPrev | integer | Yes | |
UDexRecycle | integer | No | |
UDexUnits | unit | Yes | |
UDexWasted | integer | No | |
Unit_Integer | integer | Yes | |
UnitIndexerEnabled | boolean | No | |
UnitIndexEvent | real | No |
//TESH.scrollpos=0
//TESH.alwaysfold=1
/////////////////////////////////////////////////////////////////////////////
// //
// Knock-Back 3D [JASS - GUI] //
// Multi-Movement System 3D //
// by Jad aka DotCa //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// System's Hidden Features: //
// //
// 1. To know if a unit is being KBed by the System, Use: //
// - LoadBoolean(udg_KB3D_HA, GetHandleId(Unit), GetHandleId(Unit)) //
// True means that the unit is being KBed, also works in GUI //
// 2. Use udg_KB3D_Time variable after registring the KB to actually //
// know how much the KB will last, NOTE that this the time may //
// varry if you have a Homing KB (using KB3D_Targeted_Unit) //
// 3. Some Variables in the System has default values, but useful; //
// in Example, "udg_KB3D_Attach" is "origin" even without setting //
// it, so you won't need to change it before Registering a KB //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// System Informations: //
// //
// The System is a well performing, ultra-purpose knockback (see uses //
// below ) Coded in JASS making it possible for all users to take //
// advantage of it, and GUI friendly to use, see Examples in the triggers //
// above //
// Configurations that have default values: //
// //
// - KB3D_EndWhenDead ==> TRUE by default //
// - KB3D_UnpathableStop ==> TRUE by default //
// - KB3D_iKB ==> TRUE by default //
// - KB3D_D_ENEMY ==> TRUE by default //
// - KB3D_DestroyTree ==> TRUE by default //
// - KB3D_AttackType ==> ATTACK_TYPE_NORMAL by default //
// - KB3D_DamageType ==> DAMAGE_TYPE_MAGIC by default //
// - KB3D_AoEKB_Power ==> 1.00 by default //
// - KB3D_Attach ==> "origin" by default //
// - Other Booleans ==> FALSE by default //
// //
// The System also uses Always positive values for some configurations //
// to not make the knockback go wrong, those configurations are: //
// //
// "KB3D_Range" - "KB3D_Speed" - "KB3D_ZOffset" - "KB3D_AoE" //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// HomingMissile, Accessibility feature //
// //
// When true, there will be no need to set the range and some other //
// features, since they will be automatically set to fit a homing //
// missile: //
// - KB3D_Zoffset - KB3D_Range - KB3D_KillatEnd - KB3D_EndWhenHit - //
// - KB3D_FaceAngle - KB3D_UnpathableStop - KB3D_KillWhenHit - //
// //
// This feature allows to skip the configurations of some features //
// needed for a homing missile, Note that Targeted_Unit needs to be set //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// iKB, intelligent KB informations: //
// //
// iKB, makes some features in KB3D act intelligently, those features: //
// //
// -Range: usually always positive, it will be available in negative //
// values, it will, if negative, flip the Angle (+180 d) //
// -Speed: usually always positive, it will be available in negative //
// values, it will act normally, just the KBed unit will //
// move backward if the current speed is negative //
// -Height: usually always positive, it will be available in negative//
// values, it will, if negative, make the unit go down //
// instead of up //
// -Damages: //
// AoEEndDamage, AoEDamage, LineDamage, ImpactDamage, TargetDamage //
// //
// All those values ^ will turn intelligent, by this, it means //
// that if the Target of the Damage is not in approximated //
// height (Z) of the KBed Unit, the damage won't occur //
// -AoEKB, usually KBs all units in the AoE, it will choose only //
// Units that are close to it by the height, Z offset //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// System Requirements: Basic WE - (NONE) //
// //
// The System uses implemented CheckWalkability System by PurgeandFire //
// You "can" remove the initialization trigger of PnF's System since //
// it is directly implemented in the System, all will work fine with or //
// without removing your Initializer trigger //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// Credits: //
// //
// *WEHZ & TS Helpers Group for helping in Script Fixes //
// *Barry the Moose for helping in main codes and fixes //
// *PurgeandFire for his CheckWalkability System //
// *Vexorian / Nestharus for the GetCollision function //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// How to Import? //
// //
// 1. Check that Create Unknown Variables is ticked in your WE Settings //
// 2. Copy the Paste the Knock-Back 3D Folder //
// 3. Delete the Variable Creator Trigger and learn how to use the System //
// by reading the documentation in the 2 Features Triggers (GUI - JASS)//
// Congratulations, the System is now implemented in your map //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// How to Use? //
// //
// 1. There are many Examples of use in the KB3D Example Folder //
// 2. Documentations are there in the Features Triggers to help you //
// 3. The KB3D System is an Ultra-Purpose System where you can use it for://
// -Projectiles, the system supports homing so a projectile is easy //
// -Jump, the System's smoothness in the fly is useful for a jump spell//
// -And of course, a 2D Knock-Back //
// -And More depending on your imagination //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// Bug Reports - Feedbacks //
// //
// * We count on you to report bugs in the system, also telling the source//
// * Feedbacks about the system are much appreciated //
// * We mostly hope suggestions about enhancements for the System //
// //
/////////////////////////////////////////////////////////////////////////////
function KB3D_AlwaysNeg takes real R returns real
if R > 0 then
return -R
endif
return R
endfunction
function KB3D_InBetween takes real Min, real R, real Max returns real
return RMaxBJ(RMinBJ(R, Max), Min)
endfunction
function KB3D_IsInBetween takes real Min, real R, real Max returns boolean
return R > Min and R < Max
endfunction
function KB3D_CW_Loop takes nothing returns nothing
if IsItemVisible(GetEnumItem()) then
set udg_CP_HiddenItems[udg_CP_HiddenItemsIndex] = GetEnumItem()
call SetItemVisible(udg_CP_HiddenItems[udg_CP_HiddenItemsIndex], false)
set udg_CP_HiddenItemsIndex = ( udg_CP_HiddenItemsIndex + 1 )
endif
endfunction
function KB3D_CW takes real x, real y returns boolean
local real x2 = 0
local real y2 = 0
//---------------------------
call MoveRectTo(udg_CP_Rect, x, y)
call EnumItemsInRect(udg_CP_Rect, null, function KB3D_CW_Loop )
call SetItemPosition(udg_CP_Item, x, y)
set x2 = GetItemX(udg_CP_Item)
set y2 = GetItemY(udg_CP_Item)
call SetItemVisible(udg_CP_Item, false)
//---------------------------
loop
exitwhen udg_CP_HiddenItemsIndex == 0
set udg_CP_HiddenItemsIndex = udg_CP_HiddenItemsIndex - 1
call SetItemVisible(udg_CP_HiddenItems[udg_CP_HiddenItemsIndex], true)
set udg_CP_HiddenItems[udg_CP_HiddenItemsIndex] = null
endloop
//---------------------------
return (((x2-x)*(x2-x) + (y2-y)*(y2-y) <= 75) and (not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)))
endfunction
function KB3D_GetCoordinatesZ takes real x, real y returns real
local location L = Location(x,y)
local real r = GetLocationZ(L)
call RemoveLocation(L)
set L = null
return r
endfunction
function KB3D_Approx takes unit U, unit U2, integer Loop returns boolean
local real r = KB3D_InBetween(50, LoadReal(udg_KB3D_HA, 29, Loop) / 2, 1000)
local real r1 = GetUnitFlyHeight(U2)
//---------------------------
return KB3D_IsInBetween(r1-r, GetUnitFlyHeight(U), r1+r)
endfunction
function KB3D_Filter takes unit U, unit U1, integer Loop returns boolean
if not IsUnitType(U, UNIT_TYPE_DEAD) then
//---------------------------
if not(LoadBoolean(udg_KB3D_HA, 48, Loop)) and ( IsUnitType(U, UNIT_TYPE_STRUCTURE)) then
return false
elseif not((LoadBoolean(udg_KB3D_HA, 48, Loop)) and ( IsUnitType(U, UNIT_TYPE_STRUCTURE))) then
if not(LoadBoolean(udg_KB3D_HA, 49, Loop)) and ( IsUnitType(U, UNIT_TYPE_MECHANICAL)) then
return false
endif
endif
//---------------------------
if not(LoadBoolean(udg_KB3D_HA, 50, Loop)) and ( IsUnitType(U, UNIT_TYPE_MAGIC_IMMUNE)) then
return false
endif
//---------------------------
if not(LoadBoolean(udg_KB3D_HA, 51, Loop)) and ( IsUnitAlly(U, GetOwningPlayer(U1))) then
return false
endif
//---------------------------
if not(LoadBoolean(udg_KB3D_HA, 63, Loop)) and ( IsUnitEnemy(U, GetOwningPlayer(U1))) then
return false
endif
//---------------------------
if not(LoadBoolean(udg_KB3D_HA, 64, Loop)) and ( IsUnitType(U, UNIT_TYPE_RESISTANT)) then
return false
endif
//---------------------------
if not(LoadBoolean(udg_KB3D_HA, 65, Loop)) and ( IsUnitType(U, UNIT_TYPE_FLYING)) then
return false
endif
//---------------------------
return true
endif
//---------------------------
return false
endfunction
function KB3D_RegisterUnitCollision takes unit u, real x, real y, integer i returns real
local real l = 0
local real h = 300
local real m = 150
local real nm
//---------------------------
loop
if (IsUnitInRangeXY(u, x+m, y, 0)) then
set l = m
else
set h = m
endif
set nm = (l+h)/2
exitwhen nm+.001 > m and nm-.001 < m
set m = nm
endloop
//---------------------------
set m = R2I(m*10)/10.
call SaveReal( udg_KB3D_HA, 16, GetUnitTypeId(u), m )
//---------------------------
return m
endfunction
function KB3D_GetUnitCollision takes unit u returns real
local integer i = GetUnitTypeId(u)
//---------------------------
if HaveSavedReal( udg_KB3D_HA, 16, i) then
return LoadReal(udg_KB3D_HA, 16, i)
endif
//---------------------------
return KB3D_RegisterUnitCollision(u, GetUnitX(u), GetUnitY(u), i)
endfunction
function KB3D_Tree_Check takes destructable D returns boolean
return IssueTargetOrderById( udg_KB3D_Harvester, 852018, D ) and IssueImmediateOrderById(udg_KB3D_Harvester, 851972)
endfunction
function KB3D_KillEnumDest takes nothing returns nothing
local destructable D = GetEnumDestructable()
//---------------------------
if GetDestructableLife(D)>0 and ( KB3D_Tree_Check(D) ) and (GetUnitFlyHeight(LoadUnitHandle(udg_KB3D_HA, 0, R2I(udg_KB3D_Reals[0]))) < GetDestructableOccluderHeight(D)) and LoadBoolean(udg_KB3D_HA, 8, R2I(udg_KB3D_Reals[0])) then
call KillDestructable(D)
elseif not(KB3D_CW(GetDestructableX(D),GetDestructableY(D))) and GetDestructableLife(D)>0 and IssueImmediateOrderById(udg_KB3D_Harvester, 851972) and LoadBoolean(udg_KB3D_HA, 56, R2I(udg_KB3D_Reals[0])) then
call KillDestructable(D)
endif
set D = null
endfunction
function KB3D_CircleTreeKill takes real radius, real x, real y returns nothing
local rect r = Rect(x-radius, y-radius, x+radius, y+radius)
//---------------------------
call EnumDestructablesInRect(r, null, function KB3D_KillEnumDest)
//---------------------------
call RemoveRect(r)
set r = null
endfunction
function KB3D_BounceOnUnit takes unit u, unit U, integer Loop returns nothing
set udg_KB3D_Angle = (Atan2(GetUnitY(u) - GetUnitY(U), GetUnitX(u) - GetUnitX(U)) *57.29578) + GetRandomReal(-15,15)
set udg_KB3D_Speed = LoadReal(udg_KB3D_HA, 2, Loop)/.03125*.25*udg_KB3D_Bounce_Power
set udg_KB3D_DestroyTree = LoadBoolean(udg_KB3D_HA, 8, Loop)
set udg_KB3D_Fx = LoadStr(udg_KB3D_HA, 9, Loop)
set udg_KB3D_Attach = LoadStr(udg_KB3D_HA, 10, Loop)
set udg_KB3D_Range = 1.5*udg_KB3D_Speed*udg_KB3D_Bounce_Power
set udg_KB3D_Unit = u
set udg_KB3D_Bounce_Fx = LoadStr(udg_KB3D_HA, 62, Loop)
set udg_KB3D_Accel = -udg_KB3D_Speed*.6
set udg_KB3D_Bounce_Unit = true
call TriggerEvaluate(udg_KB3D_Registration)
call SaveEffectHandle(udg_KB3D_HA, 14, udg_KB3D_Counter, LoadEffectHandle(udg_KB3D_HA, 14, Loop))
endfunction
function KB3D_Bounce_Filter takes nothing returns boolean
local boolean b = not(IsUnitInGroup(GetFilterUnit(), LoadGroupHandle(udg_KB3D_HA, 68, R2I(udg_KB3D_Reals[0])))) or KB3D_Filter(LoadUnitHandle(udg_KB3D_HA, 0, R2I(udg_KB3D_Reals[0])),LoadUnitHandle(udg_KB3D_HA, 0, R2I(udg_KB3D_Reals[0])),R2I(udg_KB3D_Reals[0]))
if b then
call GroupAddUnit(LoadGroupHandle(udg_KB3D_HA, 68, R2I(udg_KB3D_Reals[0])), GetFilterUnit())
endif
return b
endfunction
function KB3D_FilterGrp takes nothing returns boolean
return KB3D_Filter(GetFilterUnit(), LoadUnitHandle(udg_KB3D_HA, 0, R2I(udg_KB3D_Reals[0])),R2I(udg_KB3D_Reals[0]))
endfunction
function KB3D_ClearInstance takes integer i returns nothing
local integer x = 0
//---------------------------
call DestroyGroup(LoadGroupHandle(udg_KB3D_HA, 27, i))
call DestroyGroup(LoadGroupHandle(udg_KB3D_HA, 67, i))
//---------------------------
loop
exitwhen x > 100
call RemoveSavedHandle(udg_KB3D_HA, x, i)
call SaveReal(udg_KB3D_HA, x, i, 0)
set x = x +1
endloop
endfunction
function KB3D_isPossiblePathability takes real x, real y, real RADangle, real MaxDist returns boolean
local real X = x
local real Y = y
local real max = RAbsBJ(MaxDist)
local real dist = max
//---------------------------
loop
exitwhen (dist <= 0)
set dist = dist - max/300
set X = x + ( dist * Cos(RADangle) )
set Y = y + ( dist * Sin(RADangle) )
if KB3D_CW(X,Y) then
return true
endif
endloop
//---------------------------
return false
endfunction
function MoveUnit_3D takes unit U, real x, real y, real z, real MaxZ, boolean P, boolean OS, boolean KiOS, real Angle, real S, real time, integer Loop returns boolean
local boolean B = false
local boolean b = true
local real tz
// This is a creepy place for those who doesn't anylize the system wisely
if LoadBoolean(udg_KB3D_HA, 57, Loop) then
if LoadBoolean(udg_KB3D_HA, 44, Loop) then
set tz = KB3D_GetCoordinatesZ(x,y) - LoadReal(udg_KB3D_HA, 68, Loop)
set z = z - tz
call SaveReal(udg_KB3D_HA, 68, Loop, KB3D_GetCoordinatesZ(x,y))
if LoadReal(udg_KB3D_HA, 3, Loop)<0 and GetUnitDefaultFlyHeight(U)<z then
call SetUnitFlyHeight(U, KB3D_InBetween(-999,z,GetUnitDefaultFlyHeight(U)), 0)
else
call SetUnitFlyHeight(U, z, 0)
endif
else
call SetUnitFlyHeight(U, KB3D_InBetween(GetUnitDefaultFlyHeight(U), z, 9999), 0)
endif
endif
//---------------------------
if ( not(P) or ( KB3D_CW(x, y) ) ) then
set B = true
if (OS) then
call SetUnitX(U, KB3D_InBetween(udg_KB3D_Reals[6], x, udg_KB3D_Reals[5]))
call SetUnitY(U, KB3D_InBetween(udg_KB3D_Reals[8], y, udg_KB3D_Reals[7]))
set b = false
if (KiOS) and (not(KB3D_IsInBetween(udg_KB3D_Reals[2], x, udg_KB3D_Reals[1])) or not(KB3D_IsInBetween(udg_KB3D_Reals[4], x, udg_KB3D_Reals[3]))) then
call KillUnit(U)
endif
else
call SetUnitX(U, KB3D_InBetween(udg_KB3D_Reals[2], x, udg_KB3D_Reals[1]))
call SetUnitY(U, KB3D_InBetween(udg_KB3D_Reals[4], y, udg_KB3D_Reals[3]))
set b = false
endif
elseif LoadBoolean(udg_KB3D_HA, 52, Loop) and P and not(KB3D_CW(x, y)) then
if GetUnitFlyHeight(U) != 0 then
if KB3D_isPossiblePathability(GetUnitX(U),GetUnitY(U), Angle, S*time/0.03125) and LoadBoolean(udg_KB3D_HA, 44, Loop) then
set B = true
call SaveBoolean(udg_KB3D_HA, 53, Loop, true)
if (OS) then
call SetUnitX(U, KB3D_InBetween(udg_KB3D_Reals[6], x, udg_KB3D_Reals[5]))
call SetUnitY(U, KB3D_InBetween(udg_KB3D_Reals[8], y, udg_KB3D_Reals[7]))
set b = false
if (KiOS) and (not(KB3D_IsInBetween(udg_KB3D_Reals[2], x, udg_KB3D_Reals[1])) or not(KB3D_IsInBetween(udg_KB3D_Reals[4], x, udg_KB3D_Reals[3]))) then
call KillUnit(U)
endif
else
call SetUnitX(U, KB3D_InBetween(udg_KB3D_Reals[2], x, udg_KB3D_Reals[1]))
call SetUnitY(U, KB3D_InBetween(udg_KB3D_Reals[4], y, udg_KB3D_Reals[3]))
set b = false
endif
else
call SaveBoolean(udg_KB3D_HA, 52, Loop, false)
endif
endif
endif
if b then
set udg_KB3D_B = true
if LoadBoolean(udg_KB3D_HA, 66, Loop) then
return true
endif
endif
return false
endfunction
function KB3D_LineDamageLoop takes unit U, group g returns nothing
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
local attacktype AType = ConvertAttackType(LoadInteger(udg_KB3D_HA, 20, Loop))
local damagetype DType = ConvertDamageType(LoadInteger(udg_KB3D_HA, 21, Loop))
local real LineD = LoadReal(udg_KB3D_HA, 28, Loop)
local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
local group G = LoadGroupHandle(udg_KB3D_HA, 27, Loop)
//---------------------------
if KB3D_Filter(U, U1, Loop) and not ( IsUnitInGroup(U, G) ) then
call GroupAddUnit(G, U)
if not(LoadBoolean(udg_KB3D_HA, 44, Loop)) then
call UnitDamageTarget(Damager, U, LineD, true, false, AType, DType, null)
call DestroyEffect(AddSpecialEffectTarget(LoadStr(udg_KB3D_HA, 58, Loop), U, LoadStr(udg_KB3D_HA, 10, Loop)))
elseif KB3D_Approx(U, U1, Loop) then
call UnitDamageTarget(Damager, U, LineD, true, false, AType, DType, null)
call DestroyEffect(AddSpecialEffectTarget(LoadStr(udg_KB3D_HA, 58, Loop), U, LoadStr(udg_KB3D_HA, 10, Loop)))
endif
endif
//---------------------------
set G = null
set U1 = null
set Damager = null
set AType = null
set DType = null
endfunction
function KB3D_AoEDamageLoop takes unit U, group g returns nothing
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
local attacktype AType = ConvertAttackType(LoadInteger(udg_KB3D_HA, 20, Loop))
local damagetype DType = ConvertDamageType(LoadInteger(udg_KB3D_HA, 21, Loop))
local real AoED = LoadReal(udg_KB3D_HA, 32, Loop)
local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
//---------------------------
if KB3D_Filter(U, U1, Loop) then
if not(LoadBoolean(udg_KB3D_HA, 44, Loop)) then
call UnitDamageTarget(Damager, U, AoED * 0.031250000, true, false, AType, DType, null)
elseif KB3D_Approx(U, U1, Loop) then
call UnitDamageTarget(Damager, U, AoED * 0.031250000, true, false, AType, DType, null)
endif
endif
//---------------------------
set U1 = null
set Damager = null
set AType = null
set DType = null
endfunction
function KB3D_AoEEndDamage takes unit U, group g returns nothing
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
local attacktype AType = ConvertAttackType(LoadInteger(udg_KB3D_HA, 20, Loop))
local damagetype DType = ConvertDamageType(LoadInteger(udg_KB3D_HA, 21, Loop))
local real D = LoadReal(udg_KB3D_HA, 38, Loop)
local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
//---------------------------
if KB3D_Filter(U, U1, Loop) then
if not(LoadBoolean(udg_KB3D_HA, 44, Loop)) then
call UnitDamageTarget(Damager, U, D, true, false, AType, DType, null)
elseif KB3D_Approx(U, U1, Loop) then
call UnitDamageTarget(Damager, U, D, true, false, AType, DType, null)
endif
endif
//---------------------------
call GroupRemoveUnit(g, U)
//---------------------------
set U1 = null
set Damager = null
set AType = null
set DType = null
endfunction
function KB3D_GiveKBto takes unit U1, unit U2, integer Loop returns nothing
set udg_KB3D_AoEEndDamage = LoadReal(udg_KB3D_HA, 38, Loop)
set udg_KB3D_EndwhenDead = LoadBoolean(udg_KB3D_HA, 35, Loop)
set udg_KB3D_Speed = LoadReal(udg_KB3D_HA, 2, Loop)/0.031250000*.5
set udg_KB3D_Accel = -udg_KB3D_Speed
set udg_KB3D_AllowOutSiding = LoadBoolean(udg_KB3D_HA, 34, Loop)
set udg_KB3D_Angle = (LoadReal(udg_KB3D_HA, 5, Loop)*180/3.14159)
set udg_KB3D_AoE = LoadReal(udg_KB3D_HA, 29, Loop)
set udg_KB3D_AoEDamage = LoadReal(udg_KB3D_HA, 32, Loop)
set udg_KB3D_AttackType = ConvertAttackType(LoadInteger(udg_KB3D_HA, 20, Loop))
set udg_KB3D_DamageType = ConvertDamageType(LoadInteger(udg_KB3D_HA, 21, Loop))
set udg_KB3D_Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
set udg_KB3D_DestroyTree = LoadBoolean(udg_KB3D_HA, 8, Loop)
set udg_KB3D_DisableUnit = LoadBoolean(udg_KB3D_HA, 6, Loop)
set udg_KB3D_FaceAngle = LoadBoolean(udg_KB3D_HA, 31, Loop)
set udg_KB3D_Fx = LoadStr(udg_KB3D_HA, 9, Loop)
set udg_KB3D_Attach = LoadStr(udg_KB3D_HA, 10, Loop)
set udg_KB3D_ImpactDamage = LoadReal(udg_KB3D_HA, 17, Loop)
set udg_KB3D_LineDamage = LoadReal(udg_KB3D_HA, 28, Loop)
set udg_KB3D_LoopDamage = LoadReal(udg_KB3D_HA, 18, Loop)/0.031250000
set udg_KB3D_Range = 99999
set udg_KB3D_Unit = U1
if LoadBoolean(udg_KB3D_HA, 57, Loop) then
set udg_KB3D_Zoffset = LoadReal(udg_KB3D_HA, 3, Loop)/1.85 - GetUnitDefaultFlyHeight(U2)
endif
//---------------------------
call TriggerEvaluate( udg_KB3D_Registration )
endfunction
function KB3D_AoEGiveKBto takes unit U1, unit U2, integer Loop returns nothing
local real x1 = GetUnitX(U1)
local real y1 = GetUnitY(U1)
local real x2 = GetUnitX(U2)
local real y2 = GetUnitY(U2)
local real P = LoadReal(udg_KB3D_HA, 43, Loop)
//---------------------------
set udg_KB3D_AoE = LoadReal(udg_KB3D_HA, 29, Loop)
set udg_KB3D_EndwhenDead = LoadBoolean(udg_KB3D_HA, 35, Loop)
set udg_KB3D_Accel = -550*P
set udg_KB3D_AllowOutSiding = LoadBoolean(udg_KB3D_HA, 34, Loop)
set udg_KB3D_Angle = Atan2(y1 - y2, x1 - x2)*180/3.14159
set udg_KB3D_AoEDamage = LoadReal(udg_KB3D_HA, 32, Loop)
set udg_KB3D_AttackType = ConvertAttackType(LoadInteger(udg_KB3D_HA, 20, Loop))
set udg_KB3D_DamageType = ConvertDamageType(LoadInteger(udg_KB3D_HA, 21, Loop))
set udg_KB3D_Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
set udg_KB3D_DestroyTree = LoadBoolean(udg_KB3D_HA, 8, Loop)
set udg_KB3D_DisableUnit = LoadBoolean(udg_KB3D_HA, 6, Loop)
set udg_KB3D_FaceAngle = LoadBoolean(udg_KB3D_HA, 31, Loop)
set udg_KB3D_Fx = LoadStr(udg_KB3D_HA, 9, Loop)
set udg_KB3D_Attach = LoadStr(udg_KB3D_HA, 10, Loop)
set udg_KB3D_ImpactDamage = LoadReal(udg_KB3D_HA, 17, Loop)
set udg_KB3D_LineDamage = LoadReal(udg_KB3D_HA, 28, Loop)
set udg_KB3D_LoopDamage = LoadReal(udg_KB3D_HA, 18, Loop)/0.031250000
set udg_KB3D_Speed = udg_KB3D_AoE*2*P
set udg_KB3D_Range = udg_KB3D_Speed*2
set udg_KB3D_Unit = U1
if LoadBoolean(udg_KB3D_HA, 57, Loop) then
set udg_KB3D_Zoffset = (udg_KB3D_AoE - SquareRoot(x2 * x1 + y2 * y1)*3.14159/180)*P
endif
//---------------------------
call TriggerEvaluate( udg_KB3D_Registration )
endfunction
function KB3D_AoEKB takes unit U, group g returns nothing
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
local real r
//---------------------------
if KB3D_Filter(U, U1, Loop) then
if not(LoadBoolean(udg_KB3D_HA, 44, Loop)) then
call KB3D_AoEGiveKBto(U, U1, Loop)
elseif KB3D_Approx(U, U1, Loop) then
call KB3D_AoEGiveKBto(U, U1, Loop)
endif
endif
//---------------------------
call GroupRemoveUnit(g, U)
//---------------------------
set U1 = null
endfunction
function KB3D_AoEEndFx takes unit U, string A, string F, group g returns nothing
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
local real x
local real y
//---------------------------
if KB3D_Filter(U, U1, Loop) and (U != null) then
if not(LoadBoolean(udg_KB3D_HA, 44, Loop)) then
if ( GetUnitFlyHeight(U) > 20 ) then
call DestroyEffect(AddSpecialEffectTarget(F, U, A))
else
set x = GetUnitX(U)
set y = GetUnitY(U)
call DestroyEffect(AddSpecialEffect(F, x, y))
endif
elseif KB3D_Approx(U, U1, Loop) then
if ( GetUnitFlyHeight(U) > 20 ) then
call DestroyEffect(AddSpecialEffectTarget(F, U, A))
else
set x = GetUnitX(U)
set y = GetUnitY(U)
call DestroyEffect(AddSpecialEffect(F, x, y))
endif
endif
endif
//---------------------------
call GroupRemoveUnit(g, U)
//---------------------------
set U1 = null
endfunction
function KB3D_Grpto takes nothing returns nothing
call GroupAddUnit(udg_KB3D_g, GetEnumUnit())
endfunction
function KB3D_Loop takes integer Loop returns nothing
//Create all the nessesary locals
local unit U = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
local real X = GetUnitX(U)
local real Y = GetUnitY(U)
local real Z = GetUnitFlyHeight(U)
local real x = X
local real y = Y
local real z = Z
local real Range = LoadReal(udg_KB3D_HA, 1, Loop)
local real Speed = LoadReal(udg_KB3D_HA, 2, Loop)
local real Zoffset = LoadReal(udg_KB3D_HA, 3, Loop)
local real Accel = LoadReal(udg_KB3D_HA, 4, Loop)
local real Angle
local real ZSpeed = LoadReal(udg_KB3D_HA, 12, Loop)
local real ZAccel = LoadReal(udg_KB3D_HA, 13, Loop)
local real ImpactD = LoadReal(udg_KB3D_HA, 17, Loop)
local real LoopD = LoadReal(udg_KB3D_HA, 18, Loop)
local real TargetD = LoadReal(udg_KB3D_HA, 19, Loop)
local real LineD = LoadReal(udg_KB3D_HA, 28, Loop)
local real AoE = LoadReal(udg_KB3D_HA, 29, Loop)
local real ZT = LoadReal(udg_KB3D_HA, 26, Loop)
local real AoED = LoadReal(udg_KB3D_HA, 32, Loop)
local real Time = LoadReal(udg_KB3D_HA, 41, Loop) + 0.031250000
local real KillatTime = LoadReal(udg_KB3D_HA, 36, Loop)
local real StopTime = LoadReal(udg_KB3D_HA, 37, Loop)
local real AoEEndDamage = LoadReal(udg_KB3D_HA, 38, Loop)
local unit Target = LoadUnitHandle(udg_KB3D_HA, 5, Loop)
local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
local unit u
local boolean DisableUnit = LoadBoolean(udg_KB3D_HA, 6, Loop)
local boolean UnpathableStop = LoadBoolean(udg_KB3D_HA, 7, Loop)
local boolean DestroyTree = LoadBoolean(udg_KB3D_HA, 8, Loop)
local boolean KillWhenHit = LoadBoolean(udg_KB3D_HA, 24, Loop)
local boolean EndWhenHit = LoadBoolean(udg_KB3D_HA, 25, Loop)
local boolean KiOS = LoadBoolean(udg_KB3D_HA, 33, Loop)
local boolean OS = LoadBoolean(udg_KB3D_HA, 34, Loop)
local boolean b = true
local boolean EndwhenDead = LoadBoolean(udg_KB3D_HA, 35, Loop)
local boolean KBTarget = LoadBoolean(udg_KB3D_HA, 39, Loop)
local boolean AoEKB = LoadBoolean(udg_KB3D_HA, 40, Loop)
local boolean KillatEnd = LoadBoolean(udg_KB3D_HA, 46, Loop)
local boolean GroundDamage = LoadBoolean(udg_KB3D_HA, 47, Loop)
local boolean EndB = false
local boolean EndOnObstacle = false
local string Fx = LoadStr(udg_KB3D_HA, 9, Loop)
local string Attach = LoadStr(udg_KB3D_HA, 10, Loop)
local string EndFx = LoadStr(udg_KB3D_HA, 42, Loop)
local string AoEEndFx = LoadStr(udg_KB3D_HA, 54, Loop)
local attacktype AType = ConvertAttackType(LoadInteger(udg_KB3D_HA, 20, Loop))
local damagetype DType = ConvertDamageType(LoadInteger(udg_KB3D_HA, 21, Loop))
local trigger EndT = LoadTriggerHandle(udg_KB3D_HA, 55, Loop)
//end of locals
//Loop Damage Execution
if LoopD != 0 and Damager != null then
call UnitDamageTarget(Damager, U, LoopD, true, false, AType, DType, null)
endif
//Calculate the Angle
if ( Target == null ) then
set Angle = LoadReal(udg_KB3D_HA, 5, Loop) + LoadReal(udg_KB3D_HA, 30, Loop)//if there is no unit target
else
set Angle = Atan2(GetUnitY(Target) - Y, GetUnitX(Target) - X)//if there is a unit target
endif
//
if LoadBoolean(udg_KB3D_HA, 16, Loop) then
set Angle = GetUnitFacing(U)*0.0174533
if LoadBoolean(udg_KB3D_HA, 44, Loop) then
if GetUnitCurrentOrder(U) != 851986 and GetUnitCurrentOrder(U) != 851971 then
set b = false
endif
else
set b = false
endif
endif
//Make Unit Face Angle
if LoadBoolean(udg_KB3D_HA, 31, Loop) then
call SetUnitFacing(U, Angle * 3.141592)
endif
//Calculate 3D coordinates
if b then
set Speed = Speed + ( Accel )//Increase the KB speed depending on the Acceleration
set Range = Range - ( RAbsBJ(Speed) )//Decrease distance traveled
set x = X + ( Speed * Cos(Angle) )//new X location of the KBed unit
set y = Y + ( Speed * Sin(Angle) )//new Y location of the KBed unit
set ZSpeed = ZSpeed + ( ZAccel )//change the fly changing rate //Acceleration is for smoothness
set z = Z + ( ZSpeed * 0.031250000 )//new Z Offset of the KBed unit
set ZT = ZT + ( ZSpeed * 0.031250000 )//Total Height Changings
endif
set b = false
if z >= Zoffset then
call SaveReal(udg_KB3D_HA, 12, Loop, -ZSpeed)
endif
//Destroy Trees around the Unit depending on the unit's Collision Size
if (DestroyTree) or (LoadBoolean(udg_KB3D_HA, 56, Loop)) then
set udg_KB3D_Reals[0] = I2R(Loop)
call KB3D_CircleTreeKill( KB3D_InBetween(150, 4.5 * KB3D_GetUnitCollision(U), 500), x, y )
endif
//Move the unit according to the X, Y, Z
set EndOnObstacle = MoveUnit_3D(U, x, y, z, Zoffset, UnpathableStop, OS, KiOS, Angle, Speed, LoadReal(udg_KB3D_HA, 11, Loop)-Time, Loop)
//Bounce on Point
if udg_KB3D_B and LoadBoolean(udg_KB3D_HA, 60, Loop) then
set udg_KB3D_B = false
set Speed=Speed*.85
set Angle=Angle+Deg2Rad(GetRandomReal(-15,15)+180)
call DestroyEffect(AddSpecialEffect(LoadStr(udg_KB3D_HA, 62, Loop), GetUnitX(U), GetUnitY(U)))
endif
//Create the Effect on the unit
if (Fx != "") then
if ( z > 20 ) then
if (Attach != "") then
call DestroyEffect(AddSpecialEffectTarget(Fx, U, Attach))//attach the effect on the unit if he is flying
endif
else
call DestroyEffect(AddSpecialEffect(Fx, x, y))//create the effect on his location if he is not flying
endif
endif
//Initiate Impact Damage
if ( (UnpathableStop) and not ( KB3D_CW(x, y) ) ) and ( (ImpactD != 0) and (Damager != null ) ) then//if the terrain is unpathable or if unpathable stop is disabled then..
if ( KB3D_CW(x, y) ) then
call SaveBoolean(udg_KB3D_HA, 23, Loop, true)
endif
if ( LoadBoolean(udg_KB3D_HA, 23, Loop) ) then
call UnitDamageTarget(Damager, U, ImpactD, true, false, AType, DType, null)//Apply Impact Damage to the unit
call SaveBoolean(udg_KB3D_HA, 23, Loop, false)
endif
endif
//Create AoE Grp
if (AoE != 0) and ((LineD != 0) or (AoED != 0) or LoadBoolean(udg_KB3D_HA, 61, Loop) or LoadBoolean(udg_KB3D_HA, 60, Loop)) then
set udg_KB3D_g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_g, x, y, RAbsBJ(AoE), Filter(function KB3D_FilterGrp))
//----------------------------------
loop
set u = FirstOfGroup(udg_KB3D_g)
exitwhen (u == null)
if (Damager != null) then
if (LineD != 0) then
call KB3D_LineDamageLoop(u, udg_KB3D_g)
endif
if (AoED != 0) then
call KB3D_AoEDamageLoop(u, udg_KB3D_g)
endif
endif
if not IsUnitInGroup(u, LoadGroupHandle(udg_KB3D_HA, 67, Loop)) and 125>SquareRoot((GetUnitX(u) - GetUnitX(U)) * (GetUnitX(u) - GetUnitX(U)) + (GetUnitY(u) - GetUnitY(U)) * (GetUnitY(u) - GetUnitY(U))) then
if LoadBoolean(udg_KB3D_HA, 61, Loop) then
call KB3D_BounceOnUnit(u, U, Loop)
call GroupAddUnit(LoadGroupHandle(udg_KB3D_HA, 67, Loop),u)
call DestroyEffect(AddSpecialEffect(LoadStr(udg_KB3D_HA, 62, Loop), GetUnitX(u), GetUnitY(u)))
set b = LoadBoolean(udg_KB3D_HA, 70, Loop)
endif
if LoadBoolean(udg_KB3D_HA, 60, Loop) then
set Angle = (Atan2(GetUnitY(u) - GetUnitY(U), GetUnitX(u) - GetUnitX(U))) + Deg2Rad(GetRandomReal(-15,15) + 180)
set Speed = Speed*.85
call DestroyEffect(AddSpecialEffect(LoadStr(udg_KB3D_HA, 62, Loop), GetUnitX(U), GetUnitY(U)))
endif
endif
call GroupRemoveUnit(udg_KB3D_g,u)
endloop
//----------------------------------
call DestroyGroup(udg_KB3D_g)
set udg_KB3D_g = null
endif
//Disable the unit partially
if ( DisableUnit ) then
call SetUnitPropWindow(U, 0)
call SetUnitTurnSpeed(U, 0)
endif
//Initiate Target-Related Actions
if (Target != null) then
if (SquareRoot ( ( GetUnitX(Target) - x ) * ( GetUnitX(Target) - x ) + ( GetUnitY(Target) - y ) * ( GetUnitY(Target) - y ) ) < Speed+2) then//when the target and the unit are close
if not (TargetD == 0) and not(Damager == null) then//Damage the Target
call UnitDamageTarget(Damager, Target, TargetD, true, false, AType, DType, null)
call SaveReal(udg_KB3D_HA, 19, Loop, 0)
endif
if KBTarget then//KB the Target
call KB3D_GiveKBto(Target, U, Loop)
call SaveBoolean( udg_KB3D_HA, 39, udg_KB3D_Counter, false )
endif
if (KillWhenHit) then//Kill the Unit
call KillUnit(U)
endif
if (EndWhenHit) then//End the KB
call SaveReal(udg_KB3D_HA, 4, Loop, KB3D_AlwaysNeg(Speed))
call SaveReal(udg_KB3D_HA, 3, Loop, GetUnitFlyHeight(U) - ZT)
endif
endif
endif
//Kill the Unit at the time
if (KillatTime != 0) and ( Time > KillatTime ) then
call KillUnit(U)
endif
//Save Changes in the Hashtable
call SaveReal(udg_KB3D_HA, 1, Loop, Range)
call SaveReal(udg_KB3D_HA, 2, Loop, Speed)
call SaveReal(udg_KB3D_HA, 5, Loop, Angle)
call SaveReal(udg_KB3D_HA, 12, Loop, ZSpeed)
call SaveReal(udg_KB3D_HA, 26, Loop, ZT)
call SaveReal(udg_KB3D_HA, 41, Loop, Time)
//Inititate End of the KB
if ( b or (LoadBoolean(udg_KB3D_HA, 45, Loop) and (Speed <= 2.34)) or ( Range <= 0 ) or ( (StopTime != 0) and ( Time > StopTime ) ) or EndOnObstacle ) then
call SaveBoolean(udg_KB3D_HA, 100, Loop, false)
set udg_KB3D_Instances = udg_KB3D_Instances - 1
if IsUnitType(U, UNIT_TYPE_DEAD) then
call SetUnitFlyHeight(U, GetUnitDefaultFlyHeight(U), 750 )
endif
call SetUnitPropWindow(U, LoadReal(udg_KB3D_HA, 15, Loop)*3.14159/180)
call SetUnitTurnSpeed(U, GetUnitDefaultTurnSpeed(U))
if HaveSavedHandle(udg_KB3D_HA, 14, Loop) and not EndB then
call DestroyEffect(LoadEffectHandle(udg_KB3D_HA, 14, Loop))
endif
set b = true
elseif IsUnitType(U, UNIT_TYPE_DEAD) and (EndwhenDead) then
call SaveBoolean(udg_KB3D_HA, 100, Loop, false)
set udg_KB3D_Instances = udg_KB3D_Instances - 1
if IsUnitType(U, UNIT_TYPE_DEAD) then
call SetUnitFlyHeight(U, GetUnitDefaultFlyHeight(U), 750 )
endif
call SetUnitPropWindow(U, LoadReal(udg_KB3D_HA, 15, Loop)*3.14159/180)
call SetUnitTurnSpeed(U, GetUnitDefaultTurnSpeed(U))
if HaveSavedHandle(udg_KB3D_HA, 14, Loop) and not EndB then
call DestroyEffect(LoadEffectHandle(udg_KB3D_HA, 14, Loop))
endif
set b = true
endif
//variable b refers to if the KB has ended
if b then
call SetUnitFlyHeight(U, GetUnitFlyHeight(U)-KB3D_InBetween(0,ZT-LoadReal(udg_KB3D_HA, 71, Loop),999), 500)
if LoadBoolean(udg_KB3D_HA, 44, Loop) then
call SetUnitFlyHeight(U, GetUnitFlyHeight(U)-KB3D_InBetween(0,(LoadReal(udg_KB3D_HA, 69, Loop)-KB3D_GetCoordinatesZ(x,y)),9999), RAbsBJ(ZSpeed))
endif
//----------
call SaveInteger(udg_KB3D_HA, -5, GetHandleId(U), LoadInteger(udg_KB3D_HA, -5, GetHandleId(U))-1)
if LoadInteger(udg_KB3D_HA, -5, GetHandleId(udg_KB3D_Unit)) == 0 then
call SaveBoolean(udg_KB3D_HA, GetHandleId(U), GetHandleId(U), false)
endif
//----------
if (AoEEndDamage != 0) and (Damager != null) and (AoE != 0) then
set udg_KB3D_g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_g, x, y, RAbsBJ(AoE), null)
loop
set u = FirstOfGroup(udg_KB3D_g)
call KB3D_AoEEndDamage(u, udg_KB3D_g)
exitwhen (u == null)
endloop
call DestroyGroup(udg_KB3D_g)
set udg_KB3D_g = null
endif
//----------
if (AoEKB) and (AoE != 0) then
set udg_KB3D_g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_g, x, y, RAbsBJ(AoE), null)
loop
set u = FirstOfGroup(udg_KB3D_g)
call KB3D_AoEKB(u, udg_KB3D_g)
exitwhen (u == null)
endloop
call DestroyGroup(udg_KB3D_g)
set udg_KB3D_g = null
endif
//----------
if (EndFx != "") then
if ( z > 20 ) and (Attach != "") then
call DestroyEffect(AddSpecialEffectTarget(EndFx, U, Attach))//attach the effect on the unit if he is flying
else
call DestroyEffect(AddSpecialEffect(EndFx, x, y))//create the effect on his location if he is not flying
endif
endif
//----------
if (AoEEndFx != "") and (Attach != "") and (AoE > 0) then
set udg_KB3D_g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_g, x, y, RAbsBJ(AoE), null)
loop
set u = FirstOfGroup(udg_KB3D_g)
call KB3D_AoEEndFx(u, Attach, AoEEndFx, udg_KB3D_g)
exitwhen (u == null)
endloop
call DestroyGroup(udg_KB3D_g)
set udg_KB3D_g = null
endif
//----------
if (AoEEndFx != "") and (Attach != "") and (AoE > 0) then
set udg_KB3D_g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_g, x, y, RAbsBJ(AoE), null)
loop
set u = FirstOfGroup(udg_KB3D_g)
call KB3D_AoEEndFx(u, Attach, AoEEndFx, udg_KB3D_g)
exitwhen (u == null)
endloop
call DestroyGroup(udg_KB3D_g)
set udg_KB3D_g = null
endif
//----------
if GroundDamage and (ImpactD != 0) and z < 75 and (Damager != null) then
call UnitDamageTarget(Damager, U, ImpactD, true, false, AType, DType, null)
endif
//----------
if (KillatEnd) and not EndB then
call KillUnit(U)
endif
//----------
if (EndT != null) then
set udg_KB3D_Unit = U
set udg_KB3D_Targeted_Unit = Target
call ConditionalTriggerExecute(EndT)
set udg_KB3D_Unit = null
set udg_KB3D_Targeted_Unit = null
endif
endif
//Function to know if the unit is being KBed by the system
call SaveInteger(udg_KB3D_HA, -2, GetHandleId(udg_KB3D_Unit), LoadInteger(udg_KB3D_HA, -2, GetHandleId(udg_KB3D_Unit))-1)
call SaveBoolean(udg_KB3D_HA, -1, GetHandleId(udg_KB3D_Unit), LoadInteger(udg_KB3D_HA, -2, GetHandleId(udg_KB3D_Unit))!=0)
//Clear Instance
if b then
call KB3D_ClearInstance(Loop)
endif
//Clear locals
set udg_KB3D_B = false
set U = null
set Target = null
set Damager = null
endfunction
function KB3D_Loop_Actions takes nothing returns nothing
local integer x = 0
loop
exitwhen x >= udg_KB3D_Counter
set x = x + 1
if ( LoadBoolean(udg_KB3D_HA, 100, x) ) then
call KB3D_Loop(x)
endif
endloop
if ( udg_KB3D_Instances == 0 ) then
set udg_KB3D_Counter = 0
call PauseTimer(udg_KB3D_Timer)
endif
endfunction
function KB3D_ClearVar takes nothing returns nothing
set udg_KB3D_HomingMissile = false
set udg_KB3D_EndOnTargetBounce = false
set udg_KB3D_Speed_Changer = false
set udg_KB3D_AoEEndFx = ""
set udg_KB3D_D_STRUCTURE = false
set udg_KB3D_D_MECHANICAL = false
set udg_KB3D_D_ALLY = false
set udg_KB3D_D_MAGIC_IMMINUE = false
set udg_KB3D_D_ENEMY = true
set udg_KB3D_D_RESISTANT = false
set udg_KB3D_D_FLYING = false
set udg_KB3D_Accel = 0.00
set udg_KB3D_AllowOutSiding = false
set udg_KB3D_Angle = 0.00
set udg_KB3D_AoE = 0.00
set udg_KB3D_Arc = 0.00
set udg_KB3D_AoEDamage = 0.00
set udg_KB3D_AttackType = ATTACK_TYPE_NORMAL
set udg_KB3D_DamageType = DAMAGE_TYPE_MAGIC
set udg_KB3D_Damager = null
set udg_KB3D_DestroyTree = true
set udg_KB3D_DisableUnit = false
set udg_KB3D_EndWhenHit = false
set udg_KB3D_Fx = ""
set udg_KB3D_Fx_Attach = ""
set udg_KB3D_EndFx = ""
set udg_KB3D_Attach = "origin"
set udg_KB3D_ImpactDamage = 0.00
set udg_KB3D_KillWhenHit = false
set udg_KB3D_FaceAngle = false
set udg_KB3D_KillifOutSider = false
set udg_KB3D_LineDamage = 0.00
set udg_KB3D_LoopDamage = 0.00
set udg_KB3D_Range = 0.00
set udg_KB3D_Speed = 0.00
set udg_KB3D_TargetDamage = 0.00
set udg_KB3D_Targeted_Unit = null
set udg_KB3D_TrailFx = ""
set udg_KB3D_Unit = null
set udg_KB3D_UnpathableStop = true
set udg_KB3D_Zoffset = 0.00
set udg_KB3D_AoEEndDamage = 0.00
set udg_KB3D_AoEKB = false
set udg_KB3D_EndwhenDead = true
set udg_KB3D_KBTarget = false
set udg_KB3D_StopTime = 0.00
set udg_KB3D_KillatTime = 0.00
set udg_KB3D_AoEKB_Power = 1.00
set udg_KB3D_iKB = true
set udg_KB3D_KillatEnd = false
set udg_KB3D_GroundDamage = false
set udg_KB3D_EndTrigger = null
set udg_KB3D_JumpOverCliff = false
set udg_KB3D_DestroyDestructables = false
set udg_KB3D_Line_Fx = ""
set udg_KB3D_Bounce_Target = false
set udg_KB3D_Bounce_Unit = false
set udg_KB3D_Bounce_Power = 1.00
set udg_KB3D_Bounce_Fx = ""
set udg_KB3D_EndOnObstacle = false
endfunction
function KB3D_Registration takes nothing returns boolean
local real Time
local real R
local real R1
local real dx
local real dy
//------------------------
if udg_KB3D_Unit == null then
return false
endif
//------------------------
if udg_KB3D_Fx_Attach != "" then
set udg_KB3D_Fx = udg_KB3D_Fx_Attach
endif
//------------------------
if udg_KB3D_Targeted_Unit != null and udg_KB3D_HomingMissile then
set udg_KB3D_Zoffset = GetUnitFlyHeight(udg_KB3D_Targeted_Unit)
set dx = GetUnitX(udg_KB3D_Unit)-GetUnitX(udg_KB3D_Targeted_Unit)
set dy = GetUnitY(udg_KB3D_Unit)-GetUnitY(udg_KB3D_Targeted_Unit)
if udg_KB3D_Zoffset == 0 then
set udg_KB3D_Zoffset = 100
set udg_KB3D_Range = SquareRoot( dx * dx + dy * dy)*1.25
else
set udg_KB3D_Range = SquareRoot( dx * dx + dy * dy)*2
endif
set udg_KB3D_KillatEnd = true
set udg_KB3D_KillWhenHit = true
set udg_KB3D_EndWhenHit = true
set udg_KB3D_FaceAngle = true
set udg_KB3D_UnpathableStop = false
endif
//------------------------
set udg_KB3D_Arc = KB3D_InBetween(-10, udg_KB3D_Arc, 10)
set udg_KB3D_AoEKB_Power = KB3D_InBetween(0.01, udg_KB3D_AoEKB_Power, 3)
//------------------------
if IsUnitType(udg_KB3D_Unit, UNIT_TYPE_FLYING) then
set udg_KB3D_UnpathableStop = false
endif
//------------------------
if (udg_KB3D_iKB) and udg_KB3D_Range < 0 then
if ( udg_KB3D_Targeted_Unit == null ) then
set udg_KB3D_Angle = udg_KB3D_Angle + 180
else
set udg_KB3D_Speed = -1*(udg_KB3D_Speed)
endif
endif
//------------------------
set udg_KB3D_Range = KB3D_InBetween(0.0000001, RAbsBJ(udg_KB3D_Range), RAbsBJ(udg_KB3D_Range))
//------------------------
if (udg_KB3D_iKB) and udg_KB3D_Speed < 0 then
set udg_KB3D_Speed = KB3D_InBetween(udg_KB3D_Speed, udg_KB3D_Speed, -0.01)
else
set udg_KB3D_Speed = KB3D_InBetween(0.01, RAbsBJ(udg_KB3D_Speed), RAbsBJ(udg_KB3D_Speed))
endif
//------------------------
set udg_KB3D_Counter = udg_KB3D_Counter + 1
set udg_KB3D_Instances = udg_KB3D_Instances + 1
call SaveBoolean(udg_KB3D_HA, -1, GetHandleId(udg_KB3D_Unit), true)
call SaveBoolean(udg_KB3D_HA, 57, udg_KB3D_Counter, (udg_KB3D_Zoffset != 0))
//------------------------
if not udg_KB3D_iKB then
set udg_KB3D_Zoffset = RAbsBJ(udg_KB3D_Zoffset)
elseif GetUnitFlyHeight(udg_KB3D_Unit)+udg_KB3D_Zoffset < 0 then
set udg_KB3D_Zoffset = -GetUnitFlyHeight(udg_KB3D_Unit)
endif
//------------------------
set udg_KB3D_StopTime = RAbsBJ(udg_KB3D_StopTime)
set udg_KB3D_KillatTime = RAbsBJ(udg_KB3D_KillatTime)
set udg_KB3D_AoE = RAbsBJ(udg_KB3D_AoE)
//------------------------
//------------------------
call SaveUnitHandle( udg_KB3D_HA, 0, udg_KB3D_Counter, udg_KB3D_Unit )
call SaveReal( udg_KB3D_HA, 1, udg_KB3D_Counter, udg_KB3D_Range )
call SaveReal( udg_KB3D_HA, 2, udg_KB3D_Counter, udg_KB3D_Speed * 0.031250000 )
call SaveReal( udg_KB3D_HA, 4, udg_KB3D_Counter, udg_KB3D_Accel * 0.031250000 * 0.031250000 )
//------------------------
if ( udg_KB3D_Targeted_Unit == null ) then
call SaveReal( udg_KB3D_HA, 5, udg_KB3D_Counter, udg_KB3D_Angle * 3.14159 / 180 )
else
call SaveUnitHandle( udg_KB3D_HA, 5, udg_KB3D_Counter, udg_KB3D_Targeted_Unit )
set udg_KB3D_JumpOverCliff = false
endif
//------------------------
call SaveBoolean( udg_KB3D_HA, 6, udg_KB3D_Counter, udg_KB3D_DisableUnit )
call SaveBoolean( udg_KB3D_HA, 7, udg_KB3D_Counter, udg_KB3D_UnpathableStop )
call SaveBoolean( udg_KB3D_HA, 8, udg_KB3D_Counter, udg_KB3D_DestroyTree )
call SaveStr( udg_KB3D_HA, 9, udg_KB3D_Counter, udg_KB3D_Fx )
call SaveStr( udg_KB3D_HA, 10, udg_KB3D_Counter, udg_KB3D_Attach )
call SaveBoolean( udg_KB3D_HA, 45, udg_KB3D_Counter, udg_KB3D_Speed>0 )
//------------------------
//------------------------
set udg_KB3D_Speed = KB3D_InBetween(0.01, RAbsBJ(udg_KB3D_Speed), RAbsBJ(udg_KB3D_Speed))
//------------------------
if ( udg_KB3D_Accel == 0.00 ) then
set Time = udg_KB3D_Range / (udg_KB3D_Speed)//calculating time for the knockback if Acceleration = 0
else
if ( udg_KB3D_Accel > 0 ) then
set Time = (-udg_KB3D_Speed-SquareRoot(udg_KB3D_Speed*udg_KB3D_Speed + 2*udg_KB3D_Accel*udg_KB3D_Range))/-udg_KB3D_Accel//calculating time for the knockback if Acceleration > 0*/
endif
if ( udg_KB3D_Accel < 0 ) then
set Time = (-udg_KB3D_Speed+SquareRoot(udg_KB3D_Speed*udg_KB3D_Speed + 2*udg_KB3D_Accel*udg_KB3D_Range))/udg_KB3D_Accel
endif
endif
//------------------------
call SaveReal( udg_KB3D_HA, 11, udg_KB3D_Counter, Time )
call SaveBoolean( udg_KB3D_HA, 100, udg_KB3D_Counter, true )
//------------------------
if UnitAddAbility(udg_KB3D_Unit, 'Amrf') then
call UnitRemoveAbility(udg_KB3D_Unit, 'Amrf')
endif
//------------------------
call SaveReal( udg_KB3D_HA, 3, udg_KB3D_Counter, udg_KB3D_Zoffset )
call SaveReal( udg_KB3D_HA, 12, udg_KB3D_Counter, (2*udg_KB3D_Zoffset / ( Time / 2)) )
call SaveReal( udg_KB3D_HA, 13, udg_KB3D_Counter, ( -2 * udg_KB3D_Zoffset / ( Time / 2) ) / ( Time / 2) * 0.031250000 )
//------------------------
if not (udg_KB3D_TrailFx == "") and not (udg_KB3D_Attach == "") then
call SaveEffectHandle(udg_KB3D_HA, 14, udg_KB3D_Counter, AddSpecialEffectTarget(udg_KB3D_TrailFx, udg_KB3D_Unit, udg_KB3D_Attach))
endif
//------------------------
call SaveReal( udg_KB3D_HA, 15, udg_KB3D_Counter, GetUnitDefaultPropWindow(udg_KB3D_Unit) )
call SaveBoolean(udg_KB3D_HA, 16, udg_KB3D_Counter, udg_KB3D_Speed_Changer)
call SaveReal( udg_KB3D_HA, 17, udg_KB3D_Counter, udg_KB3D_ImpactDamage )
call SaveReal( udg_KB3D_HA, 18, udg_KB3D_Counter, udg_KB3D_LoopDamage * 0.031250000 )
call SaveReal( udg_KB3D_HA, 19, udg_KB3D_Counter, udg_KB3D_TargetDamage )
call SaveInteger( udg_KB3D_HA, 20, udg_KB3D_Counter, GetHandleId(udg_KB3D_AttackType))
call SaveInteger( udg_KB3D_HA, 21, udg_KB3D_Counter, GetHandleId(udg_KB3D_DamageType))
call SaveUnitHandle( udg_KB3D_HA, 22, udg_KB3D_Counter, udg_KB3D_Damager )
call SaveBoolean( udg_KB3D_HA, 23, udg_KB3D_Counter, true )
call SaveBoolean( udg_KB3D_HA, 24, udg_KB3D_Counter, udg_KB3D_KillWhenHit )
call SaveBoolean( udg_KB3D_HA, 25, udg_KB3D_Counter, udg_KB3D_EndWhenHit )
// 26 used
call SaveGroupHandle(udg_KB3D_HA, 27, udg_KB3D_Counter, CreateGroup() )
call SaveReal( udg_KB3D_HA, 28, udg_KB3D_Counter, udg_KB3D_LineDamage )
call SaveReal( udg_KB3D_HA, 29, udg_KB3D_Counter, RAbsBJ(udg_KB3D_AoE) )
call SaveReal( udg_KB3D_HA, 30, udg_KB3D_Counter, udg_KB3D_Arc * (3.14159/180) )
call SaveBoolean( udg_KB3D_HA, 31, udg_KB3D_Counter, udg_KB3D_FaceAngle )
call SaveReal( udg_KB3D_HA, 32, udg_KB3D_Counter, udg_KB3D_AoEDamage )
call SaveBoolean( udg_KB3D_HA, 33, udg_KB3D_Counter, udg_KB3D_KillifOutSider )
//------------------------
set udg_KB3D_AllowOutSiding = udg_KB3D_KillifOutSider
//------------------------
call SaveBoolean( udg_KB3D_HA, 34, udg_KB3D_Counter, udg_KB3D_AllowOutSiding )
//------------------------
set udg_KB3D_EndwhenDead = udg_KB3D_KillatTime > udg_KB3D_StopTime
//------------------------
call SaveBoolean( udg_KB3D_HA, 35, udg_KB3D_Counter, udg_KB3D_EndwhenDead )
call SaveReal( udg_KB3D_HA, 36, udg_KB3D_Counter, udg_KB3D_KillatTime )
call SaveReal( udg_KB3D_HA, 37, udg_KB3D_Counter, udg_KB3D_StopTime )
call SaveReal( udg_KB3D_HA, 38, udg_KB3D_Counter, udg_KB3D_AoEEndDamage )
call SaveBoolean( udg_KB3D_HA, 39, udg_KB3D_Counter, udg_KB3D_KBTarget )
call SaveBoolean( udg_KB3D_HA, 40, udg_KB3D_Counter, udg_KB3D_AoEKB )
//41 used
call SaveStr(udg_KB3D_HA, 42, udg_KB3D_Counter, udg_KB3D_EndFx )
call SaveReal( udg_KB3D_HA, 43, udg_KB3D_Counter, udg_KB3D_AoEKB_Power )
call SaveBoolean( udg_KB3D_HA, 44, udg_KB3D_Counter, udg_KB3D_iKB )
call SaveBoolean( udg_KB3D_HA, 46, udg_KB3D_Counter, udg_KB3D_KillatEnd )
call SaveBoolean( udg_KB3D_HA, 47, udg_KB3D_Counter, udg_KB3D_GroundDamage )
call SaveBoolean( udg_KB3D_HA, 48, udg_KB3D_Counter, udg_KB3D_D_STRUCTURE )
call SaveBoolean( udg_KB3D_HA, 49, udg_KB3D_Counter, udg_KB3D_D_MECHANICAL )
call SaveBoolean( udg_KB3D_HA, 50, udg_KB3D_Counter, udg_KB3D_D_MAGIC_IMMINUE )
call SaveBoolean( udg_KB3D_HA, 51, udg_KB3D_Counter, udg_KB3D_D_ALLY )
call SaveBoolean( udg_KB3D_HA, 52, udg_KB3D_Counter, udg_KB3D_JumpOverCliff )
call SaveBoolean( udg_KB3D_HA, 53, udg_KB3D_Counter, false )
call SaveStr( udg_KB3D_HA, 54, udg_KB3D_Counter, udg_KB3D_AoEEndFx )
call SaveTriggerHandle( udg_KB3D_HA, 55, udg_KB3D_Counter, udg_KB3D_EndTrigger )
call SaveBoolean( udg_KB3D_HA, 56, udg_KB3D_Counter, udg_KB3D_DestroyDestructables )
//57 used
call SaveStr( udg_KB3D_HA, 58, udg_KB3D_Counter, udg_KB3D_Line_Fx )
call SaveReal( udg_KB3D_HA, 59, udg_KB3D_Counter, udg_KB3D_Bounce_Power )
call SaveBoolean( udg_KB3D_HA, 60, udg_KB3D_Counter, udg_KB3D_Bounce_Unit )
call SaveBoolean( udg_KB3D_HA, 61, udg_KB3D_Counter, udg_KB3D_Bounce_Target )
call SaveStr( udg_KB3D_HA, 62, udg_KB3D_Counter, udg_KB3D_Bounce_Fx )
call SaveBoolean( udg_KB3D_HA, 63, udg_KB3D_Counter, udg_KB3D_D_ENEMY )
call SaveBoolean( udg_KB3D_HA, 64, udg_KB3D_Counter, udg_KB3D_D_RESISTANT )
call SaveBoolean( udg_KB3D_HA, 65, udg_KB3D_Counter, udg_KB3D_D_FLYING )
call SaveBoolean( udg_KB3D_HA, 66, udg_KB3D_Counter, udg_KB3D_EndOnObstacle )
//------------------------
if udg_KB3D_Bounce_Target then
call SaveGroupHandle(udg_KB3D_HA, 67, udg_KB3D_Counter, CreateGroup())
endif
//------------------------
call SaveReal( udg_KB3D_HA, 68, udg_KB3D_Counter, KB3D_GetCoordinatesZ(GetUnitX(udg_KB3D_Unit), GetUnitY(udg_KB3D_Unit)) )
call SaveReal( udg_KB3D_HA, 69, udg_KB3D_Counter, KB3D_GetCoordinatesZ(GetUnitX(udg_KB3D_Unit), GetUnitY(udg_KB3D_Unit)) )
call SaveBoolean( udg_KB3D_HA, 70, udg_KB3D_Counter, udg_KB3D_EndOnTargetBounce )
call SaveReal(udg_KB3D_HA, 71, udg_KB3D_Counter, GetUnitFlyHeight(udg_KB3D_Unit))
//------------------------
if ( udg_KB3D_Counter == 1 ) then
call TimerStart(udg_KB3D_Timer, 0.031250000, true, function KB3D_Loop_Actions )
endif
//------------------------
set udg_KB3D_Time = Time
//------------------------
//------------------------
call SaveInteger(udg_KB3D_HA, -5, GetHandleId(udg_KB3D_Unit), LoadInteger(udg_KB3D_HA, -5, GetHandleId(udg_KB3D_Unit))+1)
call SaveBoolean(udg_KB3D_HA, GetHandleId(udg_KB3D_Unit), GetHandleId(udg_KB3D_Unit), true)
//------------------------
//------------------------
//------------------------
call KB3D_ClearVar()
return false
endfunction
//===========================================================================
function InitTrig_KB3D takes nothing returns nothing
////////REGISTRATION
set udg_KB3D_Registration = CreateTrigger( )
call TriggerAddCondition( udg_KB3D_Registration, Condition(function KB3D_Registration) )
set udg_KB3D_Harvester = CreateUnit(Player(15), 'hpea', 0, 0, 0)
call ShowUnit(udg_KB3D_Harvester, false)
call UnitAddAbility(udg_KB3D_Harvester, 'Aloc')
call UnitAddAbility(udg_KB3D_Harvester, 'Ahar')
call UnitRemoveAbility(udg_KB3D_Harvester, 'Amov')
set udg_KB3D_HA = InitHashtable()
////////Check Walkability System by PnF
set udg_CP_Rect = Rect(0, 0, 128.00, 128.00)
set udg_CP_Item = CreateItem('wtlg', 0, 0)
call SetItemVisible( udg_CP_Item, false )
////////InitReals
set udg_KB3D_Reals[1] = GetRectMaxX(bj_mapInitialPlayableArea)
set udg_KB3D_Reals[2] = GetRectMinX(bj_mapInitialPlayableArea)
set udg_KB3D_Reals[3] = GetRectMaxY(bj_mapInitialPlayableArea)
set udg_KB3D_Reals[4] = GetRectMinY(bj_mapInitialPlayableArea)
set udg_KB3D_Reals[5] = GetRectMaxX(GetWorldBounds())
set udg_KB3D_Reals[6] = GetRectMinX(GetWorldBounds())
set udg_KB3D_Reals[7] = GetRectMaxY(GetWorldBounds())
set udg_KB3D_Reals[8] = GetRectMinY(GetWorldBounds())
//Initiate Default Values
call KB3D_ClearVar()
endfunction
//TESH.scrollpos=25
//TESH.alwaysfold=0
/*
Electric Conduit
v2.01
By KILLCIDE
Weelp... this spell took longer than it should have. Second upload onto the Hive, but first spell I've came up with on my own :3
Requirements:
--------
- dummy.mdx
- GUI Knockback 2D
- GUI Unit Indexer
Credits:
-------
- Bribe for GUI Knockback 2D & Unit Indexer
- Vexorian for dummy.mdx
How to Install:
--------------
1. Under Preferences, make sure you have "Automatically create unknown variables while pasting trigger data" checked
2. Import dummy.mdx, then copy and paste the dummy unit and two custom abilities into your map
NOTE: If you already have dummy.mdx imported into your map, you DO NOT have to reimport it
If you already have a global dummy unit in your map, you can skip this step
3. Copy and paste both the Resources folder into your map
NOTE: If you already have a resource in the Resources folder imported into your map, you DO NOT have to reimport it
4. Copy and paste the Electric Conduit folder into your map
5. Go to the EC Config trigger and change the Ability, AbilityCL, & Dummy variables to the corresponding objects you just imported
Changelog:
---------
- v2.01 (March 07, 2016): Added an optional Electric Conduit folder that is integrated with GUI Spell System
Added Bribe's new knockback system update
Removed unnecesary NodeLast[] variable for linked list; last spell instance now stores into NodePrev[0]
Removed If/Then/Else that would set NodeLast = NodePrev[Spell_ID] if NodeLast == Spell_ID
- v2.00 (January 20, 2016): Added Bribe's new knockback system update
Changed data structure to linked listing
- v1.05 (Deceomber 02, 2015): Added Bribe's new knockback system update
Changed loop to check if it is time to deindex before starting
Changed name of EC Init to EC Cast
Fixed Owner[] variable to now use Triggering Player instead of Owner of (Unit)
Removed unnecessary function call when turning of EC Loop (Turn off (This Trigger) -> (Turn off EC Loop))
- v1.04 (November 14, 2015): Added Bribe's new knockback system update
Fixed a small bug where the caster would still continue to channel the spell even though they are stunned/silenced
Removed the "unable to move or act" mechanic; caster can now move to interrupt the spell
- v1.03 (October 30, 2015): Changed names of some variables
Removed unneccesary variables
- v1.02 (September 20, 2015): Added a configurable for changing the overhead SFX
Added preload functions; users no longer have to worry about making sure dummy unit has correct spell
Removed Electric Conduit Dummy 2; spell now only uses one dummy for everything
Removed KillUnit function and replaced it with RemoveUnit
Removed EC Dummy Cleaner trigger
- v1.01 (September 17, 2015): Added a check for the possibility of the caster being interrupted during channel (death, silenced,
or stunned)
Removed use of expiration timer for SFX Dummy, uses Kill Unit instead
- v1.00 (September 14, 2015): Uploaded onto Hive
//TESH.scrollpos=0
//TESH.alwaysfold=0
function K2DItemCheckXY takes real x, real y returns boolean
call SetItemPosition(udg_K2DItem, x, y)
return GetWidgetX(udg_K2DItem) == x and GetWidgetY(udg_K2DItem) == y
endfunction
function K2DItemCheckAxis takes real x, real y returns boolean
local real x2 = x*udg_K2DRadius[udg_UDex]
local real y2 = y*udg_K2DRadius[udg_UDex]
set x = udg_K2DX + x2
set y = udg_K2DY + y2
if K2DItemCheckXY(x, y) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY) then
set x = udg_K2DX - x2
set y = udg_K2DY - y2
return K2DItemCheckXY(x, y) and not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)
endif
return false
endfunction
function K2DItemCheck takes nothing returns boolean
local boolean result = K2DItemCheckXY(udg_K2DX, udg_K2DY)
//Only perform additional pathing checks if the unit has a larger collision.
if result and udg_Knockback2DRobustPathing > 0 and udg_K2DRadius[udg_UDex] > 0 then
//Check horizontal axis of unit to make sure nothing is going to collide
set result = K2DItemCheckAxis(udg_K2DCosH[udg_UDex], udg_K2DSinH[udg_UDex])
//Check vertical axis of unit to ensure nothing will collide
set result = result and K2DItemCheckAxis(udg_K2DCos[udg_UDex], udg_K2DSin[udg_UDex])
if result and udg_Knockback2DRobustPathing == 2 and udg_K2DRadius[udg_UDex] > 16 then
//Check diagonal axis of unit if more thorough pathing is desired
set result = K2DItemCheckAxis(udg_K2DCosD1[udg_UDex], udg_K2DSinD1[udg_UDex])
set result = result and K2DItemCheckAxis(udg_K2DCosD2[udg_UDex], udg_K2DSinD2[udg_UDex])
endif
endif
//Reset item so it won't interfere with the map
call SetItemPosition(udg_K2DItem, udg_K2DMaxX, udg_K2DMaxY)
call SetItemVisible(udg_K2DItem, false)
return result
endfunction
function K2DItemFilter takes nothing returns boolean
//Check for visible items, temporarily hide them and add them to the filter.
if IsItemVisible(GetFilterItem()) then
call SetItemVisible(GetFilterItem(), false)
return true
endif
return false
endfunction
function K2DItemCode takes nothing returns nothing
//Perform the item-pathing check only once, then unhide those filtered items
if not udg_K2DItemsFound then
set udg_K2DItemsFound = true
set udg_K2DItemOffset = K2DItemCheck()
endif
call SetItemVisible(GetEnumItem(), true)
endfunction
function K2DKillDest takes nothing returns nothing
local real x
local real y
//Handle destruction of debris
set bj_destRandomCurrentPick = GetEnumDestructable()
if GetWidgetLife(bj_destRandomCurrentPick) > 0.405 and IssueTargetOrder(udg_K2DDebrisKiller, udg_Knockback2DTreeOrDebris, bj_destRandomCurrentPick) then
set x = GetWidgetX(bj_destRandomCurrentPick) - udg_K2DX
set y = GetWidgetY(bj_destRandomCurrentPick) - udg_K2DY
if x*x + y*y <= udg_K2DDestRadius[udg_UDex] then
call KillDestructable(bj_destRandomCurrentPick)
endif
endif
endfunction
function K2DEnumDests takes nothing returns nothing
call MoveRectTo(udg_K2DRegion, udg_K2DX, udg_K2DY)
if udg_K2DKillTrees[udg_UDex] then
call SetUnitX(udg_K2DDebrisKiller, udg_K2DX)
call SetUnitY(udg_K2DDebrisKiller, udg_K2DY)
call EnumDestructablesInRect(udg_K2DRegion, null, function K2DKillDest)
endif
endfunction
function Knockback2DCheckXY takes real x, real y returns boolean
set udg_K2DX = x + udg_K2DVelocity[udg_UDex]*udg_K2DCos[udg_UDex]
set udg_K2DY = y + udg_K2DVelocity[udg_UDex]*udg_K2DSin[udg_UDex]
if udg_K2DSimple[udg_UDex] then
//A "pull" effect or a missile system does not require complex pathing.
if udg_K2DX <= udg_K2DMaxX and udg_K2DX >= udg_K2DMinX and udg_K2DY <= udg_K2DMaxY and udg_K2DY >= udg_K2DMinY then
call K2DEnumDests()
return true
endif
return false
elseif udg_K2DFlying[udg_UDex] then
return not IsTerrainPathable(udg_K2DX, udg_K2DY, PATHING_TYPE_FLYABILITY)
elseif not IsTerrainPathable(udg_K2DX, udg_K2DY, PATHING_TYPE_WALKABILITY) then
call K2DEnumDests()
set udg_K2DItemOffset = false
call EnumItemsInRect(udg_K2DRegion, Filter(function K2DItemFilter), function K2DItemCode)
if udg_K2DItemsFound then
//If items were found, the check was already performed.
set udg_K2DItemsFound = false
else
//Otherwise, perform the check right now.
set udg_K2DItemOffset = K2DItemCheck()
endif
return udg_K2DItemOffset
endif
return udg_K2DAmphibious[udg_UDex] and not IsTerrainPathable(udg_K2DX, udg_K2DY, PATHING_TYPE_FLOATABILITY)
endfunction
function Knockback2DApplyAngle takes real angle returns nothing
set angle = ModuloReal(angle, udg_Radians_Turn)
set udg_K2DCos[udg_UDex] = Cos(angle)
set udg_K2DSin[udg_UDex] = Sin(angle)
set udg_K2DAngle[udg_UDex] = angle
if udg_Knockback2DRobustPathing > 0 then
set angle = ModuloReal(angle + udg_Radians_QuarterTurn, udg_Radians_Turn)
set udg_K2DCosH[udg_UDex] = Cos(angle)
set udg_K2DSinH[udg_UDex] = Sin(angle)
if udg_Knockback2DRobustPathing == 2 and udg_K2DRadius[udg_UDex] > 16 then
set angle = ModuloReal(angle + udg_Radians_QuarterPi, udg_Radians_Turn)
set udg_K2DCosD1[udg_UDex] = Cos(angle)
set udg_K2DSinD1[udg_UDex] = Sin(angle)
set angle = ModuloReal(angle + udg_Radians_QuarterTurn, udg_Radians_Turn)
set udg_K2DCosD2[udg_UDex] = Cos(angle)
set udg_K2DSinD2[udg_UDex] = Sin(angle)
endif
endif
endfunction
function Knockback2DLooper takes nothing returns nothing
local integer i = 0
local unit u
local real x
local real y
call PauseUnit(udg_K2DDebrisKiller, false)
loop
set i = udg_K2DNext[i]
exitwhen i == 0
set udg_UDex = i
set udg_K2DTimeLeft[i] = udg_K2DTimeLeft[i] - udg_K2DTimeout
set udg_K2DDistanceLeft[i] = udg_K2DDistanceLeft[i] - udg_K2DVelocity[i]
set u = udg_UDexUnits[i]
if udg_K2DTimeLeft[i] > 0.00 then
if udg_K2DTimeLeft[i] < udg_K2DHeightThreshold[i] and udg_K2DHeightThreshold[i] != 0.00 then
call SetUnitFlyHeight(u, GetUnitDefaultFlyHeight(u), GetUnitFlyHeight(u) - GetUnitDefaultFlyHeight(u)/udg_K2DHeightThreshold[i])
set udg_K2DHeightThreshold[i] = 0.00
endif
if udg_K2DPause[i] then
set x = udg_K2DLastX[i]
set y = udg_K2DLastY[i]
else
set x = GetUnitX(u)
set y = GetUnitY(u)
endif
if not Knockback2DCheckXY(x, y) then
if not udg_K2DFreeze[i] and IsTriggerEnabled(udg_K2DImpact[i]) and TriggerEvaluate(udg_K2DImpact[i]) then
call TriggerExecute(udg_K2DImpact[i])
endif
if udg_K2DBounce[i] then
call Knockback2DApplyAngle(udg_Radians_Turn - udg_K2DAngle[i])
if not Knockback2DCheckXY(x, y) then
call Knockback2DApplyAngle(udg_K2DAngle[i] + bj_PI)
if not Knockback2DCheckXY(x, y) then
call Knockback2DApplyAngle(udg_Radians_Turn - udg_K2DAngle[i])
set udg_K2DX = x
set udg_K2DY = y
endif
endif
else
set udg_K2DX = x
set udg_K2DY = y
set udg_K2DFreeze[i] = true
endif
endif
call SetUnitX(u, udg_K2DX)
call SetUnitY(u, udg_K2DY)
set udg_K2DLastX[i] = udg_K2DX
set udg_K2DLastY[i] = udg_K2DY
if udg_K2DFXModel[i] != "" then
set udg_K2DFXTimeLeft[i] = udg_K2DFXTimeLeft[i] - udg_K2DTimeout
if udg_K2DFXTimeLeft[i] <= 0.00 then
set udg_K2DFXTimeLeft[i] = udg_K2DFXRate[i]
if udg_K2DFlying[i] then
call DestroyEffect(AddSpecialEffectTarget(udg_K2DFXModel[i], u, "origin"))
else
call DestroyEffect(AddSpecialEffect(udg_K2DFXModel[i], udg_K2DX, udg_K2DY))
endif
endif
endif
if udg_K2DCollision[i] >= 0.00 then
call GroupEnumUnitsInRange(bj_lastCreatedGroup, udg_K2DX, udg_K2DY, 200.00, null)
call GroupRemoveUnit(bj_lastCreatedGroup, u)
loop
set udg_Knockback2DUnit = FirstOfGroup(bj_lastCreatedGroup)
exitwhen udg_Knockback2DUnit == null
call GroupRemoveUnit(bj_lastCreatedGroup, udg_Knockback2DUnit)
if IsUnitInRange(udg_Knockback2DUnit, u, udg_K2DCollision[i]) and udg_K2DFlying[i] == IsUnitType(udg_Knockback2DUnit, UNIT_TYPE_FLYING) and (not IsUnitType(udg_Knockback2DUnit, UNIT_TYPE_STRUCTURE)) and not IsUnitType(udg_Knockback2DUnit, UNIT_TYPE_DEAD) and (udg_K2DUnbiasedCollision[i] or IsUnitAlly(udg_Knockback2DUnit, GetOwningPlayer(u))) and TriggerEvaluate(gg_trg_Knockback_2D) then
set udg_Knockback2DAngle = bj_RADTODEG * Atan2(GetUnitY(udg_Knockback2DUnit) - udg_K2DY, GetUnitX(udg_Knockback2DUnit) - udg_K2DX)
set udg_Knockback2DDistance = udg_K2DDistanceLeft[i]
set udg_Knockback2DBounces = udg_K2DBounce[i]
set udg_Knockback2DCollision = udg_K2DCollision[i]
if udg_K2DHeight[i] != 0.00 then
set udg_Knockback2DHeight = GetUnitFlyHeight(u) - GetUnitDefaultFlyHeight(u)
endif
set udg_Knockback2DLoopFX = udg_K2DFXModel[i]
set udg_Knockback2DTime = udg_K2DTimeLeft[i]
set udg_Knockback2DUnbiasedCollision = udg_K2DUnbiasedCollision[i]
call TriggerExecute(gg_trg_Knockback_2D)
endif
endloop
endif
set udg_K2DVelocity[i] = udg_K2DVelocity[i] - udg_K2DFriction[i]
else
call TriggerExecute(gg_trg_Knockback_2D_Destroy)
endif
endloop
set u = null
//Disable dummy after the loop finishes so it doesn't interfere with the map
call PauseUnit(udg_K2DDebrisKiller, true)
endfunction
//===========================================================================
function StartKnockback2DTimer takes nothing returns nothing
call TimerStart(udg_K2DTimer, udg_K2DTimeout, true, function Knockback2DLooper)
endfunction
function InitTrig_Knockback_2D_System takes nothing returns nothing
endfunction