Name | Type | is_array | initial_value |
CP_HiddenItems | item | Yes | |
CP_HiddenItemsIndex | integer | No | |
CP_Item | item | No | |
CP_Point | location | No | |
CP_PointIsWalkable | boolean | No | |
CP_Rect | rect | 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_AoEKB | boolean | No | |
KB3D_AoEKB_Power | real | No | |
KB3D_Arc | real | No | |
KB3D_AttackType | attacktype | No | |
KB3D_Counter | integer | No | |
KB3D_Damager | unit | No | |
KB3D_DamageType | damagetype | No | |
KB3D_DestroyTree | boolean | No | |
KB3D_DisableUnit | boolean | No | |
KB3D_EndFx | string | No | |
KB3D_EndwhenDead | boolean | No | |
KB3D_EndWhenHit | boolean | No | |
KB3D_FaceAngle | boolean | No | |
KB3D_Fx | string | No | |
KB3D_Fx_Attach | string | No | |
KB3D_Group | group | No | |
KB3D_HA | hashtable | No | |
KB3D_Harvester | unit | No | |
KB3D_iKB | boolean | No | |
KB3D_ImpactDamage | real | No | |
KB3D_Instances | integer | No | |
KB3D_KBTarget | boolean | No | |
KB3D_KillatEnd | boolean | No | |
KB3D_KillatTime | real | No | |
KB3D_KillifOutSider | boolean | No | |
KB3D_KillWhenHit | boolean | 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_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 | |
LD_Ability | abilcode | No | |
LD_AIndex | integer | No | |
LD_Alive | boolean | No | |
LD_Angle | real | Yes | |
LD_Animation | string | No | |
LD_AnimationTag | string | No | |
LD_AOE | real | Yes | |
LD_Attack | boolean | Yes | |
LD_AttackType | attacktype | No | |
LD_Cast | unit | Yes | |
LD_CastOwner | player | Yes | |
LD_Damage | real | Yes | |
LD_DamageType | damagetype | No | |
LD_DummyAbil | abilcode | No | |
LD_DummyBlue | real | No | |
LD_DummyDash | unit | Yes | |
LD_DummyGreen | real | No | |
LD_DummyRed | real | No | |
LD_DummySpace | real | Yes | |
LD_DummyTC | unit | Yes | |
LD_DummyTimer | real | No | |
LD_DummyTransparecy | real | No | |
LD_DummyWidth | real | No | |
LD_Enemy | boolean | No | |
LD_FloorEffect | string | No | |
LD_GroundUnit | boolean | No | |
LD_Group | group | Yes | |
LD_KB_Accel | real | No | |
LD_KB_Angle | real | Yes | |
LD_KB_DestroyTree | boolean | No | |
LD_KB_DisableUnit | boolean | No | |
LD_KB_FX | string | No | |
LD_KB_FX_Attach | string | No | |
LD_KB_Group | group | Yes | |
LD_KB_Offset | real | Yes | |
LD_KB_Outsiding | boolean | No | |
LD_KB_Pathable | boolean | No | |
LD_KB_Range | real | Yes | |
LD_KB_Speed | real | Yes | |
LD_KBDash | boolean | No | |
LD_Level | integer | Yes | |
LD_MaxIndex | integer | No | |
LD_MaxRange | real | Yes | |
LD_Mechanical | boolean | No | |
LD_MinRange | real | Yes | |
LD_NumberTargets | integer | Yes | |
LD_Range | real | Yes | |
LD_RangeCounter | real | Yes | |
LD_SpecialEffect | effect | Yes | |
LD_Speed | real | Yes | |
LD_Speed2 | real | Yes | |
LD_Structure | boolean | No | |
LD_TargetCount | integer | Yes | |
LD_TargetEffect | string | No | |
LD_TargetUnit | unit | Yes | |
LD_Wait | real | No | |
LD_WaitAttack | real | Yes | |
TempGroup | group | No | |
TempGroup2 | group | No | |
TempPoint | location | No | |
TempPoint2 | location | No | |
TempPoint3 | location | No | |
TempUnit | unit | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
Lightning Dash v0.5 Major changes made includes addition of system.
by: GoldenFlame
Version 0.5 Changelog - Added KB3D system v1.6.0
- Added conditions to segregate units that are to be knockback
- Added more configurations
Version 0.6 Changelog - Remove Shadow of thunder clap dummy.
- Added LD_Ability and LD_DummyAbility for easy configuration
- Change the model of Thunder Clap dummy into none.mdl
- Set dummy death art of dummy dash into none
- Abilties of Dummies aare added thru triggers to prevent errors
- blend time of dummies set to 0 also the movement speed is set into fly with 0 collision.
- vision of dumy units changed into 0
- added 1 caster in the map
Lightning Dash - Dashes through enemy dealing damage into it, slows and knockbac nearby unit,however
if there is a open unit it will dash into it and damage it again.
Pros - MUI Spell
- Lag Free
- Leak Free
- Configurable
Importing:
Go to:
File
Preferences
General
Check the box labelled ''Automatically create unknown variables while pasting trigger data''
and the copy the folder Knockback 3D and Lightning Dash v0.6
Also copy all custom units and abilty in the object editor.
Notes.
#1. Configure carefully the spell by altering the configurable in LD Config Trigger
#2. Do not change anything besides all the variables in LD Config.
//==========================================================================================================================================
Give credits to this people if you use this spell
Jad
Credits
Jad
Rheiko
Chobibo
//TESH.scrollpos=105
//TESH.alwaysfold=0
function Trig_Configurations_Ex_JASS_Actions takes nothing returns nothing
// Those Values are Required for the KB
// ------------------------------------------------
// ------------------------
// Knock-Backed Unit, the Knock-Backed Unit who all actions orbit around
set udg_KB3D_Unit = null
// ------------------------
// Max Range, Maximum Range possible of the Knock-Back
set udg_KB3D_Range = -0.00
// ------------------------
// Base KB Speed, Base Speed when starting the Knock-Back
set udg_KB3D_Speed = 0.00
// ------------------------
// Angle, The KB's line angle, this will be useless if KB3D_Targeted_Unit is not null
set udg_KB3D_Angle = 0.00
// ------------------------
// ------------------------------------------------
// Those Values are Optional for the KB
// NOTE: some values may depend on other to function, like LineDamage that needs "Damager, AttackType, DamageType, AoE" to function
// ------------------------------------------------
// ------------------------
// Ending Effect, an Effect created at the End of the KB on the KBed Unit
set udg_KB3D_EndFx = ""
// ------------------------
// AoE End Damage, Damage dealt to enemy units in the AoE at the End of the KB
set udg_KB3D_AoEEndDamage = 0.00
// ------------------------
// AoE KB, if true, KBs Enemy units within the AoE, Range, Speed, Angle, are automatic
set udg_KB3D_AoEKB = false
// ------------------------
// AoE KB Power, The Power of the AoE KB, default value is 1.00 (normal), Min value: 0.01, Max value: 3.00
set udg_KB3D_AoEKB_Power = 0.00
// ------------------------
// End when Dead, if true, the KB will end if the KBed unit is dead, TRUE by default
set udg_KB3D_EndwhenDead = false
// ------------------------
// KB the Target, When the Targeted Unit is hit, it will be KBed depending on the speed of the original KB
set udg_KB3D_KBTarget = false
// ------------------------
// Stop Time, Maximum Time the KB will last, Note that if the KBed unit is flying at this time, it will be stuck
set udg_KB3D_StopTime = 0.00
// ------------------------
// Kill at End, Kills the KBed Unit at the End of the KB
set udg_KB3D_KillatEnd = false
// ------------------------
// Kill at Time, When this time is reached, the KBed unit will be killed, if this number is higher than KB3D_StopTime, EndWhenDead will be automatically turned on no matter what
set udg_KB3D_KillatTime = 0.00
// ------------------------
// Acceleration, Speed Added/s to the KB speed
set udg_KB3D_Accel = 0.00
// ------------------------
// Allow going outside playable bounds, Allows the KBed unit to go out of the Playable Bounds, SAFETY notice: this will not crash the game
set udg_KB3D_AllowOutSiding = false
// ------------------------
// Angle, The KB's line angle, this will be useless if KB3D_Targeted_Unit is not null
set udg_KB3D_Angle = 0.00
// ------------------------
// Area of Effect, Range where the Line Damage is applied to units
set udg_KB3D_AoE = 0.00
// ------------------------
// Area of Effect Damage, Makes the KB3D_Damager, damage enemy units within KB3D_AoE by this value as a DPS
set udg_KB3D_AoEDamage = 0.00
// ------------------------
// Attack Type, Attack type of ALL damagings in the Instance
set udg_KB3D_AttackType = ATTACK_TYPE_MELEE
// ------------------------
// Damage Type, Damage type of ALL damagings in the Instance
set udg_KB3D_DamageType = DAMAGE_TYPE_MAGIC
// ------------------------
// Damager, Source of ALL damagings in the Instance
set udg_KB3D_Damager = null
// ------------------------
// Destroy Trees?, Destroy Trees around the KBed unit while he is KBed?
set udg_KB3D_DestroyTree = true
// ------------------------
// Disable Unit?, Disable the KBed Unit's Movement and Turning?
set udg_KB3D_DisableUnit = false
// ------------------------
// End When Hit?, Ends the KB if the KBed Unit hits the Targeted Unit
set udg_KB3D_EndWhenHit = false
// ------------------------
// Face KB Anlge, makes the KBed Unit Face the Anlge of the KB during the KB
set udg_KB3D_FaceAngle = false
// ------------------------
// Effect, Effect created on the Unit's Location if he is not flying, and applied on the Unit if he is flying on the Attach Point
set udg_KB3D_Fx = ""
// ------------------------
// Attachment Point, location on the KBed unit where Effects are attached
set udg_KB3D_Fx_Attach = ""
// ------------------------
// Impact Damage, Damaged dealt to the KBed Unit if he hits an obstacle
set udg_KB3D_ImpactDamage = 0.00
// ------------------------
// intelligent KB, Enables the intelligent features of KB3D, see Main Code Comments for more info
set udg_KB3D_iKB = true
// ------------------------
// Kill When Hit?, Kills the KBed Unit if he hits the Targeted Unit, Automatically set EndWhenHit to true
set udg_KB3D_KillWhenHit = false
// ------------------------
// Kill if Out of Playable Bounds, Kills the KBed Unit if he gets out of Playable Bounds, this automatically sets KB3D_AllowOutSiding to TRUE
set udg_KB3D_KillifOutSider = false
// ------------------------
// Line Damage, Damage dealt to enemy units in the AoE around the KBed Unit
set udg_KB3D_LineDamage = 0.00
// ------------------------
// Loop Damage, DPS dealt to the KBed Unit
set udg_KB3D_LoopDamage = 0.00
// ------------------------
// Target Damage, Damage dealt to the Targeted Unit when both KBed Unit and Targeted Unit hit each other, only happens once
set udg_KB3D_TargetDamage = 0.00
// ------------------------
// Targeted Unit, if not null, makes the KBed Unit act like a homing missile targeting this unit, it also used for other functions
set udg_KB3D_Targeted_Unit = null
// ------------------------
// Trail Effect, Effect Attached on the KBed Unit all along the Knock-Back and Destroyed at the end of the KB
set udg_KB3D_TrailFx = ""
// ------------------------
// Stop at Unpathable, Makes it impossible for the KBed Unit to path throught Unpathable Terrain
set udg_KB3D_UnpathableStop = true
// ------------------------
// Z Offset, Max Flying Height reached while Knockbacking
set udg_KB3D_Zoffset = 0.00
// ------------------------
// ------------------------------------------------
// Registed All of the Settings
// Note that this function MUST check conditions of the trigger, or else, nothing will be registered
call TriggerEvaluate( udg_KB3D_Registration )
// You can use the following to know how much the knock-back will last -- this can vary if the KB is homed on a moving unit
set udg_KB3D_Time = udg_KB3D_Time
endfunction
//===========================================================================
function InitTrig_Configurations_Ex_JASS takes nothing returns nothing
endfunction
//TESH.scrollpos=192
//TESH.alwaysfold=0
/////////////////////////////////////////////////////////////////////////////
// //
// Knock-Back 3D v. 1.6.0 [JASS - GUI] //
// by JAD aka DotCa //
// //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// //
// 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 have default values: //
// //
// - KB3D_EndWhenDead ==> TRUE by default //
// - KB3D_UnpathaableStop ==> TRUE by default //
// - KB3D_iKB ==> TRUE by default //
// - KB3D_AttackType ==> ATTACK_TYPE_NORMAL by default //
// - KB3D_DamageType ==> DAMAGE_TYPE_MAGIC by default //
// - KB3D_AoEKB_Power ==> 1.00 by default //
// - Other Booleans are FALSE by default //
// //
// The System also uses Always positive values for some configurations //
// to not make the knockback go worng, those configurations are: //
// //
// "KB3D_Range" - "KB3D_Speed" - "KB3D_ZOffset" - "KB3D_AoE" //
// //
/////////////////////////////////////////////////////////////////////////////
// //
// 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 //
// -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 approximative //
// height (Z) of the KBed Unit, the damage won't occure //
// -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 this Trigger //
// 3. Congratulations, the System is now implemented in your map //
// //
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// //
// How to Use? //
// //
// 1. There are 5 Examples of use in the KB3D Example Folder //
// 2. Documentations are there in each of the 5 examples 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 SaveAttackTypeHandle takes hashtable hash, integer parentKey, integer childKey, attacktype at returns nothing
call SaveInteger(hash, parentKey, childKey, GetHandleId(at))
endfunction
function LoadAttackTypeHandle takes hashtable hash, integer parentKey, integer childKey returns attacktype
return ConvertAttackType(LoadInteger(hash, parentKey, childKey))
endfunction
function SaveDamageTypeHandle takes hashtable hash, integer parentKey, integer childKey, damagetype dt returns nothing
call SaveInteger(hash, parentKey, childKey, GetHandleId(dt))
endfunction
function LoadDamageTypeHandle takes hashtable hash, integer parentKey, integer childKey returns damagetype
return ConvertDamageType(LoadInteger(hash, parentKey, childKey))
endfunction
function KB3D_AlwaysNeg takes real R returns real//Used for redering some values always lower than 0
if R > 0 then
return R * -1
endif
return R
endfunction
function KB3D_AlwaysPos takes real R returns real//Used for redering some values always higher than 0
if R < 0 then
return R * -1
endif
return R
endfunction
function KB3D_InBetween takes real Min, real R, real Max returns real//Used to maintain values between 2 others
if R < Min then
return Min
elseif R > Max then
return Max
endif
return R
endfunction
function KB3D_IsInBetween takes real Min, real R, real Max returns boolean//Used to maintain values between 2 others
if R < Min then
return false
elseif R > Max then
return false
endif
return true
endfunction
function KB3D_Approx takes unit U, unit U2, integer Loop returns boolean
local real r = LoadReal(udg_KB3D_HA, 29, Loop) / 2
local real r1 = GetUnitFlyHeight(U2)
return KB3D_IsInBetween(r1-r, GetUnitFlyHeight(U), r1+r)
endfunction
function KB3D_RegisterUnitCollision takes unit u, real x, real y, integer i returns real //Somehow a library for UnitCollision function
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//Used to know the collision of a unit //Credits to Netharus// converted by malhorne
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 //Checks if a destructable is a tree
return (IssueTargetOrder( udg_KB3D_Harvester, "harvest", D ) and (IssueImmediateOrder(udg_KB3D_Harvester, "stop")) )
endfunction
function KB3D_KillEnumDest takes nothing returns nothing //Function used in Enumeration loop
local destructable D = GetEnumDestructable()
if GetWidgetLife(D)>0 and ( KB3D_Tree_Check(D) ) and (GetUnitFlyHeight(LoadUnitHandle(udg_KB3D_HA, 0, R2I(udg_KB3D_Reals[0]))) < GetDestructableOccluderHeight(D)) then
call KillDestructable(D)
set D = null
endif
endfunction
function KB3D_CircleTreeKill takes real radius, real x, real y returns nothing//To destroy trees around the unit
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_CW_Loop takes nothing returns nothing//function for item group loop for Check Walkability System
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//Check Walkability System by PnF
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) <= 100) and (not IsTerrainPathable(x, y, PATHING_TYPE_WALKABILITY)))
endfunction
function KB3D_ClearInstance takes integer i returns nothing
local integer x = 0
call DestroyGroup(LoadGroupHandle(udg_KB3D_HA, 27, 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 MoveUnit_3D takes unit U, real x, real y, real z, real MaxZ, boolean P, boolean OS, boolean KiOS returns nothing
call SetUnitFlyHeight(U, KB3D_InBetween(GetUnitDefaultFlyHeight(U), z, 9999), 0)
if ( not(P) or ( KB3D_CW(x, y) ) or (OS) ) then
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]))
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]))
endif
endif
endfunction
function KB3D_LineDamageLoop takes nothing returns boolean
local unit U = GetFilterUnit()
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
local attacktype AType = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
local damagetype DType = LoadDamageTypeHandle(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 ( not( IsUnitType(U, UNIT_TYPE_STRUCTURE) ) and not( IsUnitType(U, UNIT_TYPE_MECHANICAL) ) and( IsUnitEnemy(U, GetOwningPlayer(U1))) 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, WEAPON_TYPE_WHOKNOWS)
elseif KB3D_Approx(U, U1, Loop) then
call UnitDamageTarget(Damager, U, LineD, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
endif
endif
set G = null
set U = null
set U1 = null
set Damager = null
set AType = null
set DType = null
return false
endfunction
function KB3D_AoEDamageLoop takes nothing returns boolean
local unit U = GetFilterUnit()
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
local attacktype AType = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
local damagetype DType = LoadDamageTypeHandle(udg_KB3D_HA, 21, Loop)
local real AoED = LoadReal(udg_KB3D_HA, 32, Loop)
local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
if ( not( IsUnitType(U, UNIT_TYPE_STRUCTURE) ) and not( IsUnitType(U, UNIT_TYPE_MECHANICAL) ) and( IsUnitEnemy(U, GetOwningPlayer(U1))) ) then
if not(LoadBoolean(udg_KB3D_HA, 44, Loop)) then
call UnitDamageTarget(Damager, U, AoED * 0.031250000, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
elseif KB3D_Approx(U, U1, Loop) then
call UnitDamageTarget(Damager, U, AoED * 0.031250000, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
endif
endif
set U = null
set U1 = null
set Damager = null
set AType = null
set DType = null
return false
endfunction
function KB3D_AoEEndDamage takes nothing returns boolean
local unit U = GetFilterUnit()
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit Damager = LoadUnitHandle(udg_KB3D_HA, 22, Loop)
local attacktype AType = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
local damagetype DType = LoadDamageTypeHandle(udg_KB3D_HA, 21, Loop)
local real D = LoadReal(udg_KB3D_HA, 38, Loop)
local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
if ( not( IsUnitType(U, UNIT_TYPE_STRUCTURE) ) and not( IsUnitType(U, UNIT_TYPE_MECHANICAL) ) and( IsUnitEnemy(U, GetOwningPlayer(U1))) ) then
if not(LoadBoolean(udg_KB3D_HA, 44, Loop)) then
call UnitDamageTarget(Damager, U, D, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
elseif KB3D_Approx(U, U1, Loop) then
call UnitDamageTarget(Damager, U, D, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
endif
endif
set U = null
set U1 = null
set Damager = null
set AType = null
set DType = null
return false
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_Accel = -2000
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 = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
set udg_KB3D_DamageType = LoadDamageTypeHandle(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_Fx_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_Speed = LoadReal(udg_KB3D_HA, 2, Loop)/0.031250000
set udg_KB3D_Unit = U1
set udg_KB3D_Zoffset = LoadReal(udg_KB3D_HA, 3, Loop)-GetUnitDefaultFlyHeight(U2) / 1.85
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 = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
set udg_KB3D_DamageType = LoadDamageTypeHandle(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_Fx_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 = 9999
set udg_KB3D_Speed = udg_KB3D_AoE*2*P
set udg_KB3D_Unit = U1
set udg_KB3D_Zoffset = 1.5*(udg_KB3D_AoE - SquareRoot(x2 * x1 + y2 * y1)*3.14159/180)*P
call TriggerEvaluate( udg_KB3D_Registration )
endfunction
function KB3D_AoEKB takes nothing returns boolean
local unit U = GetFilterUnit()
local integer Loop = R2I(udg_KB3D_Reals[0])
local unit U1 = LoadUnitHandle(udg_KB3D_HA, 0, Loop)
local real r
if ( not( IsUnitType(U, UNIT_TYPE_STRUCTURE) ) and not( IsUnitType(U, UNIT_TYPE_MECHANICAL) ) and( IsUnitEnemy(U, GetOwningPlayer(U1))) ) 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
set U = null
set U1 = null
return false
endfunction
function KB3D_Loop takes integer Loop returns nothing//Main Trigger Loop
//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
local real y
local real 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 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 = false
local boolean b = false
local boolean b1
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 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 attacktype AType = LoadAttackTypeHandle(udg_KB3D_HA, 20, Loop)
local damagetype DType = LoadDamageTypeHandle(udg_KB3D_HA, 21, Loop)
local group g
//end of locals
//Loop Damage Execution
if not (LoopD == 0) and not (Damager == null ) then
call UnitDamageTarget(Damager, U, LoopD, true, false, AType, DType, WEAPON_TYPE_WHOKNOWS)
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
//Make Unit Face Angle
if LoadBoolean(udg_KB3D_HA, 31, Loop) then
call SetUnitFacing(U, Angle * (180 / 3.14159))
endif
//Calculate 3D coordinates
set Speed = Speed + ( Accel )//Increase the KB speed depending on the Acceleration
set Range = Range - ( KB3D_AlwaysPos(Speed) )//Decrease distance traveled
set ZSpeed = ZSpeed + ( ZAccel )//change the fly changing rate //Acceleration is for smoothness
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 z = Z + ( ZSpeed * 0.031250000 )//new Z Offset of the KBed unit
set ZT = ZT + ( ZSpeed * 0.031250000 )//Total Height Changings
//Move the unit according to the X, Y, Z
call MoveUnit_3D(U, x, y, z, Zoffset, UnpathableStop, OS, KiOS)
//Destroy Trees around the Unit depending on the unit's Collision Size
if (DestroyTree) then
set udg_KB3D_Reals[0] = I2R(Loop)
call KB3D_CircleTreeKill( KB3D_InBetween(100, 4 * KB3D_GetUnitCollision(U), 500), x, y )
endif
//Create the Effect on the unit
if not (Fx == "") then
if ( z > 20 ) then
if not (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 (not (ImpactD == 0) and not (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, WEAPON_TYPE_WHOKNOWS)//Apply Impact Damage to the unit
call SaveBoolean(udg_KB3D_HA, 23, Loop, false)
endif
endif
//Initiate Line Damage
if not(LineD == 0) and not(Damager == null) and not(AoE == 0) then
set g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_Group, x, y, KB3D_AlwaysPos(AoE), Filter(function KB3D_LineDamageLoop))
call DestroyGroup(g)
set g = null
endif
//Initiate AoE Damage
if not(AoED == 0) and not(Damager == null) and not(AoE == 0) then
set g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_Group, x, y, KB3D_AlwaysPos(AoE), Filter(function KB3D_AoEDamageLoop))
call DestroyGroup(g)
set g = null
endif
//Disable the unit partially
if ( DisableUnit ) then
call SetUnitPropWindow(U, 0)
call SetUnitTurnSpeed(U, 0)
endif
//Initiate Target-Related Actions
if not(Target == null) then
if (SquareRoot ( ( GetUnitX(Target) - x ) * ( GetUnitX(Target) - x ) + ( GetUnitY(Target) - y ) * ( GetUnitY(Target) - y ) ) < Speed) 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, WEAPON_TYPE_WHOKNOWS)
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 not(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)
//set B to if Stop time is exceeded
set B = ( not(StopTime == 0) and ( Time > StopTime ) )
//iKB interference
set b1 = LoadBoolean(udg_KB3D_HA, 45, Loop) and (Speed <= 0)
//Inititate End of the KB
if ( b1 or ( Range <= 0 ) or ( B ) ) then
call SaveBoolean(udg_KB3D_HA, 100, Loop, false)
set udg_KB3D_Instances = udg_KB3D_Instances - 1
if ( GetWidgetLife(U) <= 0 ) 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) then
call DestroyEffect(LoadEffectHandle(udg_KB3D_HA, 14, Loop))
endif
set b = true
elseif ( GetWidgetLife(U) <= 0 ) and (EndwhenDead) then
call SaveBoolean(udg_KB3D_HA, 100, Loop, false)
set udg_KB3D_Instances = udg_KB3D_Instances - 1
if ( GetWidgetLife(U) <= 0 ) 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) then
call DestroyEffect(LoadEffectHandle(udg_KB3D_HA, 14, Loop))
endif
set b = true
endif
//variable b refers to if the KB has ended
//AoE damage at the end of the KB
if (b) and not(AoEEndDamage == 0) and not(Damager == null) and not(AoE == 0) then
set g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_Group, x, y, KB3D_AlwaysPos(AoE), Filter(function KB3D_AoEEndDamage))
call DestroyGroup(g)
set g = null
endif
//AoE Knock-back at the end of the KB
if (b) and (AoEKB) and not(AoE == 0) then
set g = CreateGroup()
set udg_KB3D_Reals[0] = I2R(Loop)
call GroupEnumUnitsInRange(udg_KB3D_Group, x, y, KB3D_AlwaysPos(AoE), Filter(function KB3D_AoEKB))
call DestroyGroup(g)
set g = null
endif
//Create End Effect
if b and not(EndFx == "") then
if ( z > 20 ) and not (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
//Kill at End
if b and (KillatEnd) then
call KillUnit(U)
endif
//Clear Instance
if b then
call KB3D_ClearInstance(Loop)
endif
//Clear locals
set U = null
set Target = null
set Damager = null
endfunction
function KB3D_Loop_Actions takes nothing returns nothing//loop triggerer
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_Registration takes nothing returns boolean//register an instance in the System
local real Time
local real R
local real R1
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, KB3D_AlwaysPos(udg_KB3D_Range), KB3D_AlwaysPos(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, KB3D_AlwaysPos(udg_KB3D_Speed), KB3D_AlwaysPos(udg_KB3D_Speed))
endif
set udg_KB3D_Counter = udg_KB3D_Counter + 1
set udg_KB3D_Instances = udg_KB3D_Instances + 1
set udg_KB3D_Zoffset = (1.85 * KB3D_AlwaysPos(udg_KB3D_Zoffset)) + GetUnitDefaultFlyHeight(udg_KB3D_Unit)
set udg_KB3D_StopTime = KB3D_AlwaysPos(udg_KB3D_StopTime)
set udg_KB3D_KillatTime = KB3D_AlwaysPos(udg_KB3D_KillatTime)
set udg_KB3D_AoE = KB3D_AlwaysPos(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 )
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_Fx_Attach )
set udg_KB3D_Speed = KB3D_InBetween(0.01, KB3D_AlwaysPos(udg_KB3D_Speed), KB3D_AlwaysPos(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 = (( -2*(udg_KB3D_Speed) + SquareRoot((4*udg_KB3D_Speed) + (8*udg_KB3D_Accel*udg_KB3D_Range ) ) / (2*udg_KB3D_Accel) ))//calculating time for the knockback if Acceleration > 0
endif
if ( udg_KB3D_Accel < 0 ) then
set R = ( - 1 * (udg_KB3D_Speed) / udg_KB3D_Accel )
set R1 = (0.5 * udg_KB3D_Accel * R * R) + ((udg_KB3D_Speed) * R)
if R1 < udg_KB3D_Range then
set Time = R//calculating time for the knockback if Acceleration < 0 and if the speed will be = 0 before reaching max range
else
set Time = KB3D_AlwaysPos(( -2*(udg_KB3D_Speed) + SquareRoot(KB3D_AlwaysPos((4*(udg_KB3D_Speed)*(udg_KB3D_Speed)) + (8*udg_KB3D_Accel*udg_KB3D_Range) )) ) / (2*udg_KB3D_Accel) )//calculating time for the knockback if Acceleration < 0 and if the speed will be > 0 before reaching max range
endif
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, (udg_KB3D_Zoffset / ( Time / 2)) )
call SaveReal( udg_KB3D_HA, 13, udg_KB3D_Counter, ( -1 * udg_KB3D_Zoffset / ( Time / 2) ) / ( Time / 2) * 0.031250000 )
if not (udg_KB3D_TrailFx == "") and not (udg_KB3D_Fx_Attach == "") then
call SaveEffectHandle(udg_KB3D_HA, 14, udg_KB3D_Counter, AddSpecialEffectTarget(udg_KB3D_TrailFx, udg_KB3D_Unit, udg_KB3D_Fx_Attach))
endif
call SaveReal( udg_KB3D_HA, 15, udg_KB3D_Counter, GetUnitDefaultPropWindow(udg_KB3D_Unit) )
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 SaveAttackTypeHandle( udg_KB3D_HA, 20, udg_KB3D_Counter, udg_KB3D_AttackType )
call SaveDamageTypeHandle( udg_KB3D_HA, 21, udg_KB3D_Counter, 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 )
if (udg_KB3D_KillWhenHit) then
set udg_KB3D_EndWhenHit = true
endif
call SaveBoolean( udg_KB3D_HA, 25, udg_KB3D_Counter, udg_KB3D_EndWhenHit )
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, KB3D_AlwaysPos(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 )
if (udg_KB3D_KillifOutSider) then
set udg_KB3D_AllowOutSiding = true
endif
call SaveBoolean( udg_KB3D_HA, 34, udg_KB3D_Counter, udg_KB3D_AllowOutSiding )
if udg_KB3D_KillatTime > udg_KB3D_StopTime then
set udg_KB3D_EndwhenDead = true
endif
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, 45, udg_KB3D_Counter, udg_KB3D_Speed>0 )
call SaveBoolean( udg_KB3D_HA, 46, udg_KB3D_Counter, udg_KB3D_KillatEnd )
//Nulling
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 = false
set udg_KB3D_DisableUnit = false
set udg_KB3D_EndWhenHit = false
set udg_KB3D_Fx = ""
set udg_KB3D_EndFx = ""
set udg_KB3D_Fx_Attach = ""
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
if ( udg_KB3D_Counter == 1 ) then
call TimerStart(udg_KB3D_Timer, 0.031250000, true, function KB3D_Loop_Actions )
endif
set udg_KB3D_Time = Time
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')
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
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 = false
set udg_KB3D_DisableUnit = false
set udg_KB3D_EndWhenHit = false
set udg_KB3D_Fx = ""
set udg_KB3D_EndFx = ""
set udg_KB3D_Fx_Attach = ""
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_iKB = true
set udg_KB3D_iKB = 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_KillatEnd = false
set udg_KB3D_AoEKB_Power = 1.00
endfunction