Build-Up and Release Skills
by Arkander Original post: http://forums.runicgames.com/viewtopic.php?f=57&t=58153
This is a tutorial for creating what I've termed “Build and Release” skills (since Charge has a set meaning) - skills that build up power while the key is pressed and then fire a spell when the key is released. I could not find any examples of this type of effect in the base game, so I figured that even thought the individual steps may appear simple, I should share the process so anyone looking to do something similar doesn't have to work it out themselves.
The three custom components needed are: 1) A dynamic stat “skill counter” to track how much power is built up 3) A skill that will “do the work” - spawn missiles, apply damage, etc, and its layout. 4) A dummy skill that the player takes ranks in that manages animations and increments the stat
Optional: 1) Custom Particles/Layouts 2) Changing sound effects 3) Adjusting animations
I'll be covering the custom particles a little at the end; the other parts are beyond the scope of this tutorial.
For this example, I am going to modify the Engineer's Blast Cannon ability into a charge-up ability I will call Blast Capacitor. I chose this skill simply because cannons have a good default animation for this purpose (Fussilade's, to be precise), and I can fit it into an existing class instead of creating an entirely new class for this tutorial.
This is the simplest part. Navigate to Data Editors→Stats, and click on the green + to create the stat. I named my stat “demo_capacitor_counter” - the “demo_” prefix follows OedipusTex's recommendation on asset naming, and “capacitor_counter” is descriptive(ish). Pretty much everything in this window can be left blank, since the default values are fine. I chose the maximum value of 50 from pretty much nowhere: the counter should never get that high.
THE ACTING SKILL
Fire up the skill editor and search for the skill of choice (for my example, I typed: “name  blast” in the search field). Clone the skill twice - once for the acting skill, and again for the dummy skill for the next step. I've named the skills “Blast Capacitor Charge” and “Blast Capacitor Launch”. This step focuses on the “Launch” skill.
Change the Activation Type to PROC (this skill will be activated by our dummy skill later). Flip Can Attack Fallback to False and Hidden to True. In the text editor, delete levels 2-15 (level 1 can be copied through later), then in level 1, delete the contents of [EVENT_START] and move the <STRING>FILE: line in [EVENT_TRIGGER] there. Delete the [EVENT_TRIGGER] block.
All of the data that caused the base Blast Cannon ability to do damage is now gone. To get it back in a more flexible format, create a new MISSILE_HIT event. If the skill used a damage shape instead of a missile, the event type would be an EVENT_TRIGGER(_NUMBER). Flip Apply Effects to True.
Now add an EFFECT to that event. Name it something descriptive (BlastCapacitorDamage, in my case), give it an EffectType of Damage and some min and max vaues. Scroll to the right a bit and put the name of the stat created in step one in the StatName box, and the percent multiplier per point of the counter stat in the StatPercent box.
The complete “Blast Cannon Launch” markup text is available in the second post.
NOTE: According to the documentation I found, the damage dealt should be [Base + Base * Stat * StatPercent/100], where Base is a value between the min and max specified. However, I found that the damage is significantly less than that for reasons I can't explain - with StatPercent at 100 and Min and Max at 1000, I was doing around 100 damage per counter value - only a tenth of what I had expected, and without the base value added in.
THE DUMMY SKILL
Now lets go back to the second clone - in my case, Blast Capacitor Charge. Give it appropriate description text, including the display name and requirements. As with the previous skill clear out levels 2-15. Give the skill a minimum time at least equal to the animation duration. Flip Continuous Looping to True in both the base SKILL and the LEVEL1 Objects and set a maximum duration in the LEVEL1 Object (keep in mind that this appears to be modified by cast speed). In the text editor, clean out the default Events.
Next, set up an Event to increment the counter. For my example I am using Special_Fussilade_Start and Special_Fussilade_Loop with a speed of 2. Special_Fussilade_Loop calls HITTHREE once each loop, so I will add a new Event with of type EVENT_TRIGGER_THREE. (If you need to check what EVENT_TRIGGER(s) the looping animation you wish to use calls, use the animation editor.) To increment the counter, create a new EFFECT with the EffectName identical to the Stat name from step 1 that will ADD STAT with min and max of 1. Make sure that Chance is set to 100 and that the EFFECT object has the Target of SELF.
That handles the counting up, but the counter also needs to be reset. Resetting the counter while the missile is in flight/skill damage is in progress could have some weird consequences, so I choose to reset when the skill starts, which will hopefully be after the acting skill finishes. Add another Event of type EVENT_START and attach an EFFECT that will CLEAR STAT on the custom stat. Against, make sure Chance is 100.
Lastly, we need to call the acting Skill from step 2. Make an EVENT_END, and add an EXECUTE_SKILL to it. Find the “Launch” skill and add it to the EXECUTE_SKILL object. This is also the place to add a cooldown - I recommend at least a short cooldown to prevent the player from resetting the stat before the damage hits. Add an EFFECT with the EffectName of the dummy “charging” skill, an effect of SET SKILL COOLDOWN REMAINING, and a minimum and maximum value in seconds.
With everything set up, attach the Skill to the Class and test it. Verify that the damage against a punchbag changes with charge time; if not, use the Player Effect and Stat Watcher to make sure that the counter is incrementing and resetting properly. If the counter is not working, the likely culprits are the Chance field in the Effects and the Target field in the Effect objects.
The complete “Blast Cannon Charge” markup text is available in the second post.
With luck, everything now works. However, the projectile is the same no matter how much the player charges the skill. Fixing this involves using the [STATWATCHER] block (accessable through the GUI as RMB→Add→STAT REQ). The projectile is defined in the layout specified by the <STRING>FILE: line that was moved to the [EVENT_START] block back in step 2. To change the projectile based on charge time, add a STAT REQ to the EVENT_START object to compare the custom stat with GREATER THAN some value. Copy the entire EVENT_START block, change the STAT REQ Watch Type to be LESS THAN OR EQUAL TO, and then change the layout to some other similar layout. For demonstration purposes, I used Magma Spear.
When the charge ends, the Launch skill fires, but the character doesn't animate for it. To add an animation to the skill's firing, go to the charging skill and add “<STRING>ANIMATIONLOOPEND:animation_name” to the skill strings at the same layer as the other animation <STRING>s. It may seem to disappear when accepting changes to the text field, but just scroll down; since this option isn't available through the GUI, the markup format sorts this option towards the end of that layer. I used cannon1, the same animation used for the default Blast Cannon skill. It may take some tinkering with the layouts to get the skill release synced with the animation.
The skill still only has one level. To fill out the rest of the levels, copy the [LEVEL1] block through on both the dummy and the acting skill, and change the values as you wish. In my example, I kept the dummy skill the same except for increasing max time at Tiers 1, 2, and 3, and just changed the damage in the acting skill steadily throughout all 15 levels.
Q: Something isn't working.
A: Restart GUTS.
Q: Something still isn't working.
A: Check the Chance and Target fields in everything. This was the cause of 90% of the issues I had working on this (the remaining 10% are documented in various forum posts :roll: ).
Q: Can I add different effects to different charge levels?
A: Absolutely! Look for more documentation on Stat Watchers and add them in. Keep in mind that Stat Watchers can behave weirdly if they aren't in an EVENT, so you may need multiple EVENT_TRIGGER/EVENT_MISSILEHIT/etc with the special case stat watchers inside.
Q: I want to have more particle layouts for various charge levels.
A: Keep in mind that if multiple Event's STATWATCHERs are valid, all those Events will try to go off. This is problematic when calling layouts - for best results, use no more than 1 GREATER THAN (at the high end) and 1 LESS THAN (at the low end), with EQUAL TO for all values in between. Depending on the granularity of your counter vs. the number of particle possibilities this may lead to a lot of repetition, but it will work.
Q: I want to make my ability scale with Weapon DPS.
A: The best way I've found to do this is to go to the EFFECT that increments the skill counter and have it add the stat CHARACTER DPS BEST with a StatPercent of 100 and a Min and Max of 10. If you also want to have special effects for some channel times, even if it's just the various particle layouts described earlier, you will need to make the damage counter a separate stat from the normal counter (demo_capacitor_counter_dps for my experiment) and modify both of them everywhere you'd normally modify the original stat. Compare values to the normal counter to measure relative charge time and use counter_dps (or whatever you've named the new stat) in the damage effect.
OedipusTex - for the excellent reference guides I used to work this stuff out TwinkleToes - for pointing out the ANIMATIONLOOPEND option not available through the GUI menus wolpak, bumbleguppy, and TwinkleToes - for answering questions and helping to troubleshoot my prototype
EDIT 1: Formatting EDIT 2: Added ANIMATIONLOOPEND EDIT 3: Added colors to better identify various pieces. EDIT 4: Weapon DPS Solved!