Champion Tute 2: Pillar of Flame
Hey there, wolf again.
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.
The arguments are:
string name_of_particle_file
constant particle_attachment_type
handle owning_entity
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.
The arguments are:
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.
Thanks for reading!
Cya.










