//TESH.scrollpos=10
//TESH.alwaysfold=0
function CastStun takes real time, unit target,unit caster returns nothing
local real r=time
local unit u=target
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local location l=Location(x,y)
local unit W
call CreateNUnitsAtLoc(1,'e001',GetOwningPlayer(caster),l,bj_UNIT_FACING)
set W =GetLastCreatedUnit()
call UnitAddAbility(W , 'A001')
call IssueTargetOrder(W , "thunderbolt",u)
call UnitApplyTimedLife(W , 'BTLF', 3)
call PolledWait(r)
call UnitRemoveAbility(u,'BPSE')
set u = null
set W = null
endfunction
function PolledWait2 takes real duration returns nothing
local timer t
local real timeRemaining
if (duration > 0) then
set t = CreateTimer()
call TimerStart(t, duration, false, null)
loop
set timeRemaining = TimerGetRemaining(t)
exitwhen timeRemaining <= 0
if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
call TriggerSleepAction(0.1 * timeRemaining)
else
call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
endif
endloop
call DestroyTimer(t)
set t = null
endif
endfunction
Name | Type | is_array | initial_value |
CU | integer | No | |
FU | unit | No | |
Test_Integer | integer | No | |
Test_Location | location | No | |
Test_Real | real | No | |
Test_Unit | unit | No | |
UG | group | No |
//TESH.scrollpos=0
//TESH.alwaysfold=0
//Import of the spells are very easy
//1) u need to CopyPaste all not standart abilitys and buffs
//2) u need to CopyPaste Unit 'e001' that named "dummy" , and export his model.
//3) u need to CopyPaste Jass MUI and Jass MPI folders and Jass Systems
//4) Set Locals to fit ur needs ( and copy udg_FU, udg_UG, udg_CU)
//5) PROFIT!! :)
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Improved_Mana_drain_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A000' //if casted spell is 'A000' then whole spell will work
endfunction
function firstft takes nothing returns boolean
return GetHeroInt(GetTriggerUnit(), true) > GetHeroInt(GetSpellTargetUnit(), true)// if hero's int bigger then spell target's int then he will drain mana
endfunction
function secondft takes nothing returns boolean
return ( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) <= I2R(( ( 2 + GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId()) ) * GetHeroInt(GetTriggerUnit(), true) - GetHeroInt(GetSpellTargetUnit(), true) ) ))//this condition is to prevent over damaging target or setting his mana to negative value and crashing Wc3
endfunction
function Trig_Improved_Mana_drain_Actions takes nothing returns nothing
local integer int1 = ( 2 + GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId()) )//this is multiplier of int(caster) - int(target)
local location loc1 = GetUnitLoc(GetTriggerUnit())//set locations
local location loc2 = GetUnitLoc(GetSpellTargetUnit())
local integer int2 = ( int1 * ( GetHeroInt(GetTriggerUnit(), true) - GetHeroInt(GetSpellTargetUnit(), true) ) )// this is int(caster) - int(target) (Change GetHero/Int/ to /Str/ or /Agi/ if u need)
local real Dmg = 32.00 + ( 32.00 * I2R(GetUnitAbilityLevel(GetTriggerUnit(), GetSpellAbilityId())) )//this is DMG if firstft is false and hero TP to target
local lightning liEf
//setting locals for Lightning effect
local real x1 = GetLocationX(loc1)
local real y1 = GetLocationY(loc1)
local real z1 = (GetLocationZ(loc1) + 50)
local real x2 = GetUnitX(GetSpellTargetUnit())
local real y2 = GetUnitY(GetSpellTargetUnit())
local real z2 = (GetLocationZ(loc2) + 50)
//end setting locals
set liEf = AddLightningEx( "MBUR" , false , x1 , y1 , z1 , x2 , y2 , z2)//creating lighning effect
call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Undead\\Possession\\PossessionMissile.mdl", GetSpellTargetUnit(), "origin" ) )//eye candy
if ( secondft() ) then
call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), (GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) + 100),true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS )//damage target
call SetWidgetLife( GetTriggerUnit(), ( GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) + ( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) / 3.00 ) ) )//heal caster
call SetUnitState( GetTriggerUnit(),UNIT_STATE_MANA, ( GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) + ( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) / 3.00 ) ) )//adding mana to caster
call SetUnitState( GetSpellTargetUnit(),UNIT_STATE_MANA, 0 )//removing mana
call CastStun(2,GetSpellTargetUnit(),GetTriggerUnit())//stuning target for 2 sec
else
if ( firstft() ) then
call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), I2R(int2), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS )//damaging target
call SetUnitState( GetSpellTargetUnit(),UNIT_STATE_MANA, ( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) - I2R(int2) ))//taking of his mana
call SetUnitState( GetTriggerUnit(),UNIT_STATE_MANA, ( GetUnitState(GetTriggerUnit(), UNIT_STATE_MANA) + (I2R(int2) /3 )))//give mana to caster
call SetWidgetLife( GetTriggerUnit(), ( GetUnitState(GetTriggerUnit(), UNIT_STATE_LIFE) + (I2R(int2) / 3.00 ) ))//heal caster
else
call SetUnitPosition( GetTriggerUnit(), x2,y2 )//TP unit
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", GetTriggerUnit(), "origin" ))//eye candy
call SetUnitState( GetSpellTargetUnit(), UNIT_STATE_MANA ,( GetUnitState(GetSpellTargetUnit(), UNIT_STATE_MANA) - Dmg))//taking of mana
call UnitDamageTarget( GetTriggerUnit(), GetSpellTargetUnit(), Dmg,true,false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS )//damaging target
endif
endif
//clearing locals to remove leaks
call RemoveLocation(loc1)
call RemoveLocation(loc2)
call PolledWait2(0.34)//waiting
call DestroyLightning(liEf)//destroing lightning
set loc1 = null
set loc2 = null
set liEf = null
endfunction
//===========================================================================
function InitTrig_Improved_Mana_drain takes nothing returns nothing
local trigger gg_trg_Improved_Mana_drain = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Improved_Mana_drain, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Improved_Mana_drain, Condition( function Trig_Improved_Mana_drain_Conditions ) )
call TriggerAddAction( gg_trg_Improved_Mana_drain, function Trig_Improved_Mana_drain_Actions )
set gg_trg_Improved_Mana_drain = null
endfunction
//TESH.scrollpos=8
//TESH.alwaysfold=0
function FT takes nothing returns boolean
return (GetUnitAbilityLevel(GetSpellTargetUnit(), 'B000') > 0) == true and (IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetSpellTargetUnit())) == true)// If target of Caster is enemy and he has Buff 'B000' then whole trigger will work
endfunction
function Trig_Magic_Defence_Actions takes nothing returns nothing
local unit ST = GetSpellTargetUnit()// Setting the main unit
local real x1 = GetUnitX(ST)//Get The X of main unit
local real y1 = GetUnitY(ST)//Get The Y of main unit
local real x2 = GetUnitX(GetTriggerUnit())// Get The X of caster
local real y2 = GetUnitY(GetTriggerUnit())// Get The Y of caster
local integer dmg = (GetHeroInt(ST,true) / 2)//This is damage of each orb. Now it is half of hero INT u can change it to his STR AGI or remaining mana and so on
local unit last
local integer AL = GetUnitAbilityLevel(ST,'A004')// Change 'A004' to ur ability code (or if u copy past skill then no need of changing)
local integer MSHi = AL * 2// u can set this local to GetRandomInt(0,AL*2) this will create random units between 0 and ur level of ability * 2
local real F = bj_RADTODEG * Atan2((y2 - y1),( x1 - x2))// Get angle between caster and target (main unit)
set x2 = (x1 + 300 * Cos(F * bj_DEGTORAD))// Setting new X (U can change Range of TP by changing 300 to random number or fixed number what ever u want)
set y2 = (y1 + 300 * Sin(F * bj_DEGTORAD))// Setting new Y (U can change Range of TP by changing 300 to random number or fixed number what ever u want)
if GetRandomReal(0,100) >= 10*AL then// Chance of provoke TP 10*Level%
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", x1, y1))//creating some eye candy
call SetUnitX( ST, x2)//Move ST to new X
call SetUnitY( ST, y2)//Move ST to new Y
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl", x2 , y2))//creating some eye candy
endif
loop
set MSHi = MSHi - 1
exitwhen MSHi <= 0
set last = CreateUnit(GetOwningPlayer(ST),'e001',x2,y2,((F - 180) - GetRandomReal(-10,10)))// creating unit and setting his facing to random number
call SetUnitPathing(last,false)// seting his pathing to null
call SetUnitState(last, UNIT_STATE_MANA, dmg)// Mana of this unit will be his damage
call UnitApplyTimedLife(last,'BTLF', 3)// change last number to inscrize control time or set it to ~ 0.5 sec to remove it
call AddSpecialEffectTarget("Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl", last, "origin")// adding special effect to dummy
call GroupAddUnit(udg_UG, last)// add last created unit to move unit group
endloop
set last = null// nulling locals to prevent leaks
set ST = null//nulling locals to prevent leaks
endfunction
//===========================================================================
function InitTrig_Magic_Defence takes nothing returns nothing
local trigger gg_trg_Magic_Defence = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Magic_Defence, EVENT_PLAYER_UNIT_SPELL_CHANNEL )
call TriggerAddCondition( gg_trg_Magic_Defence, Condition( function FT ) )
call TriggerAddAction( gg_trg_Magic_Defence, function Trig_Magic_Defence_Actions )
set gg_trg_Magic_Defence = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_Debug_Actions takes nothing returns nothing
//this is debug trigger if any unit will go of playble map area he will be removed or TP'ed about 500 to his back
local real x1 = GetUnitX(GetTriggerUnit())
local real y1 = GetUnitY(GetTriggerUnit())
local real x2 = (x1 + 500 * Cos((GetUnitFacing(GetTriggerUnit())-180) * bj_DEGTORAD))
local real y2 = (y1 + 500 * Sin((GetUnitFacing(GetTriggerUnit())-180) * bj_DEGTORAD))
if IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true then
call SetUnitX(GetTriggerUnit(),x2)
call SetUnitY(GetTriggerUnit(),y2)
else
call RemoveUnit(GetTriggerUnit())
endif
endfunction
//===========================================================================
function InitTrig_Debug takes nothing returns nothing
local trigger gg_trg_Debug = CreateTrigger( )
call TriggerRegisterLeaveRectSimple( gg_trg_Debug, GetPlayableMapRect() )
call TriggerAddAction( gg_trg_Debug, function Trig_Debug_Actions )
set gg_trg_Debug = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function Trig_mana_combust_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), 'A002') > 0//this condition will see if attacker ability level of 'A002' is greater then 0 then whole trigger will work
endfunction
function Trig_mana_combust_Actions takes nothing returns nothing
//setting locals
local integer lvl = GetUnitAbilityLevel(GetAttacker(),'A002')
local unit atacker = GetAttacker()
local unit atacked = GetTriggerUnit()
local real dmg = I2R(10+(15*lvl))//setting damage of attack (and stealing mana, health) to 10+15*lvl (25/40/55/70)
call PolledWait2(0.3)//wait for attack
call UnitRemoveAbility(atacker,'A002')//removing ability from unit (for prevent abusing it)
call SetPlayerAbilityAvailable(GetOwningPlayer(atacker),'A002',false)// remove ability
call UnitDamageTarget(atacker, atacked, dmg, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)//dmg target
call SetWidgetLife(atacker,(GetUnitState(atacker, UNIT_STATE_LIFE)+dmg))//healing attacker
call SetUnitState(atacker,UNIT_STATE_MANA,(GetUnitState(atacker,UNIT_STATE_MANA)+dmg))// giving him mana
call SetUnitState(atacked,UNIT_STATE_MANA,(GetUnitState(atacked,UNIT_STATE_MANA)-dmg))// removing targets mana
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Feedback\\SpellBreakerAttack.mdl" , atacked , "chest" ))//eye candy
call PolledWait2(12-I2R(lvl))//cooldown is 12 sec - 1 sec per level of ability
//adding ability to attacker again
call UnitAddAbility(atacker,'A002')
call SetUnitAbilityLevel(atacker, 'A002', lvl)
call SetPlayerAbilityAvailable(GetOwningPlayer(atacker),'A002',true)
//nulling locals to prevent leaks
set atacker = null
set atacked = null
endfunction
//===========================================================================
function InitTrig_mana_combust takes nothing returns nothing
local trigger gg_trg_mana_combust = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_mana_combust, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_mana_combust, Condition( function Trig_mana_combust_Conditions ) )
call TriggerAddAction( gg_trg_mana_combust, function Trig_mana_combust_Actions )
set gg_trg_mana_combust = null
endfunction
//TESH.scrollpos=29
//TESH.alwaysfold=0
function Trig_Instable_Arcana_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetAttacker(), 'A003') > 0//this condition will see if attacker ability level of 'A002' is greater then 0 then whole trigger will work
endfunction
function Text takes string text, real size, real colorR, real colorG, real colorB, real alpha returns nothing
//this func will create textags
local texttag t = CreateTextTagUnitBJ( text, GetTriggerUnit(), 100.00, size, colorR, colorG, colorB, alpha )
call SetTextTagPermanent(t,false)
call SetTextTagFadepoint(t , 2)
call SetTextTagLifespan(t , 4)
endfunction
function Trig_Instable_Arcana_Actions takes nothing returns nothing
//setting locals
local integer lvl = (5+(2*GetUnitAbilityLevel(GetAttacker(),'A003')))//this is chance to provoke dmg heal or stun
local unit atacker = GetAttacker()
local unit atacked = GetTriggerUnit()
local integer random = GetRandomInt(0,4)//this random is for see what it will provoke stun dmg or heal
local real randomr = GetRandomReal(50,250)//this is for stun
local integer randomi = GetRandomInt(50,250)//this is for heal and dmg
if GetRandomReal(0,100) < lvl then//condition
call PolledWait2(0.3)// waiting for attack
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", atacked, "chest"))//eyecandy
call UnitRemoveAbility(atacker,'A003')//removing ability to prevent abusing it
call SetPlayerAbilityAvailable(GetOwningPlayer(atacker),'A003',false)//remove it from "+" to prevent bugs
if random < 1 then//if random is 0 then it will stun
call Text(R2S(randomr/100) + "sec",(randomr /10), 0,0,100,0)//creating blue text tag with stun sec
call CastStun((randomr/100), atacked, atacker)//stuning target
else
if random < 3 then//if random is less then it will dmg
call UnitDamageTarget(atacker, atacked, randomr, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)//dmg target
call SetUnitState(atacked,UNIT_STATE_MANA,(GetUnitState(atacked,UNIT_STATE_MANA)-randomr))//burning his mana
call Text("-" + (I2S(randomi)) + "hp",I2R(randomi /10), 100,0,0,0)//creating red textag with dmg count
else// if random is more or = 3 then it will heal
call SetWidgetLife(atacker,GetUnitState(atacker,UNIT_STATE_LIFE)+randomr/2)//healing
call Text("+" + (I2S(randomi/2)) + "hp",I2R(randomi /10), 35,100,0,0)//creating green textag with healing count
endif
endif
call PolledWait2(2)//waiting cooldown
//adding ability again
call UnitAddAbility(atacker,'A003')
call SetUnitAbilityLevel(atacker, 'A003', lvl)
call SetPlayerAbilityAvailable(GetOwningPlayer(atacker),'A003',true)
//nulling locals to prevent leaks
set atacker = null
set atacked = null
endif
endfunction
//===========================================================================
function InitTrig_Instable_Arcana takes nothing returns nothing
local trigger gg_trg_Instable_Arcana = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Instable_Arcana, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Instable_Arcana, Condition( function Trig_Instable_Arcana_Conditions ) )
call TriggerAddAction( gg_trg_Instable_Arcana, function Trig_Instable_Arcana_Actions )
set gg_trg_Instable_Arcana = null
endfunction
//TESH.scrollpos=2
//TESH.alwaysfold=0
function damage takes nothing returns nothing
call UnitDamageTarget(udg_FU,GetEnumUnit(),(GetUnitState(udg_FU,UNIT_STATE_MANA)),true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS) //damaging target for mana of the dummy
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl",GetUnitX(udg_FU),GetUnitY(udg_FU))) //eye candy
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl",GetEnumUnit(),"chest"))//eye candy
call GroupRemoveUnit(udg_UG, udg_FU) //Removing unit from the moving group (to prevent bugs)
call RemoveUnit(udg_FU) //Removing unit from the game
endfunction
function Count takes nothing returns nothing
set udg_CU = udg_CU + 1// this func count units in group
endfunction
function filterMS takes nothing returns boolean
return (IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(udg_FU)) == true) and (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE) > 0.4)// if picked unit is enemy of the dummy then he dummy will damage him
endfunction
function Mad takes unit r returns nothing
//setting locals
local real x1 = GetUnitX(r)
local real y1 = GetUnitY(r)
local real F = GetUnitFacing(r)
local real x2 = (x1 + 15 * Cos(F * bj_DEGTORAD))//this will move him 15y away every 0.03 sec
local real y2 = (y1 + 15 * Sin(F * bj_DEGTORAD))//this will move him 15y away every 0.03 sec
local group temp = CreateGroup()//creating group for further using
call SetUnitX(r,x2)//moving dummy
call SetUnitY(r,y2)//moving dummy
call GroupEnumUnitsInRange(temp, x2,y2, 128, Condition(function filterMS))//pick every enemy in 128 range
set udg_CU=0//set Count = 0 to prevent over counting and bugging system
call ForGroup(temp, function Count)// this will count units in group
if udg_CU>0 then// if units in group more then 0 he will damage them
call ForGroup(temp, function damage)
endif
call GroupClear(temp)//clearing group to prevent leaks
call DestroyGroup(temp)
set temp = null//clearing locals to prevent leaks
endfunction
function preMad takes nothing returns nothing
set udg_FU = GetEnumUnit()// setting udg_FU to picked unit for further using
call Mad(udg_FU)// call main func
endfunction
function Trig_Move_System_Actions takes nothing returns nothing
call ForGroup(udg_UG , function preMad)//this will pick every unit in Moving Group and do func preMad for them
endfunction
//===========================================================================
function InitTrig_Move_System takes nothing returns nothing
local trigger gg_trg_Move_System = CreateTrigger( )
call TriggerRegisterTimerEvent( gg_trg_Move_System, 0.03,true )
call TriggerAddAction( gg_trg_Move_System, function Trig_Move_System_Actions )
set gg_trg_Move_System = null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
function CastStun takes real time, unit target,unit caster returns nothing
local real r=time
local unit u=target
local real x=GetUnitX(u)
local real y=GetUnitY(u)
local location l=Location(x,y)
local unit W
call CreateNUnitsAtLoc(1,'e001',GetOwningPlayer(caster),l,bj_UNIT_FACING)
set W =GetLastCreatedUnit()
call UnitAddAbility(W , 'A001')
call IssueTargetOrder(W , "thunderbolt",u)
call UnitApplyTimedLife(W , 'BTLF', 3)
call PolledWait(r)
call UnitRemoveBuffBJ('BPSE',u)
set u = null
set W = null
endfunction
//===========================================================================
//Put upper part of this triger to ur map code!!!
//===========================================================================