Name | Type | is_array | initial_value |
AfterDamageEvent | real | No | |
Beam_CannotHitMagicImmune | boolean | Yes | |
Beam_Damage | real | Yes | |
Beam_DamageStack | real | Yes | |
Beam_group1 | group | No | |
Beam_group2 | group | No | |
Beam_group3 | group | No | |
Beam_group4 | group | No | |
Beam_group5 | group | No | |
Beam_group6 | group | No | |
Beam_group7 | group | No | |
Beam_HitStack | integer | Yes | |
Beam_ImpactOffset | integer | No | |
Beam_Interval | integer | Yes | |
Beam_IntervalDMG | integer | Yes | |
Beam_IntervalDMGTrigger | integer | Yes | |
Beam_IntervalDPS | integer | Yes | |
Beam_IntervalFX | integer | Yes | |
Beam_IsABeamer | boolean | Yes | |
Beam_IsChargingDone | boolean | Yes | |
Beam_IsFollowing | boolean | Yes | |
Beam_LastDamage | real | Yes | |
Beam_LastOrder | ordercode | Yes | |
Beam_MainGroup | group | No | |
Beam_OrderWidget | unit | Yes | |
Beam_ReacquireTarget | boolean | Yes | |
Beam_RestoreLastOrder | boolean | Yes | |
Beam_TerminateBeam | boolean | Yes | |
Beam_X | real | Yes | |
Beam_X_Moved | real | Yes | |
Beam_Y | real | Yes | |
Beam_Y_Moved | real | Yes | |
BeamCaster | unit | Yes | |
BeamConfig_AbilityCasterFX | abilcode | Yes | |
BeamConfig_AbilityMoverFX | abilcode | Yes | |
BeamConfig_APLHA | real | Yes | |
BeamConfig_AttackType | attacktype | Yes | |
BeamConfig_AuxiliaryTurret | unit | Yes | |
BeamConfig_BeamType | string | Yes | |
BeamConfig_BLUE | real | Yes | |
BeamConfig_CasterAngle | real | Yes | |
BeamConfig_CasterHeight | real | Yes | |
BeamConfig_CasterOffset | real | Yes | |
BeamConfig_CasterPeriodicFX | string | Yes | |
BeamConfig_CasterScale | real | Yes | |
BeamConfig_ChargeLimit | integer | Yes | |
BeamConfig_ChargeUpFX | string | Yes | |
BeamConfig_DamageAOE | real | Yes | |
BeamConfig_DamageType | integer | Yes | |
BeamConfig_DpsIncrease | real | Yes | |
BeamConfig_DpsLimit | real | Yes | |
BeamConfig_DummyID | integer | Yes | |
BeamConfig_DummyString | string | Yes | |
BeamConfig_DummyType | unitcode | Yes | |
BeamConfig_FollowRange | real | Yes | |
BeamConfig_GracePeriod | integer | Yes | |
BeamConfig_GREEN | real | Yes | |
BeamConfig_HitAll | boolean | Yes | |
BeamConfig_HitsPerSecond | integer | Yes | |
BeamConfig_ImpactPeriodicFX | string | Yes | |
BeamConfig_IntervalFXLimit | integer | Yes | |
BeamConfig_IsImmobilised | boolean | Yes | |
BeamConfig_IsMoverGrounded | boolean | Yes | |
BeamConfig_MoverScale | real | Yes | |
BeamConfig_NewTargetOnDeath | boolean | Yes | |
BeamConfig_Range | real | Yes | |
BeamConfig_RED | real | Yes | |
BeamConfig_SweepAOE | real | Yes | |
BeamConfig_SweepSpeed | real | Yes | |
Beamer | unit | No | |
BeamerPick | unit | No | |
BeamerPick_cancel | unit | No | |
BeamEvent | real | No | |
BeamEvent_Caster | unit | No | |
BeamEvent_Damage | real | No | |
BeamEvent_Lightning | lightning | No | |
BeamEvent_Mover | unit | No | |
BeamEvent_Source | unit | No | |
BeamEvent_Target | unit | No | |
BeamEvent_Target_OLD | unit | No | |
BeamID | integer | No | |
BeamIDAbility | integer | No | |
BeamLightning | lightning | Yes | |
BeamMover | unit | Yes | |
BeamOwner | player | Yes | |
BeamSource | unit | Yes | |
BeamStop | boolean | Yes | |
BeamTarget | unit | Yes | |
ChainBeams_Beam | lightning | Yes | |
ChainBeams_ChainActive | boolean | Yes | |
ChainBeams_ChainConnector | unit | Yes | |
ChainBeams_ChainSource | unit | Yes | |
ChainBeams_Count | integer | Yes | |
ChainBeams_CurrentTargets | group | Yes | |
ChainBeams_ID | integer | No | |
ChainBeams_ID2 | integer | No | |
ChainBeams_NextInLink | unit | Yes | |
ChainBeams_TempGroup | group | No | |
ChainBeams_UnitToFollow | unit | Yes | |
ClearDamageEvent | trigger | No | |
DamageBlockingAbility | abilcode | No | |
DamageEvent | real | No | |
DamageEventAmount | real | No | |
DamageEventOverride | boolean | No | |
DamageEventPrevAmt | real | No | |
DamageEventSource | unit | No | |
DamageEventsWasted | integer | No | |
DamageEventTarget | unit | No | |
DamageEventTrigger | trigger | No | |
DamageEventType | integer | No | |
DamageModifierEvent | real | No | |
DamageTypeBeam | integer | No | |
DamageTypeBlocked | integer | No | |
DamageTypeCriticalStrike | integer | No | |
DamageTypeExplosive | integer | No | |
DamageTypeHeal | integer | No | |
DamageTypeHPDrain | integer | No | |
DamageTypeReduced | integer | No | |
DamageTypeSingleShot | integer | No | |
DEMO_Group | group | No | |
DEMO_ID | integer | No | |
DEMO_ID_2 | integer | No | |
DEMO_IsChainLink | boolean | Yes | |
DEMO_loc | location | No | |
DEMO_loc2 | location | No | |
DEMO_OrbAngle | real | Yes | |
DEMO_OrbDistance | real | Yes | |
DEMO_OrbGroup | group | No | |
DEMO_OrbHeight | real | Yes | |
DEMO_OrbSource | unit | Yes | |
DEMO_OrbSpeed | real | Yes | |
DEMO_pick | unit | No | |
DEMO_Player | player | No | |
DEMO_Region | rect | No | |
DEMO_ZappersMain | group | No | |
DmgEvLife | real | No | |
DmgEvPrevLife | real | No | |
DmgEvRecursionLevel | integer | No | |
DmgEvRecursionN | integer | No | |
DmgEvRunning | boolean | No | |
DmgEvStarted | boolean | No | |
DmgEvTimer | timer | No | |
DmgEvTrig | trigger | No | |
DmgEvUnit | unit | No | |
DoNotClearNext | boolean | No | |
GUCS_Hash | hashtable | No | |
GUCS_Size | integer | No | |
GUCS_U | unit | No | |
IsDamageSpell | boolean | No | |
LastDamageHP | real | No | |
LastDmgN | integer | No | |
LastDmgPrevAmount | real | Yes | |
LastDmgPrevType | integer | Yes | |
LastDmgSource | unit | Yes | |
LastDmgTarget | unit | Yes | |
LastDmgValue | real | Yes | |
LastDmgWasSpell | boolean | Yes | |
NextDamageOverride | boolean | No | |
NextDamageType | integer | No | |
SpellDamageAbility | abilcode | No | |
UDex | integer | No | |
UDexGen | integer | No | |
UDexNext | integer | Yes | |
UDexPrev | integer | Yes | |
UDexRecycle | integer | No | |
UDexUnits | unit | Yes | |
UDexWasted | integer | No | |
UnitDamageRegistered | boolean | Yes | |
UnitIndexerEnabled | boolean | No | |
UnitIndexEvent | real | No | |
UnitIndexLock | integer | Yes |
//TESH.scrollpos=0
//TESH.alwaysfold=0
PERSISTENT BEAM v3.2 by Spellbound
Persistent Beam will attempt to mimic how beams work in Starcraft 2. Any unit configured to use Persistent Beam will fire a constant stream of energy at its
target, dealing damage X times per second. The beam can be configured to lock onto the target, or follow the target around at a set speed, dealing area of
effect damage, like the Colossus in Starcraft 2 Alpha.
REQUIREMENTS:
Unit Indexer by Bribe http://www.hiveworkshop.com/forums/spells-569/gui-unit-indexer-1-2-0-2-a-197329/
Damage Engine by Bribe http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-v3-5-4-1-a-201016/
GetUnitCollisionSize by Almia http://www.hiveworkshop.com/forums/spells-569/getunitcollisionsize-gui-v1-4-a-225448/
HOW TO IMPORT:
* import the dummy.mdx model (credits to Vexorian) to your map.
* import the dummy unit from the object editor to your map.
* Make sure that in File > Preferences > General, the box next to 'Automatically create unknown variables while pasting trigger data' is ticked.
* Copy Unit Indexer to your map.
* Copy Damage Engine to your map. Go to the Object Editor and copy the abilities 'Cheat Death Ability (+500,000)' and 'Detect Spell Damage' to your map.
* Set those abilities to the proper variabls in Damage Engine. Eg: Set DamageBlockingAbility = Cheat Death Ability (+500,000)
Set SpellDamageAbility = Detect Spell Damage
* If you were already using Damage Engine, or obtained it via the link above, add Set DamageTypeBeam = 5 to Damage Engine list of damage types.
The value of DamageTypeBeam may be changed to any number if 5 is already in use. //DamageTypeHPDrain is optional. Demo purposes.
* Copy GetUnitCollisionSize to your map.
* Copy the Variable Creator to your map.
* Copy the Persistent Beam folder to your map.
* Setup your units inside (see HOW TO GIVE UNITS PERSISTENT BEAM).
* Go to Persistent Beam Ability Exceptions and add whatever abilities you want to the list that you want to not interrupt beams.
* You are done!
PS: I am using custom lightning effects in this map. Feel free to import them if your want, but keep in mind this is not the complete list.
Credits to WILL THE ALMIGHTY for the green laser special effect.
HOW TO GIVE UNITS PERSISTENT BEAM:
* In the Object Edtitor, change Projectile Speed to 10000 and Projectile Art to none.
* The system averages a dps depending on your the Cooldown Time of the unit, so you can set that to whatever avlue you desire.
However, a long Cooldown Time will delay when the charge-up begins, so avoid setting it higher than 1 second. 0.25 or 0.5 are good compromises, but calculate your dps accordingly.
* 'In Persistent Beam Setup' copy/paste one of the if/then/else blocks and configure it with your unit.
* Refer to the variables below for an explanation of what they do.
VARIABLES:
BeamConfig_BeamType[UDex] // the lightning effect
BeamConfig_RED[UDex] //For Lightning Effect colour. Use 0.00 - 1.00 as value. Eg: 0.50 is 50%.
BeamConfig_GREEN[UDex] //For Lightning Effect colour. Use 0.00 - 1.00 as value. Eg: 0.50 is 50%.
BeamConfig_BLUE[UDex] //For Lightning Effect colour. Use 0.00 - 1.00 as value. Eg: 0.50 is 50%.
BeamConfig_ALPHA[UDex] //For Lightning Effect TRANSPARENCY. Use 0.00 - 1.00 as value. 0.00 is completely invisible. 1.00 is maximum opacity (fully visible).
BeamConfig_AbilityCasterFX[UDex] // ability variable. I use this to add special effects so that you mastack multiple effects.
BeamConfig_AbilityTargetFX[UDex] // same as above. This one is onto the move.
BeamConfig_ImpactPeriodicFX[UDex] // use this to create recurring effects on the mover. The mover is locked onto the target.
BeamConfig_CasterPeriodicFX[UDex] // use this to create recurring effects on the caster. The caster is locked onto the attacker and can be offset to match with the attacker's weapon position.
BeamConfig_ChargeUpFX[UDex] // FX for charging up. Use special effects that animate on death, like a missile. Same for the above two.
BeamConfig_AttackType[UDex] = Magic // sets the attack type of the attacker. This is required for AoE damage, since different units have different armour types.
BeamConfig_DamageType[UDex] = DamageTypeBeam // The damage type that Damage Engine will deal. This is useful if you want something different, like a life drain. See Gargoyle.
BeamConfig_HitsPerSecond[UDex] // This is hoe many times you want the beam to strike in 1 second. A value of 3 is default. This does not alter damage.
BeamConfig_IntervalFXLimit[UDex] = 4 //This sets how frequently the charge/impact/caster effects will happen. Lower than 3 may drop your framerate if you have too many Beamers attacking at once.
BeamConfig_CasterScale[UDex] = 100.00 // scale of the caster dummy unit. A value of 100 is 100%.
BeamConfig_MoverScale[UDex] = 140.00 // scale of the mover dummy unit.
BeamConfig_ChargeLimit[UDex] = 66 // timer clicks ever 0.03 seconds, so 33 intervals is 0.99 seconds, aka 1 seconds for simplicity's sake. 66 intervals = 2 seconds.
BeamConfig_CasterOffset[UDex] = 0.00 // by how much to offset the caster so that it's aligned with the attacker's weapon. Set to 0 to disregard.
BeamConfig_CasterAngle[UDex] = 0.00 // by how many degrees to angle the caster if CasterOffset is more than 0.00. Use this to position the caster with a unit's weapon or hand.
BeamConfig_CasterHeight[UDex] = 260.00 // changing height of casting to fit with attacker's model/weapon/etc.
BeamConfig_Range[UDex] = 800.00 // attack range of the attacker. If target goes beyond that, the beam is destroyed. Avoid setting that to a different value than your unit's attack range.
BeamConfig_SweepSpeed[UDexD] = 300.00 // speed at which the beam follows the target. If the value is 0, the beam will lock on to the target.
BeamConfig_DamageAOE[UDex] = 100.00 // the AoE around the mover that will pick units to damage. If the value is 0 the damage will apply ONLY to the target.
BeamConfig_SweepAOE[UDex] = 600.00 // the scan range for when the mover reacquires new targets. If new targets are outside that scan range, the beam resets.
BeamConfig_FollowRange[UDex] = 400.00 // the range at which a beamer will follow another unit.
BeamConfig_IsImmobilised[UDex] // if this is TRUE, then Beamer will have to stay stationary to fire. If FALSE, the Beamer may move around while firing. Use Stop command to end beam.
BeamConfig_IsMoverGrounded[UDex] = True // if this is TRUE, the mover will be constrained to the ground. Refer to the Shade's attack to see how this can be useful.
BeamConfig_HitAlt[UDex] = True // if this is TRUE, then your beam will hit ground and air units simultaneously. Make sure your unit can also target both in the object editor.
BeamConfig_AuxillaryTurret[UDex] // if you have a moving turret, set this to a unit so the beam fires from it. Leave at No Unit until your turret is created. Refer to the Owl Scout config.
BeamConfig_DummyType[UDex] = Dummy Unit (0 Collision) // this is necessary for the code to work, but also comes with the advantage of allowing you to have dummies with different collision,
// allowing you to center it correctly on a model that is off-center, with a collision of 16 on your dummy rather than 0.
NB:
set udg_Beam_IsABeamer[udg_UDex] = true // make sure you have this in your if/then/else config block and ensure it's always set to TRUE or else the beams won't fire.
BEAM EVENTS
Since v2.8, Persistent Beam has events that you may use to catch when beams begin charge-up, every charge-up interval, charge-up end/beam creation,
beam interval, beam retargeting, & beam end.
Game - BeamEvent becomes Equal to 1.00 // Fires when the Beam begins chargeup
Game - BeamEvent becomes Equal to 1.50 // Fires every 0.03 seconds of chargeup time.
Game - BeamEvent becomes Equal to 2.00 // Fires when chargeup completes and the beam is created.
Game - BeamEvent becomes Equal to 2.50 // Fires every 0.03 seconds of beam time, after chargeup is complete
Game - BeamEvent becomes Equal to 3.00 // Fires when target is reacquired automatically.
Game - BeamEvent becomes Equal to 4.00 // Fires when Beam is terminated.
Here are the variables that you can use with those events. Those are mostly for reference. If you wish to alter an actual value, use the BeamConfig ones.
BeamEvent_Source // this is the Beamer.
BeamEvent_Target // this is the target your beam follows or is lock-on to.
BeamEvent_Caster // this is the dummy unit that projects the beam.
BeamEvent_Mover // this is the dummy unit that recieves the beam and moves it around. If beam is locked-on, the position of BeamMover will not be the same as BeamTarget.
BeamEvent_Damage // this is the average dps of your Beamer, averaged over 3 seconds.
BeamEvent_Target_OLD// this is the target before target was switch. IT IS ONLY AVAILABLE WHEN BeamEvent is equal to 3.00
BeamEvent_Lightning // this is the lightning effect itself. You can use this to change it's colour if you so desire. To swap if for something else, destroy (cont.)
// destroy the lightning, null it, and then recreate the beam and set it to BeamLightning[Custom Value of Beamer]. Be sure to check whether a lightning
// effect exists before you destroy it. For example, the Shade does not use a lightning effect. Use the following if/then/else block for safety:
if udg_BeamLightning[udg_BeamID] != null then
Destroy lightning
Null lightning
Recreate lightning
Set BeamLightning[Custom Value of Beamer] = Last Created Lightning Effect
endif
// BeamEvent_Lightning is NOT available when BeamEvent is equal to 1.00 or 1.50 as the lightning has not yet been created.
//TESH.scrollpos=64
//TESH.alwaysfold=0
scope ChainBeams
globals
private group grp1 = CreateGroup()
private group grp2 = CreateGroup()
public trigger ChainBeams = CreateTrigger()
endglobals
//Actions
function Trig_ChainBeams_Actions takes nothing returns nothing
local unit u1 = null
local unit u2 = udg_BeamEvent_Mover
local unit FoG = null
local real x = GetUnitX(u2)
local real y = GetUnitY(u2)
local real z = GetUnitFlyHeight(u2)
local real x2 = 0
local real y2 = 0
local real z2 = 0
local integer i = 0
local string vfx1 = "Abilities\\Spells\\Undead\\OrbOfDeath\\OrbOfDeathMissile.mdl"
local string vfx2 = ""
local effect fx = null
local integer bounce = 3
local integer ID = GetUnitUserData(udg_BeamEvent_Source)
local integer ID2 = GetUnitUserData(udg_BeamEvent_Mover)
local integer ID3 = 0
local player p = GetOwningPlayer(udg_BeamEvent_Source)
local real damage = udg_BeamEvent_Damage
local string beam = "SLPB"
local unit array units
if GetUnitTypeId(udg_BeamEvent_Source) == 'hgyr' then
if udg_ChainBeams_ChainActive[ID] == true then
loop
set bounce = bounce - 1
exitwhen bounce == 0
loop
set FoG = FirstOfGroup(udg_ChainBeams_CurrentTargets)
exitwhen FoG == null
call GroupRemoveUnit(udg_ChainBeams_CurrentTargets, FoG)
call GroupAddUnit(grp1, FoG)
set ID2 = GetUnitUserData(FoG)
if udg_ChainBeams_ChainSource[ID2] == udg_BeamEvent_Source then
set u1 = udg_ChainBeams_ChainConnector[ID2]
set u2 = udg_ChainBeams_UnitToFollow[ID2]
set x = GetUnitX(u1)
set y = GetUnitY(u1)
set z = GetUnitFlyHeight(u1) + 50
set x2 = GetUnitX(u2)
set y2 = GetUnitY(u2)
set z2 = GetUnitFlyHeight(u2)
call SetUnitPosition(FoG, x2, y2)
call SetUnitFlyHeight(FoG, z2, 0)
//here we use the already configured timer for when special effects occur, and apply them to all u2 other than udg_BeamEvent_Mover.
//udg_BeamEvent_Mover already has special effects being applied to it in Persistent Beam Tracking.
//There is also no need to reset the timer since that is already being taken care of in Persistent Beam Tracking.
if udg_Beam_IntervalFX[ID] >= udg_BeamConfig_IntervalFXLimit[ID] and u2 != udg_BeamEvent_Mover then
set fx = AddSpecialEffectTarget(vfx1, u2, "origin")
call DestroyEffect(fx)
endif
endif
endloop
loop
set FoG = FirstOfGroup(grp1)
exitwhen FoG == null
call GroupRemoveUnit(grp1, FoG)
set ID2 = GetUnitUserData(FoG)
if GetUnitState(udg_ChainBeams_UnitToFollow[ID2], UNIT_STATE_LIFE) > 0.00 or udg_Beam_TerminateBeam[ID] == true then
call UnitApplyTimedLife(FoG, 'BTLF', 0.01)
else
call GroupAddUnit(udg_ChainBeams_CurrentTargets, FoG)
endif
endloop
endloop
else
call GroupEnumUnitsInRange(grp1, x, y, 600, null)
loop
set bounce = bounce - 1
exitwhen bounce == 0
//call BJDebugMsg(I2S(GetConvertedPlayerId(p)))
loop
set FoG = FirstOfGroup(grp1)
exitwhen FoG == null
call GroupRemoveUnit(grp1, FoG)
if GetUnitState(FoG, UNIT_STATE_LIFE) > 0.00 and IsUnitEnemy(FoG, p) and FoG != udg_BeamEvent_Target and not IsUnitInGroup(FoG,udg_ChainBeams_CurrentTargets) then
set units[i] = FoG
set i = i + 1
endif
endloop
if i > 0 then
set u1 = units[GetRandomInt(0, i - 1)]
call GroupAddUnit(udg_ChainBeams_CurrentTargets, u1)
call DisplayTimedTextToForce( GetPlayersAll(), 30, I2S(GetConvertedPlayerId(p)) )
//set fx = AddSpecialEffectTarget(vfx1, u1, "origin")
//call DestroyEffect(fx)
set x2 = GetUnitX(u1)
set y2 = GetUnitY(u1)
set z2 = GetUnitFlyHeight(u1) + 50
//this newly created unit will be bound to udg_BeamEvent_Mover (and the next on to this unit)
set udg_ChainBeams_NextInLink[ID2] = CreateUnit(GetOwningPlayer(udg_BeamEvent_Source), 'e001', x2, y2, 270)
call IssueTargetOrderById(udg_ChainBeams_NextInLink[ID2], 851983, u1)
//set ID2 to the Index of the newly created unit.
set ID2 = GetUnitUserData(udg_ChainBeams_NextInLink[ID2])
set udg_ChainBeams_UnitToFollow[ID2] = u1 //u1 is the enumerated unit.
set udg_ChainBeams_ChainConnector[ID2] = u2 //u2 is initially udg_BeamEvent_Mover, then changed to the newly created unit so the next one is bound to it.
set udg_ChainBeams_ChainSource[ID2] = udg_BeamEvent_Source // this is to identify later which dummies delong to which Beamer
set udg_ChainBeams_ChainActive[ID2] = true //this identifies that the newly created unit has a beam active.
//set u2 to the newly create unit so the next unit will be bound to it instead of udg_BeamEvent_Mover
set u2 = udg_ChainBeams_NextInLink[ID2]
call SetUnitFlyHeight(u2, z2, 0) //set the flying height to match the enumerated unit
call GroupAddUnit(udg_ChainBeams_CurrentTargets, u2) //add newly created unit to this group for use later.
//reduce damage by 15% for each chain
set damage = damage * 0.85
set udg_NextDamageType = udg_DamageTypeBeam
call UnitDamageTarget( udg_BeamEvent_Source, u1, damage, true, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null )
call TriggerEvaluate(udg_ClearDamageEvent)
//set x, y and z to the values of the newly created unit so the next chain is enumerated from its location.
set x = GetUnitX(u2)
set y = GetUnitY(u2)
set z = GetUnitFlyHeight(u2)
set i = 0
set u1 = null
endif
set FoG = null
endloop
set udg_ChainBeams_ChainActive[ID] = true
endif
endif
endfunction
//===========================================================================
function InitTrig_Chain_Beams takes nothing returns nothing
set ChainBeams = CreateTrigger( )
call TriggerRegisterVariableEvent( ChainBeams, "udg_BeamEvent", EQUAL, 2.50 )
call TriggerAddAction( ChainBeams, function Trig_ChainBeams_Actions )
endfunction
endscope