Champion Tute 2: Pillar of Flame
This is the second part of out champion porting tutorial. Today we will talk about AoE spells, delayed actions and spell icons!
Letās start with we already knew, making an ability!
Iāve modified original Brand file to list his new spell, Pillar of Flame.
Now we can move on to our next ability. Most of the code is similar, so Iāll just keep the explanations on the new elements, if you have any doubt, see the last post for more basic info.
There is 2 basic differences with previous spell, it uses BEHAVIOR_AOE to define an spell with AoE, and AOERadius which specifies the effect radius of the spell.
Weāll be using two particles this time, one for the instant cast feedback, and one for the actual damage effect 0.625 seconds later. In the same way of the past lesson, weāll be using custom args on the RunScript block to make our magic happens on the lua file. Lets move on then.
On this first block, we have some common value attribution, to make the rest of the code easier to read.
The last three lines are news for us though! The first one, creates an particle with the ParticleManagerās CreateParticle method. It takes three arguments and returns the handle of the particle.
string name_of_particle_file
constant particle_attachment_type
In this case, we used the instant feedback particle nameĀ āparticles/units/heroes/hero_lina/lina_spell_light_strike_array_ray_team.vpcfā.
When the target of the particle isnāt the caster or another unity, usually itās set as PATTACH_CUSTOMORIGIN, which implies weāll set an custom coordinates vector with the position for the particle.
The owner handle in this context isnāt too important, but weāll set it anyway.Ā
The last two lines are control points of the particle, it usually defines spawning and ending points, size, radius and other arbitrary values.
In this case control point 0 is the target point, and the control point 1, itās the radius of the particle.
The last part of the code itās the damage effect.
Weāll use Timer library in this code, which is made by BMD.
CreateTimer triggers an function immediately or after an initial delay, and can be repeated after every x seconds using return seconds on the function.
In our case, we are using the SpecialValueĀ ādelayā which have 0.625 stored on KV file. So after this shortly interval, weāll execute the actual function, which have some new elements too.
FindUnitsInRadius takes several arguments and returns an list of handlers for found units.
int teamNumber (caster team for reference)
Vector position Ā (central point of search radius)
handle cacheUnit (ignore this, just use nil)
float radius Ā (search radius)
int teamFilter (which teams relative to caster should be looked)
int typeFilter Ā (which kind of units)
int flagFilter Ā (special conditions, like magic immunity)
int order Ā (it needs to be on some specific order?)
bool canGrowCache Ā (just use false here, for now)
Note for filters, there is some constants like DOTA_UNIT_TARGET_TEAM_ENEMY, making unnecessary to remember team internal IDs.
After finding all units we want, using an for loop, discarding the index, and getting the handle with for _,unit in pairs(), we can ApplyDamage for each unit found, like the past lesson.
So we now have pillar of flame done!
Wait. what is this ? Icons for ants?
If you tried to look into some folders, and found onĀ resource\flash3\images\spellicons all the icons of the mod, you probably tried to get the icon from wiki and putting with the correct name. But they got badly displayed in game, like in my screenshot. This happens because the images need to be exactly 128x128!
This can be fixed by resizing the icon in photoshop or even paint, or creating your own.