//TESH.scrollpos=40
//TESH.alwaysfold=0
//omg hax
//zomgs scriptZ meh ned
function H2I takes handle h returns integer
return h
return 0
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
constant function DebugFilter takes nothing returns boolean
return true
endfunction
//Timerz Reclingz + Attaching (by Hanky)
constant function TimerRecycler_minIndex takes nothing returns integer
return 0x100000
endfunction
function GetTimer takes integer data returns timer
local integer index
set udg_TimerRecycler_csize=udg_TimerRecycler_csize+1
if udg_TimerRecycler_csize>udg_TimerRecycler_size then
set udg_TimerRecycler_timer[udg_TimerRecycler_csize]=CreateTimer()
set udg_TimerRecycler_size=udg_TimerRecycler_csize
endif
set index=H2I(udg_TimerRecycler_timer[udg_TimerRecycler_csize])-TimerRecycler_minIndex()
set udg_TimerRecycler_orAtt[index]=udg_TimerRecycler_csize
set udg_TimerRecycler_inUse[index]=true
set udg_TimerRecycler_data[index] =data
return udg_TimerRecycler_timer[udg_TimerRecycler_csize]
endfunction
function GetTimerData takes timer t returns integer
local integer index=H2I(t)-TimerRecycler_minIndex()
if udg_TimerRecycler_inUse[index] then
return udg_TimerRecycler_data[index]
else
call BJDebugMsg("Index not in use!")
endif
return 0
endfunction
function RecycleTimer takes timer t returns nothing
local integer index=H2I(t)-TimerRecycler_minIndex()
local integer indec
if udg_TimerRecycler_inUse[index] then
set indec=H2I(udg_TimerRecycler_timer[udg_TimerRecycler_csize])-TimerRecycler_minIndex()
call PauseTimer(t)
set udg_TimerRecycler_timer[udg_TimerRecycler_orAtt[index]]=udg_TimerRecycler_timer[udg_TimerRecycler_csize]
set udg_TimerRecycler_timer[udg_TimerRecycler_csize] =t
set udg_TimerRecycler_orAtt[indec]=udg_TimerRecycler_orAtt[index]
set udg_TimerRecycler_inUse[indec]=true
set udg_TimerRecycler_inUse[index]=false
set udg_TimerRecycler_csize=udg_TimerRecycler_csize-1
endif
endfunction
//Delayed Effect
function RemoveUnitAfterTime_Child takes nothing returns nothing
local timer t=GetExpiredTimer()
local unit u =I2U(GetTimerData(t))
call RemoveUnit(u)
call RecycleTimer(t)
set u=null
set t=null
endfunction
function RemoveUnitAfterTime takes unit u,real delay returns nothing
local timer t=GetTimer(H2I(u))
call TimerStart(t,delay,false,function RemoveUnitAfterTime_Child)
set t=null
endfunction
Name | Type | is_array | initial_value |
ColdSnap_blocker | destructable | Yes | |
ColdSnap_caster | unit | Yes | |
ColdSnap_dummy | unit | Yes | |
ColdSnap_dummyx | real | Yes | |
ColdSnap_dummyy | real | Yes | |
ColdSnap_index | integer | Yes | |
ColdSnap_last | integer | No | |
ColdSnap_next | integer | No | |
ColdSnap_targetx | real | Yes | |
ColdSnap_targety | real | Yes | |
Credits | questitem | No | |
HeroContest | quest | No | |
level | integer | No | |
mana | real | No | |
ManaPulse_dummy | unit | Yes | |
ManaPulse_index | integer | Yes | |
ManaPulse_last | integer | No | |
ManaPulse_level | integer | Yes | |
ManaPulse_next | integer | No | |
ManaPulse_targetx | real | Yes | |
ManaPulse_targety | real | Yes | |
TempPoint | location | No | |
Timer | timer | No | |
TimerRecycler_csize | integer | No | |
TimerRecycler_data | integer | Yes | |
TimerRecycler_inUse | boolean | Yes | |
TimerRecycler_orAtt | integer | Yes | |
TimerRecycler_size | integer | No | 1 |
TimerRecycler_timer | timer | Yes | |
unit | unit | No |
function CreepRespawn takes nothing returns nothing
local integer i = GetUnitTypeId(GetTriggerUnit())
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
call TriggerSleepAction(120.)
call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),i , x, y, 270.)
endfunction
//===========================================================================
function InitTrig_Creep_respawn takes nothing returns nothing
set gg_trg_Creep_respawn = CreateTrigger()
call TriggerRegisterPlayerUnitEventSimple(gg_trg_Creep_respawn, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(gg_trg_Creep_respawn, function CreepRespawn)
endfunction
function Trig_HandleTest_Actions takes nothing returns nothing
local timer t=CreateTimer()
call BJDebugMsg(I2S(H2I(t)-0x100000))
call DestroyTimer(t)
set t=null
endfunction
//===========================================================================
function InitTrig_HandleTest takes nothing returns nothing
set gg_trg_HandleTest = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_HandleTest, Player(0), "w", true )
call TriggerAddAction( gg_trg_HandleTest, function Trig_HandleTest_Actions )
endfunction
//TESH.scrollpos=48
//TESH.alwaysfold=0
This is the JESP standard document, if a map contains this document it means that there are
spells that follow this standard.
Spells of this map that follow the standard:
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- Cold Snap
- Aura of Energy
Advantages of the Standard
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- Implementing spells that follow the standard is relatively easier than implementing JASS
spells that don't follow the standard.
- Configuring/Balancing spells that follow the standard is relatively easier than
implementing JASS spells that don't follow the standard.
- Users may do the following procedure to make a new ability that uses the spell's script :
* Create a new Trigger with a name (case sensitive)
* Convert that trigger to custom text.
* Copy the spell's script to a text editor like Notepad or your OS equivalent.
* Replace the spell's Code name with the name you used on the trigger.
* Copy the new text to the new trigger
* Duplicate the Spell's original objects to have new ones for the new spell script.
You are now able to use that new version of the spell.
- In case two guys give the same name to 2 different spells, there are no conflict problems
because you can easily change the name of one of them
What is the JESP Standard?
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
The JESP standard was designed to make spell sharing much better. And to make sure JASS
enhanced spells follow a rule, to prevent chaos.
What does JESP Standard stands for?
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
JASS
Enhanced
Spell
Pseudotemplate
Requirements for a spell to follow the JESP Standard
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
- The spell is written in JASS
- The spell is 100% multi instanceable.
- The spell script is ready to support spells of any number of levels.
(default config header is not required to support all of them)
- The Spell has an specific code name.
- The Spell's trigger must have the spell's codename as name
- The Spell's InitTrig function must be named: InitTrig_<CodeName>
- The spell has a configuration header.
- It is mandatory that rawcodes of objects are configurable in the header.
- All the spell's specific code is inside the spell's "Trigger" (Trigger== that custom text
slot that world editor calls Trigger, the spell may use as many 'trigger' OBJECTS as needed)
- Every spell-specific single identifier or key works in such a way that reproducing the
spell's trigger but after performing a text-replace of codename with another name (and thus
renaming the cloned trigger to the new code name) it won't cause compile errors / conflicts
when playing the map.
- There is no code inside the spell's "Trigger" that is not specific to the spell.
- There are no requirements for GUI variables that are specific to the spell. If a system
used by the spell requires GUI variables the code for the system must be outside the "Trigger"
- Eyecandy and spell's balance have to be easy to configure
- The name of the author should be included in the spell's script.
- The reason to exist of this standard is spell sharing. This document should be included
within the map. And it should specify which spell follows the standard, in the top list.
I optimized and rescripted you code so that it is effecient like vJASS. The only bad thing is that I had
to add some global variabels for every spell, but I hope that's not that bad. But well with this effective
script I think it's 5/5 :D.
Well I hope you like it.
//TESH.scrollpos=0
//TESH.alwaysfold=0
// *******************************************
// * Edit these functions with rawcodes etc! *
// *******************************************
// The rawcode of the dummy unit
constant function Polarize_DummyUnit takes nothing returns integer
return 'H000'
endfunction
// The path of the special effect that appears on the caster
constant function Polarize_Effect takes nothing returns string
return "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl"
endfunction
// The rawcode of the polarize hero ability
constant function Polarize_Abil takes nothing returns integer
return 'A000'
endfunction
// The rawcode of the polarize upgrade thingy
constant function Polarize_Upgrade takes nothing returns integer
return 'R000'
endfunction
//============================================================================
function Polarize takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local real x = GetUnitX(caster)
local real y = GetUnitY(caster)
local unit dummy = CreateUnit(GetOwningPlayer(caster), Polarize_DummyUnit(), x, y, GetUnitFacing(caster))
// set the dummy's stats to match those of the caster
call SetHeroLevel(dummy, GetHeroLevel(caster), false)
call SetHeroAgi(dummy, GetHeroAgi(caster, false), true)
call SetHeroStr(dummy, GetHeroStr(caster, false), true)
call SetHeroInt(dummy, GetHeroInt(caster, false), true)
// Order Dummy to attack and remove him
call IssueTargetOrder(dummy, "attack", GetSpellTargetUnit())
call DestroyEffect(AddSpecialEffect(Polarize_Effect(), x, y))
call RemoveUnitAfterTime(dummy,1.)
// then null the variables
set caster = null
set dummy = null
endfunction
function PolarizeConditions takes nothing returns boolean
return GetSpellAbilityId() == Polarize_Abil()
endfunction
//==========================================================================
//Polarize Learn
function PolarizeLearn takes nothing returns nothing
local player p = GetOwningPlayer(GetTriggerUnit())
if GetPlayerTechCount(p, Polarize_Upgrade(), true) > 1 then
call SetPlayerTechResearched(p, Polarize_Upgrade(), (GetPlayerTechCount(p, Polarize_Upgrade(), true) + 1))
endif
set p = null
endfunction
function PolarizeLearnConditions takes nothing returns boolean
return GetLearnedSkill() == Polarize_Abil()
endfunction
//===========================================================================
function InitTrig_Polarize takes nothing returns nothing
local integer index = 0
local trigger learn = CreateTrigger()
local integer upId = Polarize_Upgrade()
set gg_trg_Polarize = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Polarize, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT,Filter(function DebugFilter))
call TriggerRegisterPlayerUnitEvent(learn, Player(index), EVENT_PLAYER_HERO_SKILL,Filter(function DebugFilter))
call SetPlayerTechResearched(Player(index), upId, 1)
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(gg_trg_Polarize, Condition(function PolarizeConditions))
call TriggerAddAction(gg_trg_Polarize, function Polarize)
call TriggerAddCondition(learn, Condition(function PolarizeLearnConditions) )
call TriggerAddAction(learn, function PolarizeLearn)
call Preload(Polarize_Effect())
call PreloadStart()
set learn=null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
// ***************************************************************
// * Omg constants, change these so the spell works in your map! *
// ***************************************************************
// The health to restore for each unit.
// What you see here takes the half of the damage absorbed by the orb and multiplies it by 3 * the level.
function ManaPulse_HealthToRestore takes unit dummy, integer level returns real
return ((I2R(GetUnitUserData(dummy)) / 2.) * (I2R(level) / 3.))
endfunction
// The effect made on each unit when it is healed
constant function ManaPulse_HealEffect takes nothing returns string
return "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBoltImpact.mdl"
endfunction
// The ability rawcode for mana pulse's hero ability
constant function ManaPulse_Abil takes nothing returns integer
return 'A002'
endfunction
// The rawcode for the dummy unit
constant function ManaPulse_Dummy takes nothing returns integer
return 'h002'
endfunction
// The special effect for when the orb is created
constant function ManaPulse_BirthEffect takes nothing returns string
return "Abilities\\Spells\\Other\\Charm\\CharmTarget.mdl"
endfunction
// The minimum amount of health that is healed by the orb, even if it drains no enemy units
constant function ManaPulse_Minimum takes nothing returns integer
return 50
endfunction
// The duration of the orb
function ManaPulse_Duration takes integer level returns real
return I2R(level) * 3.0
endfunction
// The range of the orb's effect
constant function ManaPulse_Range takes nothing returns real
return 500.0
endfunction
//=======================================================================================
function ManaPulseEnd takes nothing returns nothing
local timer t =GetExpiredTimer()
local integer chi =GetTimerData(t)
local group g =CreateGroup()
local player owner =GetOwningPlayer(udg_ManaPulse_dummy[chi])
local string loopgfx=ManaPulse_HealEffect()
local real htr =ManaPulse_HealthToRestore(udg_ManaPulse_dummy[chi], udg_ManaPulse_level[chi])
local unit a
//then we get the nearby units
call GroupEnumUnitsInRange(g, udg_ManaPulse_targetx[chi], udg_ManaPulse_targety[chi], ManaPulse_Range(),Filter(function DebugFilter))
loop
set a=FirstOfGroup(g)
exitwhen a==null
call GroupRemoveUnit(g,a)
if IsUnitAlly(a,owner) then
call SetUnitState(a, UNIT_STATE_LIFE, RMaxBJ(0., htr + GetUnitState(a, UNIT_STATE_LIFE)))
call DestroyEffect(AddSpecialEffect(loopgfx, GetUnitX(a), GetUnitY(a)))
endif
endloop
//clean all up
call DestroyGroup(g)
call KillUnit(udg_ManaPulse_dummy[chi])
call RemoveUnitAfterTime(udg_ManaPulse_dummy[chi],1.)
set udg_ManaPulse_dummy[chi]=null
set udg_ManaPulse_index[chi]=udg_ManaPulse_last
set udg_ManaPulse_last =chi
call RecycleTimer(t)
set t =null
set owner=null
set g =null
endfunction
function ManaPulse takes nothing returns nothing
//make the locals
local timer t
local unit caster = GetTriggerUnit()
local integer chi = udg_ManaPulse_last
local location temp = GetSpellTargetLoc()
if (chi!=0) then
set udg_ManaPulse_last=udg_ManaPulse_index[chi]
else
set udg_ManaPulse_next=udg_ManaPulse_next+1
set chi =udg_ManaPulse_next
endif
set udg_ManaPulse_index[chi]=-1
//init globals
set udg_ManaPulse_targetx[chi]=GetLocationX(temp)
set udg_ManaPulse_targety[chi]=GetLocationY(temp)
set udg_ManaPulse_dummy[chi] =CreateUnit(GetOwningPlayer(caster), ManaPulse_Dummy(), udg_ManaPulse_targetx[chi], udg_ManaPulse_targety[chi], 270.0)
set udg_ManaPulse_level[chi] =GetUnitAbilityLevel(caster, ManaPulse_Abil())
//make a special effect
call DestroyEffect(AddSpecialEffect(ManaPulse_BirthEffect(), udg_ManaPulse_targetx[chi], udg_ManaPulse_targety[chi]))
//make the dummy play the birth animation
call QueueUnitAnimation(udg_ManaPulse_dummy[chi], "birth")
call SetUnitUserData(udg_ManaPulse_dummy[chi], ManaPulse_Minimum())
//wait for the orb to be destroyed
set t=GetTimer(chi)
call TimerStart(t,ManaPulse_Duration(udg_ManaPulse_level[chi]),false,function ManaPulseEnd)
//then we get the nearby units
call RemoveLocation(temp)
set temp = null
set caster= null
set t = null
endfunction
function ManaPulseConditions takes nothing returns boolean
return GetSpellAbilityId() == ManaPulse_Abil()
endfunction
//Mana Pulse Damage
function ManaPulseDamage takes nothing returns nothing
local unit u = GetAttacker()
local integer i = GetUnitUserData(u)
local real r
call SetUnitUserData(u, (i+5))
set i = GetUnitUserData(u)
set r = i*0.01
call SetUnitScale(u, r, r, r)
set u = null
endfunction
function ManaPulseDamageConditions takes nothing returns boolean
return GetUnitTypeId(GetAttacker()) == ManaPulse_Dummy()
endfunction
//===========================================================================
function InitTrig_Mana_Pulse takes nothing returns nothing
local integer index=0
local trigger PulseDamage=CreateTrigger()
set gg_trg_Mana_Pulse = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Mana_Pulse, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT,Filter(function DebugFilter))
call TriggerRegisterPlayerUnitEvent(PulseDamage, Player(index), EVENT_PLAYER_UNIT_ATTACKED,Filter(function DebugFilter))
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(gg_trg_Mana_Pulse, Condition(function ManaPulseConditions))
call TriggerAddAction(gg_trg_Mana_Pulse, function ManaPulse)
call TriggerAddCondition(PulseDamage, Condition(function ManaPulseDamageConditions))
call TriggerAddAction(PulseDamage, function ManaPulseDamage)
call Preload(ManaPulse_HealEffect())
call Preload(ManaPulse_BirthEffect())
call PreloadStart()
set PulseDamage=null
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
//********************************************************************************
//* *
//* Cold Snap by Pyritie *
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ *
//* This spell follows the JESP standard. See the JESP Manifest trigger for *
//* more information. *
//* *
//* How to implement this spell *
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ *
//* 1) Copy over the ability and Ice Cube unit from the object editor into *
//* your map. *
//* 2) Export any imports (the ones in the ColdSnap\ category are recommended) *
//* and them import them into your own map. *
//* 3) Create a new trigger called "Cold Snap" (PROTIP: It's case sensitive!) *
//* 4) Convert the trigger to Custom Text (Edit > Convert to Custom Text > Ok). *
//* 5) Copy and paste the whole of this trigger into your new Cold Snap *
//* trigger. *
//* 6) Save your map. *
//* 7) ???? *
//* 8) PROFIT! *
//* *
//********************************************************************************
//================================================================================
// Modify the below functions to customize this spell!
//================================================================================
//The path of the middle effect when the spell is casted
//Remember that in JASS, paths need to have "\\" where there is normally a "\"!
constant function ColdSnap_BirthFX takes nothing returns string
return "ColdSnap\\FreezingRing.mdl"
endfunction
//The path of the effect when a block is created
constant function ColdSnap_BlockCreateFX takes nothing returns string
return "Objects\\Spawnmodels\\Other\\ToonBoom\\ToonBoom.mdl"
endfunction
//The path of the effect when a block is destroyed (at the end of the spell)
constant function ColdSnap_BlockDestroyFX takes nothing returns string
return "Objects\\Spawnmodels\\Other\\ToonBoom\\ToonBoom.mdl"
endfunction
//The path of the iceberg effect (at end of ability when units are damaged)
constant function ColdSnap_IcebergFX takes nothing returns string
return "ColdSnap\\iceberg.mdl"
endfunction
//The radius of the affected area. This should be the same as the
//Area of Affect field in the object editor for the Cold Snap ability.
constant function ColdSnap_Radius takes nothing returns real
return 250.0
endfunction
//How many blocks should be in the circle.
constant function ColdSnap_Iterations takes nothing returns integer
return 18
endfunction
//The unit ID of the block unit.
constant function ColdSnap_BlockId takes nothing returns integer
return 'n004'
endfunction
//The ability ID of the Cold Snap ability.
constant function ColdSnap_AbilityId takes nothing returns integer
return 'A004'
endfunction
//The ability ID of the small pathing blocker destructable.
constant function ColdSnap_BlockerId takes nothing returns integer
return 'YTpc'
endfunction
//The duration of the blocks before they are destroyed.
constant function ColdSnap_Duration takes integer level returns real
//Use the "level" variable if you want the duration to be affected by the caster's level.
return 10.0 + (level * 0.0)
endfunction
//The damage dealt at the end of the spell.
constant function ColdSnap_Damage takes nothing returns real
return 200.0
endfunction
//Does the damage affect magic immunes? true = yes, false = no.
constant function ColdSnap_Affect takes nothing returns boolean
return true
endfunction
//========================================================================================
// Don't touch the below unless you know what you're doing. That means you, Preskooldude.
//========================================================================================
function ColdSnap_AttackType takes nothing returns attacktype
if ColdSnap_Affect() then
return ATTACK_TYPE_CHAOS
else
return ATTACK_TYPE_MAGIC
endif
endfunction
function ColdSnap_Callback takes nothing returns nothing
local timer t =GetExpiredTimer()
local integer chi =GetTimerData(t)
local integer a =0
local integer max =ColdSnap_Iterations()
local string loopgfx=ColdSnap_BlockDestroyFX()
loop
exitwhen a > max - 1
//add another effect
call DestroyEffect(AddSpecialEffect(loopgfx, udg_ColdSnap_dummyx[a+chi*max], udg_ColdSnap_dummyy[a+chi*max]))
//then remove the block and null the variable
call RemoveUnit(udg_ColdSnap_dummy[a+chi*max])
set udg_ColdSnap_dummy[a+chi*max] = null
call RemoveDestructable(udg_ColdSnap_blocker[a+chi*max])
set udg_ColdSnap_blocker[a+chi*max] = null
//and increase the loop index
set a = a + 1
endloop
set udg_ColdSnap_caster[chi]=null
//add the iceberg effect
call DestroyEffect(AddSpecialEffect(ColdSnap_IcebergFX(), udg_ColdSnap_targetx[chi], udg_ColdSnap_targety[chi]))
//then damage the area
call UnitDamagePoint(udg_ColdSnap_caster[chi], 0.0, ColdSnap_Radius(), udg_ColdSnap_targetx[chi], udg_ColdSnap_targety[chi], ColdSnap_Damage(), true, false, ColdSnap_AttackType(), DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
set udg_ColdSnap_index[chi]=udg_ColdSnap_last
set udg_ColdSnap_last =chi
call RecycleTimer(t)
set t=null
endfunction
function ColdSnap takes nothing returns nothing
local unit caster = GetTriggerUnit()
local player p = GetOwningPlayer(caster)
local location l = GetSpellTargetLoc()
local integer a = 0
local integer max = ColdSnap_Iterations()
local integer idU = ColdSnap_BlockId()
local integer idD = ColdSnap_BlockerId()
local integer chi = udg_ColdSnap_last
local string loopgfx = ColdSnap_BlockCreateFX()
local real x1 = GetLocationX(l)
local real y1 = GetLocationY(l)
local real x2
local real y2
local real de = 360 / ColdSnap_Iterations()
local real di = ColdSnap_Radius()
local timer t
if (chi!=0) then
set udg_ColdSnap_last=udg_ColdSnap_index[chi]
else
set udg_ColdSnap_next=udg_ColdSnap_next+1
set chi =udg_ColdSnap_next
endif
set udg_ColdSnap_index[chi]=-1
//add a special effect here of your choice
call DestroyEffect(AddSpecialEffect(ColdSnap_BirthFX(), x1, y1))
//loop through the circle
loop
exitwhen a > max - 1
//make the circle points
set x2 = x1 + di * Cos(a * de * bj_DEGTORAD)
set y2 = y1 + di * Sin(a * de * bj_DEGTORAD)
//make a special effect
call DestroyEffect(AddSpecialEffect(loopgfx, x2, y2))
//then create the unit and add it to the array
set udg_ColdSnap_dummy[a+chi*max] =CreateUnit(p, idU, x2, y2, GetRandomReal(0.0, 360.0))
set udg_ColdSnap_blocker[a+chi*max]=CreateDestructable(idD, x2, y2, 0.0, 1.0, 1)
set udg_ColdSnap_dummyx[a+chi*max] =x2
set udg_ColdSnap_dummyy[a+chi*max] =y2
//increase the loop index
set a = a + 1
endloop
set udg_ColdSnap_caster[chi] =caster
set udg_ColdSnap_targetx[chi]= x1
set udg_ColdSnap_targety[chi]= y1
//then we wait for the spell to end
set t=GetTimer(chi)
call TimerStart(t,ColdSnap_Duration(GetUnitAbilityLevel(caster, ColdSnap_AbilityId())),false,function ColdSnap_Callback)
call RemoveLocation(l)
set caster=null
set t =null
set l =null
set p =null
endfunction
function ColdSnapConditions takes nothing returns boolean
return GetSpellAbilityId() == ColdSnap_AbilityId()
endfunction
//==========================================================================
function InitTrig_Cold_Snap takes nothing returns nothing
local integer index = 0
set gg_trg_Cold_Snap = CreateTrigger()
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Cold_Snap, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT,Filter(function DebugFilter))
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(gg_trg_Cold_Snap, Condition(function ColdSnapConditions))
call TriggerAddAction(gg_trg_Cold_Snap, function ColdSnap)
call Preload(ColdSnap_BirthFX())
call Preload(ColdSnap_BlockCreateFX())
call Preload(ColdSnap_BlockDestroyFX())
call Preload(ColdSnap_IcebergFX())
call PreloadStart()
endfunction
//TESH.scrollpos=0
//TESH.alwaysfold=0
//***********************************************************************************
//* *
//* Aura of Energy by Pyritie *
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ *
//* This spell follows the JESP standard. See the JESP Manifest trigger for *
//* more information. *
//* *
//* How to implement this spell *
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ *
//* 1) Copy over the ability from the object editor into your map. *
//* 3) Create a new trigger called "Aura of Energy" (PROTIP: It's case sensitive!) *
//* 4) Convert the trigger to Custom Text (Edit > Convert to Custom Text > Ok). *
//* 5) Copy and paste the whole of this trigger into your new Aura of Energy *
//* trigger. *
//* 6) Save your map. *
//* 7) Change the rawcodes, then save again. *
//* *
//***********************************************************************************
// The effect that is used for each allied unit that gains mana
constant function AuraOfEnergy_UEffect takes nothing returns string
return "Abilities\\Spells\\Undead\\DarkRitual\\DarkRitualTarget.mdl"
endfunction
// The rawcode of the hero ability
constant function AuraOfEnergy_Abil takes nothing returns integer
return 'A005'
endfunction
// The amount of mana to restore
// level 1 = 50%, level 2 = 75%, level 3 = 100%
function AuraOfEnergy_Mana takes integer level, real totalmana returns real
local real toreturn=totalmana
if level == 1 then
set toreturn = totalmana / 2.
elseif level == 2 then
set toreturn = totalmana / (4./3.)
endif
return toreturn
endfunction
// The effect that appears on the unit that was killed
constant function AuraOfEnergy_Effect takes nothing returns string
return "ColdSnap\\FreezingRing.mdl"
endfunction
// Range of the effect
constant function AuraOfEnergy_Range takes nothing returns real
return 900.0
endfunction
//====================================================================================
function AuraOfEnergyFilter takes unit enum,unit killer returns boolean
return (GetUnitState(enum, UNIT_STATE_MAX_MANA) > 0.) and (not IsUnitEnemy(enum, GetOwningPlayer(killer)))
endfunction
function AuraOfEnergy takes nothing returns nothing
local unit killer = GetKillingUnit()
local unit dead = GetDyingUnit()
local unit enum
local real totalmana = GetUnitState(dead, UNIT_STATE_MANA)
local real x = GetUnitX(dead)
local real y = GetUnitY(dead)
local group g = CreateGroup()
local integer level = GetUnitAbilityLevel(killer, AuraOfEnergy_Abil())
//level 1 = 50%, level 2 = 75%, level 3 = 100%
set totalmana = AuraOfEnergy_Mana(level, totalmana) / I2R(CountUnitsInGroup(g))
call DestroyEffect(AddSpecialEffect(AuraOfEnergy_Effect(), x, y))
call GroupEnumUnitsInRange(g, x, y, AuraOfEnergy_Range(), Condition(function DebugFilter))
//ally heal
loop
set enum=FirstOfGroup(g)
exitwhen enum==null
call GroupRemoveUnit(g,enum)
if AuraOfEnergyFilter(enum,killer) then
call SetUnitState(enum, UNIT_STATE_MANA, totalmana + GetUnitState(enum, UNIT_STATE_MANA))
call DestroyEffect(AddSpecialEffect(AuraOfEnergy_UEffect(), GetUnitX(enum), GetUnitY(enum)))
endif
endloop
//clean stuff up
call DestroyGroup(g)
set g = null
set killer = null
set dead = null
endfunction
function AuraOfEnergyConditions takes nothing returns boolean
return (IsUnitEnemy(GetDyingUnit(), GetOwningPlayer(GetKillingUnit()))) and (GetUnitState(GetDyingUnit(), UNIT_STATE_MANA) > 0.00) and (GetUnitAbilityLevel(GetKillingUnit(), AuraOfEnergy_Abil()) > 0)
endfunction
//===========================================================================
function InitTrig_Aura_of_Energy takes nothing returns nothing
local integer index
set gg_trg_Aura_of_Energy = CreateTrigger()
set index = 0
loop
call TriggerRegisterPlayerUnitEvent(gg_trg_Aura_of_Energy, Player(index), EVENT_PLAYER_UNIT_DEATH,Filter(function DebugFilter))
set index = index + 1
exitwhen index == bj_MAX_PLAYER_SLOTS
endloop
call TriggerAddCondition(gg_trg_Aura_of_Energy, Condition(function AuraOfEnergyConditions))
call TriggerAddAction(gg_trg_Aura_of_Energy, function AuraOfEnergy)
call Preload(AuraOfEnergy_UEffect())
call Preload(AuraOfEnergy_Effect())
call PreloadStart()
endfunction