User Tools

Site Tools


Torchmodders Site

Wiki Navigation


How To Make Things Actually Happen Through Skills

By: Chthon

Here's an overview-level guide.

1. What Are "Things"?

I'm going to put the end goal at the beginning since I want to clarify it a bit. Since you want to make “things” actually happen through skills, it may help to clarify what “things” can be made to happen through skills in TL2. On the “big picture” level, there are only four. First, skills can be used to apply effects. (Take a good look at the list of effects – this is 95% of “things.”) Second, skills can apply weapon-based damage. Third, skills can summon something. Fourth, skills can make flashy lights appear on the screen.

(Side note about affixes: For the most part, affixes are just a convenient container for a bundle of effects. There's very little you can do with an affix that you can't do by simply applying the effects directly. The main advantage of affixes is that they can consolidate effects into one easy-to-edit place so that rebalancing the potency of your skill is easier.)

2. "Skills" Is a Bigger Category Than It First Appears

If you have the idea in your head that “skills” are just the 30 things in the skill tree in the UI, you need to get rid of that idea. Every time some kind of event happens in TL2, it's a skill. Many of the things that look like a single skill in the UI are in fact composed of multiple skills that work together to accomplish the intended result. The most common paradigm in the vanilla TL2 skills is having one skill to apply a triggerable or “cast skill on <condition>” effect and having a second skill actually do the work when the condition occurs. Two is by no means the limit. Depending on the complexity of what you want to do, more component skills may be in order. I think the most component skills I have ever used to make up one “skill” from the player's perspective is somewhere around a dozen. (Important note: Any skill that can be used by a player character that does not belong in the UI skill tree needs to have the HIDDEN flag set or it will mess up respecs.)

3. How Skills Get Cast

3.1. Passive activation - A skill marked as PASSIVE will be automatically (re)cast on its owner upon spawning, zoning, or changing any piece of equipment. Don't quote me on this, but I think making changes to stat and skill points causes passives to reset too.

3.2. Normal activation - via the skillbar or mouse.

3.3. From an EXECUTE_SKILL block inside another skill.

3.4. From a Cast skill on <condition> effect on a unit.

3.5. From a Triggerable on a unit.

3.6. From a Minion.

The usefulness of this is not immediately obvious, so let me explain. 
It's possible to create a minion unit that is invisible, invincible, untargetable,
uncollidable, and that attaches to another unit and moves along with it. Sometimes 
the best way to get something to happen in looping or periodic manner is to have 
your main skill summon a "dummy" minion like this and give the dummy minion skills 
that actually do the thing you want done.

Hint: Methods 3.4 to 3.6 are useful for making multi-part skills.

4. A Very Brief Guide to Event Blocks

Skills are organized into “blocks.” Each block starts with a tag in [square brackets] and ends with a [/closing tag]. In between are properties or other blocks. The top-level block is [SKILL]. The second-level blocks are [LEVEL1], [LEVEL2], etc. (A few other things can also exist at this level, like statwatchers.) The only thing that should ever exist at the highest level within a LEVEL<X> block are the various species of “event blocks.” I'm going to go over some of the most important important ones.

EVENT_START happens the moment the skill is activated. You can have more than one EVENT_START. They will be executed sequentially from top to bottom – which is useful if you want to perform logic using stat operations.

EVENT_TRIGGER, EVENT_TRIGGER_TWO, etc happen at the moment that the animation reaches the time designated as HITONE, HITTWO, etc. in the .animation file. This is how you synchronize effects with the animation. If the corresponding “hit” isn't defined in the .animation file, the block will never be executed. In that case you can use it as a dummy block for making the tooltip display effects that are actually delivered by a different hidden skill. Many of the vanilla skills use EVENT_TRIGGER_FOUR for this purpose.

EVENT_UNITHIT happens when a damage shape hits a unit. Unless you set CAN_CLONE to false, multiple copies of the EVENT_UNITHIT block will execute if multiple units get hit.

EVENT_MISSILEHIT happens when a missile hits something. This is another event type that you may get multiple copies of unless you disallow clones.

EVENT_END happens when everything else pertaining to the skill is completely finished.

5. Making Event Blocks Do Things

First, in order for the event block to do something, it must have something to do. It needs to have an EFFECTS sub-block, or an AFFIXES sub-block, or a WEAPON DMG % value other than 0, or some combination thereof.

Second, in order to get the “something” from the skill onto the target unit(s), you need one of three things:

(A) Give the event block a layout file that includes a damage shape (and a timeline to activate the damage shape).

(B) Set the APPLY EFFECTS flag.

(C) Give the event block a layout file that spawns a missile.

Special note about EVENT_UNITHIT and EVENT_MISSILEHIT: These are exceptions to the above. They “just work” without a damage shape or any of this. Also, these events are usually redundant since the event that includes the damage shape or missile can also convey effects and weapon damage.

6. A Note About Logic

If you want to build more complex logic for things to happen conditionally or in a step-by-step way, the stat system is the tool you need. This topic is way too big to fully explain here, so I'll just give the basics: You can create a custom stat in the stats editor. You can manipulate the value of a stat on a unit by applying the SET STAT and ADD STAT effects. You can create conditional behavior by adding a STATWATCHER sub-block to any block inside a skill.* That block will not execute unless the condition defined in the statwatcher is met. You can use multiple statwatchers; the block will only execute if all of the conditions are met. Stats and statwatchers, coupled with the fact that blocks of the same type will execute in order from top to bottom (and the ability to launch additional skills via EXECUTE_SKILL) basically gives you a very rudimentary programming language.

(* For some reason statwatchers are bugged when used with EFFECTS blocks. But they work fine with AFFIXES blocks, so just wrap your effects into an affix. Also on the topic of stats and bugs, SET STAT and ADD STAT do not work reliably in EVENT_END blocks.)

7. Summoning Stuff

All you need is to give the event block a layout file that includes a unit spawner (and a timeline to activate the unit spawner). You can define the minion or missile to be spawned (along with how many, where, pointed which way, etc.) in the unit spawner.

8. Making Flashy Lights Happen

Three ways: (A) Give the event block a layout file that includes one on more link layout particles, and maybe some sounds to go with them (and a timeline to activate them). (B) Apply an effect to a unit that has a unit theme. (Unit themes are built out of link layout particles.) (C) You can add particle effects directly into the .animation file for the animation. (This is really awkward and cumbersome and not recommended unless you cannot get the visual effect you want any other way.)

how_skills_make_things_happen_an_overview.txt · Last modified: 2017/03/24 01:21 by phanjam