//===============================================================================
//===============================================================================
//==BE SURE TO COPY THIS TEXT TO YOUR MAP IF YOU WANT TO USE ANY OF THE SPELLS!==
//===============================================================================
//===============================================================================
function H2I takes handle h returns integer
return h
return 0
endfunction
// ===========================
function LocalVars takes nothing returns gamecache
// Replace InitGameCache("jasslocalvars.w3v") with a global variable!!
return InitGameCache("udg_TestCache")
endfunction
function SetHandleHandle takes handle subject, string name, handle value returns nothing
if value==null then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, H2I(value))
endif
endfunction
function SetHandleInt takes handle subject, string name, integer value returns nothing
if value==0 then
call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
else
call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleBoolean takes handle subject, string name, boolean value returns nothing
if value==false then
call FlushStoredBoolean(LocalVars(),I2S(H2I(subject)),name)
else
call StoreBoolean(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleReal takes handle subject, string name, real value returns nothing
if value==0 then
call FlushStoredReal(LocalVars(), I2S(H2I(subject)), name)
else
call StoreReal(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function SetHandleString takes handle subject, string name, string value returns nothing
if value==null then
call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
else
call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
endif
endfunction
function GetHandleHandle takes handle subject, string name returns handle
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleBoolean takes handle subject, string name returns boolean
return GetStoredBoolean(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleReal takes handle subject, string name returns real
return GetStoredReal(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleString takes handle subject, string name returns string
return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction
function GetHandleUnit takes handle subject, string name returns unit
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTimer takes handle subject, string name returns timer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleTrigger takes handle subject, string name returns trigger
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleEffect takes handle subject, string name returns effect
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleGroup takes handle subject, string name returns group
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleLightning takes handle subject, string name returns lightning
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function GetHandleWidget takes handle subject, string name returns widget
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
return null
endfunction
function FlushHandleLocals takes handle subject returns nothing
call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction
//===============================================================================
//===============================================================================
function PolarProjectionX takes real x, real distance, real angle returns real
return x+distance*Cos(angle * (3.14159/180.0))
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
return y+distance*Sin(angle * (3.14159/180.0))
endfunction
function DistanceBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return SquareRoot((x1 - x2)*(x1 - x2)+(y1 - y2)*(y1 - y2))
endfunction
function AngleBetweenPointsXY takes real x1, real y1, real x2, real y2 returns real
return Atan2((y2-y1),(x2-x1)) * (180.0/3.14159)
endfunction
function GetParabolaHeight takes real dist, real maxdist,real curve returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*(maxdist/curve)
endfunction
function DistanceBetweenUnits takes unit A, unit B returns real
return SquareRoot((GetUnitX(A)-GetUnitX(B))*(GetUnitX(A)-GetUnitX(B))+(GetUnitY(A)-GetUnitY(B))*(GetUnitY(A)-GetUnitY(B)))
endfunction
function AngleBetweenUnits takes unit A, unit B returns real
return Atan2((GetUnitY(B)-GetUnitY(A)),(GetUnitX(B)-GetUnitX(A))) * (180.0/3.14159)
endfunction
function RoundR2I takes real r returns integer
return R2I(r+0.5)
endfunction
function IsIntDivisible takes integer int, integer divisor returns boolean
local integer i = int/divisor
local real r = I2R(int)/I2R(divisor)
if i == r then
return true
endif
return false
endfunction
function FadingText takes string msg, integer red, integer green, integer blue, real x, real y, real spd, real fadetime, real life returns nothing
local texttag t=CreateTextTag()
call SetTextTagText(t,msg,0.024)
call SetTextTagPos(t,x,y, 0.00)
call SetTextTagColor(t,red,green,blue,255)
call SetTextTagVelocity(t,0,spd)
call SetTextTagVisibility(t, true)
call SetTextTagFadepoint(t, fadetime)
call SetTextTagLifespan(t, life)
call SetTextTagPermanent(t, false)
set t=null
endfunction
function Chance takes integer chance returns boolean
return chance>=GetRandomInt(1, 100)
endfunction
function Msg takes string msg returns nothing
call DisplayTextToPlayer(Player(0), 0, 0, msg)
endfunction
Name | Type | is_array | initial_value |
Blink_Target | unit | No | |
Blinker | unit | No | |
BuyItemChance | integer | No | |
Dizzy | effect | Yes | |
GPDMG | integer | Yes | |
ItemChanceTeam1Power | integer | No | |
ItemChanceTeam1Shop1 | integer | No | |
ItemChanceTeam2Power | integer | No | |
ItemChanceTeam2Shop1 | integer | No | |
LocPoint1 | location | No | |
LocPoint2 | location | No | |
LocPoint3 | location | No | |
LocReal | real | No | |
NovaRotationTargetVar | real | No | |
Pasko | gamecache | No | |
PunchedArea | location | No | |
PunchedAreaCurrentPoint | location | No | |
PunchedAreaEffect | effect | No | |
PunchedAreaTerrain | terraindeformation | No | |
PunchedCurrentPoint | location | No | |
PunchedPBBackPoint | location | No | |
PunchedPBCap | integer | No | |
PunchedPBEffect | effect | No | |
PunchedPBGroup | group | No | |
PunchedPBTimer | timer | No | |
PunchedUnit | unit | No | |
PunchedUnitEffects | effect | Yes | |
PunchUnit | unit | No | |
RandomAttackTeam1 | integer | No | |
RandomAttackTeam2 | integer | No | |
Roar | effect | No | |
SlamCaster | unit | No | |
SlamVictim | unit | No | |
Spec1 | effect | No | |
Spec2 | effect | No | |
SSText | texttag | No | |
Team1CPUHeroes | group | No | |
Team2CPUHeroes | group | No | |
Temp_Point | location | Yes | |
TempUnitGroup | group | No | |
TestCache | gamecache | No | |
TomeChance | integer | No | |
TriggeringUnitPointVar | location | No | |
UserPlayer | player | No | |
UserPlayers | force | No | |
Weap | effect | Yes |
function Setup takes nothing returns nothing
call TriggerRegisterDeathEvent( gg_trg_Regrow_Trees, GetEnumDestructable() )
endfunction
function Trig_Regrow_Trees_Setup_Actions takes nothing returns nothing
call EnumDestructablesInRectAll( GetEntireMapRect(), function Setup )
call DestroyTrigger( GetTriggeringTrigger() )
endfunction
//===========================================================================
function InitTrig_Regrow_Trees_Setup takes nothing returns nothing
set gg_trg_Regrow_Trees_Setup = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Regrow_Trees_Setup, 1.00 )
call TriggerAddAction( gg_trg_Regrow_Trees_Setup, function Trig_Regrow_Trees_Setup_Actions )
endfunction
function Trig_RegrowTrees_Actions takes nothing returns nothing
local destructable DEADTREE = GetDyingDestructable()
call TriggerSleepAction( 45.00 )
call DestructableRestoreLife( DEADTREE, GetDestructableMaxLife(DEADTREE), true )
endfunction
//===========================================================================
function InitTrig_Regrow_Trees takes nothing returns nothing
set gg_trg_Regrow_Trees = CreateTrigger( )
call TriggerAddAction( gg_trg_Regrow_Trees, function Trig_RegrowTrees_Actions )
endfunction
//===========================================================================================
//Barrier
//by Paskovich
//
//Needed objects:
// - an instant, non-targetted spell (like Thunder Clap)
// - a barrier unit
// o with the ability: Locust
// o with the model: Spirit Touch (special),
// o with unit scale: 3.5,
// o with movement type: flying
// o and fly height: 200
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars, so copy the script from the custom script window!
//
//Please give me a credit if you use this spell on your map!
//============================================================================================
function Trig_Barrier_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A026' //Raw code of your ability.
endfunction
function Barrier_InitDuration takes nothing returns real
return 4.0 //Duration of the Barrier, WITHOUT levelstats.
endfunction
function Barrier_DurationIncrease takes nothing returns real
//Each level icreases duration by this value.
//Duration = InitDuration + (Level * DurationIncrease)
//Example: Level 1 -> 4.0 + (1 * 3.0) = 7 seconds
return 3.0 // Level 3 -> 4.0 + (3 * 3.0) = 13 seconds
endfunction
function Barrier_UnitRawCode takes nothing returns integer
return 'e00B' //Raw code of your Barrier dummy.
endfunction
function Barrier_Radius takes nothing returns real
return 450.0 //Push units that are inside this range.
endfunction
function Barrier_DamagePerSec takes nothing returns real
local real DamagePerSec = 250.0 //Damage dealt per one second while the unit is being
//pushed out of the Barrier.
//Note: a unit beside the center is pushed out in 1.6 second,
return DamagePerSec/250 //that means 160 damage.
endfunction
function Barrier_PushUnits takes nothing returns nothing
local timer p = GetExpiredTimer()
local unit u = GetHandleUnit(p, "PushUnit")
local unit b = GetHandleUnit(p, "PushBarrier")
local real a = AngleBetweenUnits(b, u)
//This timer slides the unit out of the barrier.
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\ReplenishMana\\SpiritTouchTarget.mdl", PolarProjectionX(GetUnitX(u), 5, a), PolarProjectionY(GetUnitY(u), 5, a)))
call SetUnitPosition(u, PolarProjectionX(GetUnitX(u), 5, a), PolarProjectionY(GetUnitY(u), 5, a))
call SetUnitFacing(u, a+180)
call UnitDamageTarget(b, u, Barrier_DamagePerSec(), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
//Checks if the unit is out of the barrier - destroys the timer.
if DistanceBetweenUnits(b, u) >= Barrier_Radius() then
set u = null
set b = null
call FlushHandleLocals(p)
call PauseTimer(p)
call DestroyTimer(p)
set p = null
endif
set u = null
set b = null
set p = null
endfunction
function Barrier_PickUnits takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit b = GetHandleUnit(t, "barrier")
local location Bloc = GetUnitLoc(b)
local group g = GetUnitsInRangeOfLocMatching(Barrier_Radius(), Bloc, null)
local unit u = null
local timer p = null
call RemoveLocation(Bloc)
//This timer picks enemies inside the barrier. (shoots every second)
loop
set u = FirstOfGroup(g)
call GroupRemoveUnit(g, u)
exitwhen u == null
if IsUnitEnemy(u, GetOwningPlayer(b)) and IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitDeadBJ(u) == false then
set p = CreateTimer()
call SetHandleHandle(p, "PushUnit", u)
call SetHandleHandle(p, "PushBarrier", b)
call SetHandleReal(p, "PushAngle", AngleBetweenUnits(b, u))
call SetHandleReal(p, "PushDist", DistanceBetweenUnits(b, u))
//Starts the sliding timer.
call TimerStart(p, 0.02, true, function Barrier_PushUnits)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Items\\SpellShieldAmulet\\SpellShieldCaster.mdl", u, "chest"))
set p = null
endif
endloop
call DestroyGroup(g)
set u = null
set g = null
set Bloc = null
//Checks the duration - destroys the timer, kills the barrier
if GetHandleInt(t, "times") >= GetHandleInt(t, "maxTimes") then
call PauseTimer(t)
call SetUnitTimeScale(b, 1)
call KillUnit(b)
call DestroyTimer(t)
endif
call SetHandleInt(t, "times", GetHandleInt(t, "times")+1)
set b = null
set t = null
endfunction
function Trig_Barrier_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit b = CreateUnit(GetOwningPlayer(u), Barrier_UnitRawCode(), GetUnitX(u), GetUnitY(u), 270.0)
local timer t = CreateTimer()
local integer n = GetUnitAbilityLevel(u, GetSpellAbilityId())
local real dur = Barrier_InitDuration() + n*Barrier_DurationIncrease()
call SetHandleHandle(t, "barrier", b)
call SetHandleInt(t, "times", 1)
call SetHandleInt(t, "maxTimes", R2I(dur))
call TimerStart(t, 1.0, true, function Barrier_PickUnits)
call TriggerSleepAction(0.7)
call SetUnitTimeScale(b, 0)
endfunction
//==== Init Trigger Barrier ====
function InitTrig_Barrier takes nothing returns nothing
set gg_trg_Barrier = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Barrier, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Barrier, Condition(function Trig_Barrier_Conditions))
call TriggerAddAction(gg_trg_Barrier, function Trig_Barrier_Actions)
endfunction
//===========================================================================================
//Vine Whip
//by Paskovich
//
//Needed objects:
// - a unit targetted spell (like Storm Bolt), but better base it on Channel. (Or simply copy
// my spell from the object editor.)
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars and the other functions(!!!),
//so copy the script from the custom script window!
//Please give me a credit if you use this spell on your map!
//
//*UPDATE*
// - New header: Vine_Whip_LightningEffect to set the lightning easily
// - New header: Vine_Whip_DamageDisplay if you don't want the damage to be displayed
//============================================================================================
function Trig_Vine_Whip_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A04L' //Raw code of your ability.
endfunction
function Vine_Whip_Speed takes nothing returns real
local real speed = 1.0 //Speed of the throwing. (default 1.0)
return 24.0 * speed
endfunction
function Vine_Whip_PlusRange takes nothing returns real
return 150.0 //This is the offset from the caster where the target lands. (default 150.0)
endfunction
function Vine_Whip_LightningEffect takes nothing returns string
//============================================================================================
//Lightning effects: LEAS - Aerial Shackles
// CLBP - Chain Lightning Primary
// CLSB - Chain Lightning Secondary
// DRAL - Drain Life (default)
// DRAB - Drain Life and Mana
// DRAM - Drain Mana
// AFOD - Finger Of Death
// FORK - Forked Lightning
// HWPB - Healing Wave Primary
// HWSB - Healing Wave Secondary
// CHIM - Lightning Attack
// MBUR - Mana Burn
// MFBP - Mana Flare
// SPLK - Spirit Link
//============================================================================================
return "CLSB"
endfunction
function Vine_Whip_DamageDependOnHeight takes nothing returns boolean
//============================================================================================
//If this is set to true, the damage will also depend on the unit's reached maximum height
//while in the air.
//
//Important: the maximum height that can be reached is ~440, the minimum is ~160!
//Note: The height depends on the initial distance between the caster and target.
//============================================================================================
return true
endfunction
function Vine_Whip_DamageModifier takes nothing returns real
//============================================================================================
//A little math required to understand:
//
//If Vine_Whip_DamageDependOnHeight is set to false:
//Vine_Whip_InitialDamage + Vine_Whip_BonusDamagePerLevel * Abilitylevel ==> Normal Damage
//
//But if Vine_Whip_DamageDependOnHeight is set to true:
//Damage = (Normal Damage * reached height) / Vine_Whip_DamageModifier
//
//If we count with a level 3 ability, then
//Maximum damage reachable = 325 * 440 / 330.0 ~ 433
// | |
// -> the damage normally -> maximum reachable height
//Minimum damage is 213.
//I recommend to leave this value at its default, and experiment with Vine_Whip_InitialDamage
//and Vine_Whip_BonusDamagePerLevel.
//============================================================================================
return 330.0
endfunction
constant function Vine_Whip_InitialDamage takes nothing returns real
return 100.0 //Damage = InitialDamage + (BonusDamagePerLevel * level of ability)
endfunction
constant function Vine_Whip_BonusDamagePerLevel takes nothing returns real
return 75.0 //Damage = InitialDamage + (BonusDamagePerLevel * level of ability)
endfunction
function Vine_Whip_DamageDisplay takes nothing returns boolean
return true //Set this to false if you don't want the damage to be displayed on the screen.
endfunction
function Vine_Whip_ThrowUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit ctr = GetHandleUnit(t, "caster")
local unit trg = GetHandleUnit(t, "target")
local real maxD = GetHandleReal(t, "maxDist")
local real curD = GetHandleReal(t, "curDist")
local real ang = GetHandleReal(t, "angle")
local real hgt = GetParabolaHeight(maxD-curD, maxD, 1.8)
local lightning l = GetHandleLightning(t, "light")
local integer c = GetHandleInt(t, "times")
local texttag tt
local real dmg
//Set the unit's position
call SetUnitPosition(trg, PolarProjectionX(GetUnitX(trg), Vine_Whip_Speed(), ang), PolarProjectionY(GetUnitY(trg), Vine_Whip_Speed(), ang))
call SetUnitFlyHeight(trg, hgt, 0)
//Get the max height reached
if hgt > GetHandleReal(t, "maxH") then
call SetHandleReal(t, "maxH", hgt)
endif
//Create the next lightning
call DestroyLightning(l)
call SetHandleHandle(t, "light", AddLightningEx(Vine_Whip_LightningEffect(), false, GetUnitX(ctr), GetUnitY(ctr), GetUnitFlyHeight(ctr), GetUnitX(trg), GetUnitY(trg), GetUnitFlyHeight(trg)))
//Set the next distance, +1 to the counter
call SetHandleReal(t, "curDist", curD - Vine_Whip_Speed())
call SetHandleInt(t, "times", c + 1)
//Check if the counter reached the required value - destroy timer
if c > (maxD/Vine_Whip_Speed()) then
call PauseTimer(t)
// call DisplayTextToPlayer(Player(0), 0, 0, R2S(GetHandleReal(t, "maxH"))) //Displays the maximum height.
call DestroyLightning(GetHandleLightning(t, "light"))
set dmg = Vine_Whip_InitialDamage() + Vine_Whip_BonusDamagePerLevel() * GetHandleInt(t, "level")
if Vine_Whip_DamageDependOnHeight() then
set dmg = (dmg*GetHandleReal(t, "maxH"))/Vine_Whip_DamageModifier()
if Vine_Whip_DamageDisplay() then
set tt = CreateTextTagUnitBJ(R2S(R2I(dmg)*1), trg, 20, 10, 0, 255, 0, 0)
call SetTextTagVelocityBJ(tt, 64, 90)
call SetTextTagPermanent( tt, false )
call SetTextTagLifespan( tt, 1.00 )
call SetTextTagFadepoint( tt, 0.50 )
endif
endif
call UnitDamageTarget(ctr, trg, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", GetUnitX(trg), GetUnitY(trg)))
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", GetUnitX(trg), GetUnitY(trg)))
call TerrainDeformCrater( GetUnitX(trg), GetUnitY(trg), 256.00, 34.00, R2I(0.05*1000), false)
call SetUnitPathing(trg, true)
call FlushHandleLocals(t)
set trg = null
set ctr = null
set t = null
call DestroyTimer(t)
endif
set trg = null
set ctr = null
set t = null
endfunction
function Trig_Vine_Whip_Actions takes nothing returns nothing
local unit ctr = GetTriggerUnit()
local unit trg = GetSpellTargetUnit()
local timer t = CreateTimer()
local real dist = DistanceBetweenUnits(ctr, trg)
local real ang = AngleBetweenUnits(trg, ctr)
//Store th caster and the target, create the first lightning
call SetHandleHandle(t, "caster", ctr)
call SetHandleHandle(t, "target", trg)
call SetHandleHandle(t, "light", AddLightningEx(Vine_Whip_LightningEffect(), false, GetUnitX(ctr), GetUnitY(ctr), GetUnitFlyHeight(ctr), GetUnitX(trg), GetUnitY(trg), GetUnitFlyHeight(trg)))
//Throwning the unit
call SetUnitPathing(trg, false)
call SetHandleReal(t, "maxDist", dist + Vine_Whip_PlusRange())
call SetHandleReal(t, "curDist", dist + Vine_Whip_PlusRange())
call SetHandleReal(t, "angle", ang)
call SetHandleReal(t, "maxH", 0)
call SetHandleInt(t, "level", GetUnitAbilityLevel(ctr, GetSpellAbilityId()))
call SetHandleInt(t, "times", 0)
call UnitAddAbility(trg, 'Arav')
call UnitRemoveAbility(trg, 'Arav')
call TimerStart(t, 0.02, true, function Vine_Whip_ThrowUnit)
set ctr = null
set trg = null
set t = null
endfunction
//===========================================================================
function InitTrig_Vine_Whip takes nothing returns nothing
set gg_trg_Vine_Whip = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Vine_Whip, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Vine_Whip, Condition( function Trig_Vine_Whip_Conditions ) )
call TriggerAddAction( gg_trg_Vine_Whip, function Trig_Vine_Whip_Actions )
endfunction
//===========================================================================================
//Hydro Pump
//by Paskovich
//
//Needed objects:
// - an AoE targetted spell (like Blizzard)
// - a dummy unit with the 'ziggurat missile' model
// o be sure that its movement type is set to hover, and fly height to 50
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars and the other functions,
//so copy the whole script from the custom script window.
//
//Please give me a credit if you use this spell on your map!
//============================================================================================
function Trig_Hydro_Pump_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A03X' //Your ability raw code.
endfunction
function Hydro_Pump_BlueDummyRC takes nothing returns integer
return 'e005' //Blue dummy raw code. (the swirl unit)
endfunction
constant function Hydro_Pump_Radius takes nothing returns real
return 400.0 //Radius of the spell.
endfunction
constant function Hydro_Pump_SwirlDurSeconds takes nothing returns real
return 1.0 //Duration before the Hydro Pump comes up. (duration of the swirl)
endfunction
constant function Hydro_Pump_DistanceModifier takes nothing returns real
return 1.0 //How far the unit flyies (!from where it is!), related to the distance from the center point.
endfunction
function Hydro_Pump_MaxHeight takes nothing returns integer
local real MaxHeight = 700.0 //A unit exactly in the centerpoint reaches this fly height.
//Units on the border will reach 50.0 height only.
return R2I(MaxHeight) - 50
endfunction
//======================DAMAGE OPTIONS================================
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!Calculation: DamageInitial + (Level * DamageIncrease) = MaxDamage!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
constant function Hydro_Pump_DamageInitial takes nothing returns real
return 150.0
endfunction
constant function Hydro_Pump_DamageIncrease takes nothing returns real
return 100.0
endfunction
constant function Hydro_Pump_MinDamage takes nothing returns real
//Damage ranges from MaxDamage to MinDamage as we are closer to the border.
return 50.0 //Units at the border will take MinDamage damage.
endfunction
function Hydro_Pump_DamageWhenFall takes nothing returns boolean
//If you want the unit to take damage when it falls to the ground, set this to true.
return false //Note: Calculations are the same as above.
endfunction
constant function Hydro_Pump_Fall_DamageInitial takes nothing returns real
return 25.0
endfunction
constant function Hydro_Pump_Fall_DamageIncrease takes nothing returns real
return 25.0
endfunction
constant function Hydro_Pump_Fall_MinDamage takes nothing returns real
return 0.0
endfunction
//====================================================================
//This function calculates a curve, that has its maximum height set. (reqired for the jump)
function GetParabolaHeightPreset takes real dist, real maxdist,real maxheight returns real
local real t = (dist*2)/maxdist-1
return (-t*t+1)*maxheight
endfunction
//The target unit's jump timer
function Hydro_Pump_PumpUnit takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "PumpUnit")
local real CenterX = GetHandleReal(t, "CenterX")
local real CenterY = GetHandleReal(t, "CenterY")
local real maxDist = GetHandleReal(t, "maxDist")
local real maxHeight = GetHandleReal(t, "maxHeight")
local real distChange = maxDist/50
local real dmg
local real dis = DistanceBetweenPointsXY(CenterX, CenterY, GetUnitX(u), GetUnitY(u))
local real ang = AngleBetweenPointsXY(CenterX, CenterY, GetUnitX(u), GetUnitY(u))
//Calculate the unit's position
local real ppx = PolarProjectionX(CenterX, dis + distChange, ang)
local real ppy = PolarProjectionY(CenterY, dis + distChange, ang)
local real UnitX = GetHandleReal(t, "UnitX")
local real UnitY = GetHandleReal(t, "UnitY")
local real curDist = DistanceBetweenPointsXY(UnitX, UnitY, GetUnitX(u), GetUnitY(u))
local real hgt = GetParabolaHeightPreset(curDist, maxDist, maxHeight)
//Create effect every three 0.02 seconds.
if ModuloInteger(GetHandleInt(t, "counter"), 3) == 0 then
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl", u, "chest"))
endif
//Set the unit's position and facing.
call SetUnitPosition(u, ppx, ppy)
call SetUnitFlyHeight(u, hgt, 0)
call SetUnitFacing(u, ang)
//Chacks is the jump is over. (The timer is shot 50 times)
if GetHandleInt(t, "counter") == 50 then
call PauseTimer(t)
call SetUnitPathing(u, true)
call SetUnitFlyHeight(u, GetUnitDefaultFlyHeight(u), 0)
if Hydro_Pump_DamageWhenFall() then
if IsUnitEnemy(u, GetOwningPlayer(GetHandleUnit(t, "Caster"))) then
set dmg = GetHandleInt(t, "Level") * Hydro_Pump_Fall_DamageIncrease()
set dmg = Hydro_Pump_Fall_DamageInitial() + dmg
set dmg = PercentToInt(GetHandleInt(t, "Percent"), R2I(dmg - Hydro_Pump_Fall_MinDamage()))
set dmg = Hydro_Pump_Fall_MinDamage() + dmg
call UnitDamageTarget(GetHandleUnit(t, "Caster"), u, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
endif
endif
// call UnitRemoveAbility(u, 'Avul')
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
call SetHandleInt(t, "counter", GetHandleInt(t, "counter") + 1)
set t = null
set u = null
endfunction
//The initial swirl movement timer
function Hydro_Pump_Swirl takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = null
local real CenterX = GetHandleReal(t, "CenterX")
local real CenterY = GetHandleReal(t, "CenterY")
local real ang
local real dist
local real mindist
local real ppx
local real ppy
local integer a = 1
loop
exitwhen a > 12
set u = GetHandleUnit(t, "SwUnit"+I2S(a))
set ang = AngleBetweenPointsXY(CenterX, CenterY, GetUnitX(u), GetUnitY(u))
set dist = DistanceBetweenPointsXY(CenterX, CenterY, GetUnitX(u), GetUnitY(u))
set mindist = Hydro_Pump_Radius() / (40* Hydro_Pump_SwirlDurSeconds())
set ppx = PolarProjectionX(CenterX, dist - mindist, ang + 10)
set ppy = PolarProjectionY(CenterY, dist - mindist, ang + 10)
call SetUnitPosition(u, ppx, ppy)
call SetUnitFacing(u, ang+90)
set a = a + 1
endloop
//Checks is the swirl is small enough - destroy timer/swirl
if GetHandleInt(t, "times") >= (Hydro_Pump_Radius() / mindist) then
call PauseTimer(t)
set a = 1
loop
exitwhen a > 12
call KillUnit(GetHandleUnit(t, "SwUnit"+I2S(a)))
set a = a + 1
endloop
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
call SetHandleInt(t, "times", GetHandleInt(t, "times") + 1)
set u = null
set t = null
endfunction
function Trig_Hydro_Pump_Actions takes nothing returns nothing
local unit c = GetTriggerUnit()
local location tl = GetSpellTargetLoc()
local timer t = CreateTimer()
local timer p = null
local real tx = GetLocationX(tl)
local real ty = GetLocationY(tl)
local group g
local unit u = null
local destructable d = null
local real dist
local real percent
local real ppx
local real ppy
local integer a = 1
local real dmg
call SetHandleReal(t, "CenterX", tx)
call SetHandleReal(t, "CenterY", ty)
//Create the initial swirl effect at the center of the target area.
call TerrainDeformCrater( tx, ty, Hydro_Pump_Radius(), -96, R2I((Hydro_Pump_SwirlDurSeconds()+0.3)*1000), false)
loop
exitwhen a > 12
set ppx = PolarProjectionX(tx, Hydro_Pump_Radius(), (a-1)*30)
set ppy = PolarProjectionY(ty, Hydro_Pump_Radius(), (a-1)*30)
call SetHandleHandle(t, "SwUnit"+I2S(a), CreateUnit(GetOwningPlayer(c), Hydro_Pump_BlueDummyRC(), ppx, ppy, (a-1)*30))
set a = a + 1
endloop
call TimerStart(t, 0.02, true, function Hydro_Pump_Swirl)
call TriggerSleepAction(Hydro_Pump_SwirlDurSeconds())
//Create the pump effects.
set d = CreateDestructableZ('OTip', tx, ty, 150, 0, 2, 0)
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl", tx, ty))
call RemoveDestructable(d)
set d = null
set a = 0
loop
exitwhen a > 7
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl", PolarProjectionX(tx, Hydro_Pump_Radius()/2, a*45), PolarProjectionY(ty, Hydro_Pump_Radius()/2, a*45)))
set a = a + 1
endloop
//Picks enemy, non-building, not magic immune units in the target area -> start jumping timer.
set g = GetUnitsInRangeOfLocAll( Hydro_Pump_Radius(), tl)
loop
set u = FirstOfGroup(g)
call GroupRemoveUnit(g,u)
exitwhen u == null
if u != c and IsUnitType(u, UNIT_TYPE_STRUCTURE) == false and IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) == false then
set p = CreateTimer()
//Calculate the unit's distance from the center / max height in the jump. (tricky heh? :))
//This makes the units fly at different heights.
set dist = DistanceBetweenPointsXY(tx, ty, GetUnitX(u), GetUnitY(u))
set percent = 100 - ((dist / Hydro_Pump_Radius()) * 100)
call SetHandleReal( p, "maxHeight" , 50 + PercentToInt(percent, Hydro_Pump_MaxHeight()) )
//Calculate and deal damage
if IsUnitEnemy(u, GetOwningPlayer(c)) then
call SetHandleInt(p, "Level", GetUnitAbilityLevel(c, GetSpellAbilityId()))
call SetHandleInt(p, "Percent", RoundR2I(percent))
set dmg = GetHandleInt(p, "Level") * Hydro_Pump_DamageIncrease()
set dmg = Hydro_Pump_DamageInitial() + dmg
set dmg = PercentToInt(percent, R2I(dmg - Hydro_Pump_MinDamage()))
set dmg = Hydro_Pump_MinDamage() + dmg
call UnitDamageTarget(c, u, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
endif
//Set the parameters for the timer.
call SetHandleHandle(p, "PumpUnit", u)
call SetHandleHandle(p, "Caster", c)
call SetHandleReal( p, "CenterX" , tx)
call SetHandleReal( p, "CenterY" , ty)
call SetHandleReal( p, "UnitX", GetUnitX(u))
call SetHandleReal( p, "UnitY", GetUnitY(u))
call SetHandleInt( p, "counter" , 1)
call SetHandleReal( p, "maxDist" , dist * Hydro_Pump_DistanceModifier())
//Add Storm Crow Form - start timer.
call SetUnitPathing(u, false)
call UnitAddAbility(u, 'Arav')
// call UnitAddAbility(u, 'Avul')
call UnitRemoveAbility(u, 'Arav')
call TimerStart(p, 0.02, true, function Hydro_Pump_PumpUnit)
endif
endloop
//Null variables
call RemoveLocation(tl)
set p = null
set g = null
set u = null
set t = null
set tl = null
endfunction
//===========================================================================
function InitTrig_Hydro_Pump takes nothing returns nothing
set gg_trg_Hydro_Pump = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hydro_Pump, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Hydro_Pump, Condition( function Trig_Hydro_Pump_Conditions ) )
call TriggerAddAction( gg_trg_Hydro_Pump, function Trig_Hydro_Pump_Actions )
endfunction
//===========================================================================================
//Liquid Ooze
//by Paskovich
//
//Needed objects: (copy these to your map)
// - the ability called 'Liquid Ooze'
//
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars and the other scripts,
//so copy the script from the custom script window.
//
//Please give me a credit if you use this spell on your map!
//============================================================================================
function Liquid_Ooze_AbilityRawCode takes nothing returns integer
return 'A004' //Ability raw code.
endfunction
constant function Liquid_Ooze_MaxDamage takes nothing returns real
return 150.0 //Max damage stored.
endfunction
constant function Liquid_Ooze_ChanceInitial takes nothing returns integer
return 10 //Initial chance.
endfunction
constant function Liquid_Ooze_ChanceBonus takes nothing returns integer
//Chance increases with every level (incuding level 1) by this value.
return 10 //ChanceInitial + Level * ChanceBonus = Chance
endfunction
constant function Liquid_Ooze_DamageRadius takes nothing returns real
return 800.0 //AoE of damage.
endfunction
function Liquid_Ooze_SpecialEffect takes nothing returns string
return "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" //Effect when absorbs the damage. (caster)
endfunction
function Liquid_Ooze_SpecialEffectTarget takes nothing returns string
return "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl" //Effect when deals the AoE damage. (target)
endfunction
constant function Liquid_Ooze_DamageMultiplier takes nothing returns real
return 2.0 //Multiples the stored damage with this number. The result divided with the number of enemies gives the damage.
endfunction
function Liquid_Ooze_TakeDamage takes nothing returns boolean
return false //The "caster" takes the absorbed damage or not.
endfunction
function Trig_Liquid_Ooze_Conditions takes nothing returns boolean
return GetLearnedSkillLevel() == 1 and GetLearnedSkill() == Liquid_Ooze_AbilityRawCode()
endfunction
function Liquid_Ooze_Filter takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false and IsUnitDeadBJ(GetFilterUnit())==false
endfunction
function Trig_Liquid_Ooze_Damage takes nothing returns nothing
local unit u = GetTriggerUnit()
local group g = null
local location uloc = null
local unit a = null
local boolexpr filter = null
local integer n = 0
local integer chc = Liquid_Ooze_ChanceInitial() + GetUnitAbilityLevel(u,Liquid_Ooze_AbilityRawCode()) * Liquid_Ooze_ChanceBonus()
if Chance(chc) then
if not Liquid_Ooze_TakeDamage() then
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE) + GetEventDamage())
endif
call DestroyEffect(AddSpecialEffect(Liquid_Ooze_SpecialEffect(), GetUnitX(u), GetUnitY(u)))
call SetHandleReal(u, "DamageCounter", GetHandleReal(u, "DamageCounter") + GetEventDamage())
//call Msg(R2S(GetHandleReal(u, "DamageCounter")))
if GetHandleReal(u, "DamageCounter") >= Liquid_Ooze_MaxDamage() then
set uloc = GetUnitLoc(u)
set filter = Condition(function Liquid_Ooze_Filter)
set g = GetUnitsInRangeOfLocMatching(Liquid_Ooze_DamageRadius(), uloc, filter)
set n = CountUnitsInGroup(g)
loop
set a = FirstOfGroup(g)
call GroupRemoveUnit(g, a)
exitwhen a == null
call UnitDamageTarget(u, a, GetHandleReal(u, "DamageCounter")/n*Liquid_Ooze_DamageMultiplier(), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
call DestroyEffect(AddSpecialEffect(Liquid_Ooze_SpecialEffectTarget(), GetUnitX(a), GetUnitY(a)))
endloop
call DestroyGroup(g)
call RemoveLocation(uloc)
call DestroyBoolExpr(filter)
call FlushHandleLocals(u)
set filter = null
set g = null
set a = null
endif
endif
set u = null
endfunction
function Trig_Liquid_Ooze_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local trigger t = CreateTrigger()
call TriggerRegisterUnitEvent(t, u, EVENT_UNIT_DAMAGED)
call TriggerAddAction(t, function Trig_Liquid_Ooze_Damage)
set t = null
set u = null
endfunction
//===========================================================================
function InitTrig_Revenge takes nothing returns nothing
set gg_trg_Revenge = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Revenge, EVENT_PLAYER_HERO_SKILL )
call TriggerAddCondition( gg_trg_Revenge, Condition( function Trig_Liquid_Ooze_Conditions ) )
call TriggerAddAction( gg_trg_Revenge, function Trig_Liquid_Ooze_Actions )
endfunction
//===========================================================================================
//Bullet Seed
//by Paskovich
//
//Needed objects:
// - a unit targetted spell with a buff (use Acid Bomb, like my spell)
// - buff (!!!)
//
//Unfortunetly, adding a level-dependent damage system would be complicated. I won't do it. :)
//Try to increase damage by setting the duration of the spell in the Object Editor.
//
//To implement the spell, copy and paste this trigger to your map.
//Change the datas below as they are written there.
//You will also need the Local Handle Vars and the other scripts,
//so copy the script from the custom script window.
//
//Please give me a credit if you use this spell on your map!
//============================================================================================
function Trig_Bullet_Seed_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A040' //Raw code of your ability.
endfunction
function Bullet_Seed_BuffRawCode takes nothing returns integer
return 'BNab' //Raw code of your ability's buff. (necessary to have one)
endfunction
constant function Bullet_Seed_MissileSpeed takes nothing returns real
return 900.0 //Missile speed of your ability. Enter an accurate value!
endfunction
constant function Bullet_Seed_DamagePerSecond takes nothing returns real
return 50.0 //Damage dealt/regained per second.
endfunction
constant function Bullet_Seed_DamageInterval takes nothing returns real
return 0.25 //The duration between the unit is damaged again. This does not effect DamagePerSecond!
endfunction
constant function Bullet_Seed_DamageModifier takes nothing returns real
return 2.0 //If the target is not moving, it the damage/life regained will be multiplied by this number.
endfunction
function Bullet_Seed_DisplayDamage takes nothing returns boolean
return true //This turns the damage display off.
endfunction
constant function Bullet_Seed_DisplayDamageInterval takes nothing returns integer
//If DisplayDamage is true, the damage is displayed every DisplayDamageInterval second(s).
//Note: If you want to change the color of the text, find the 'call FadingText()' line in the function
//called Bullet_Seed_Timer (just below this one).
return 1
endfunction
function Bullet_Seed_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local real dmg = Bullet_Seed_DamagePerSecond() * Bullet_Seed_DamageInterval()
local unit ctr = GetHandleUnit(t, "Caster")
local unit trg = GetHandleUnit(t, "Target")
//This counts how many times the timer has expired. (used for damage display)
call SetHandleInt(t, "Times", GetHandleInt(t, "Times") + 1)
//Check if the target has moved, deal damage, set life.
if GetHandleReal(t, "X") == GetUnitX(trg) and GetHandleReal(t, "Y") == GetUnitY(trg) then
set dmg = dmg * Bullet_Seed_DamageModifier()
endif
call SetHandleReal(t, "Damage", GetHandleReal(t, "Damage") + dmg)
call UnitDamageTarget(ctr, trg, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null)
call SetUnitState(ctr, UNIT_STATE_LIFE, GetUnitState(ctr, UNIT_STATE_LIFE) + dmg)
//Store target's current coordinates.
call SetHandleReal(t, "X", GetUnitX(trg))
call SetHandleReal(t, "Y", GetUnitY(trg))
//Damage display
if Bullet_Seed_DisplayDamage() then
if IsIntDivisible(RoundR2I(GetHandleInt(t, "Times")*Bullet_Seed_DamageInterval()*10), Bullet_Seed_DisplayDamageInterval()*10) then
//So if you want to change the color of the text, you only have to chage this part of the line above "0, 200, 0"
call FadingText(I2S(RoundR2I(GetHandleReal(t, "Damage"))), 0, 200, 0, GetUnitX(trg), GetUnitY(trg), 0.03, 0.85, 3)
//The numbers signify red, green, blue. The max is 255! Ex.: If you want a red text, set it to "255, 0, 0".
call SetHandleReal(t, "Damage", 0)
endif
endif
//Check if the effect has gone - destroy timer
if GetUnitAbilityLevel(trg, Bullet_Seed_BuffRawCode()) == 0 then
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
set t = null
set ctr = null
set trg = null
endfunction
function Trig_Bullet_Seed_Actions takes nothing returns nothing
local unit ctr = GetTriggerUnit()
local unit trg = GetSpellTargetUnit()
local timer t = CreateTimer()
call SetHandleHandle(t, "Caster", ctr)
call SetHandleHandle(t, "Target", trg)
//Wait until the missile hits the target.
call TriggerSleepAction(DistanceBetweenUnits(trg, ctr) / Bullet_Seed_MissileSpeed())
//Store coordinates for the first check
call SetHandleReal(t, "X", GetUnitX(trg))
call SetHandleReal(t, "Y", GetUnitY(trg))
//Start damage timer
call TimerStart(t, Bullet_Seed_DamageInterval(), true, function Bullet_Seed_Timer)
set ctr = null
set trg = null
set t = null
endfunction
//===========================================================================
function InitTrig_Lance_Throw takes nothing returns nothing
set gg_trg_Lance_Throw = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lance_Throw, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Lance_Throw, Condition( function Trig_Bullet_Seed_Conditions ) )
call TriggerAddAction( gg_trg_Lance_Throw, function Trig_Bullet_Seed_Actions )
endfunction