Stat-Based Abilities

Nurdguy

New Member
Reaction score
0
Greetings,

I've been reading the great tutorials here and playing around in the editor for a few days and I can't seem to figure out a number of things. I have made a unit with a custom ability and modified the tooltip to pull in from the damage of the effect rather than hard-code the number. I've read about how to make stats on heroes but haven't tried it myself yet because I'm not yet sure if I want it to be an attribute or if it needs to be something else.

What I'd like to do is to make an ability that scales based on a stat (or any numerical data, whether it's a trigger variable or something else is fine as well). The core idea is that the ability's damage and range (or any two properties.. cd, cost, radius, etc) are each based on different stats.

For a more concrete example, let's take something simple like snipe. How could I make it's damage scale with one stat (damage = 50 + (2*strength)) and make it's cast range scale with a second stat (range = 1 + (agility/2))?

As a bonus, could the tooltip still reflect the actual scaled number? For instance, if I have 10 strength, could it say 70 damage? At 11 strength, read 72 damage. Etc.

I have many more questions.. I must confess I'm not having much luck figuring things out myself. But I figure I should keep it to one question per thread and I'm starting with this one. Would really appreciate any help. I know the Custom Hero Defense map (my inspiration for the game I'm ultimately trying to make) has damage scaling via a "Potential" stat and the Ghost hero has a passive that increases the range of all abilities so I'm hoping my idea is actually possible, but I haven't been able to find any questions or tutorials here or via google searches. Thanks! :)

Answer

Of course I ask the question and then I finally find the answer. Or something that could work pretty well for my needs.

There's a trigger action called Catalog Reference Set which seems to allow you to set any data editor value (there's also Catalog Field Value Set but I didn't understand it). And the nice part is that it's specific to a certain player (NOTE: not specific to an individual unit though). Since in my map, each player will control only one hero, I can set up triggers so that when a hero's stat changes, it'll update the data for the effects tied that hero's abilities.

I did a simple test that whenever player 1 uses the damage effect of the hero's abilities, it would get the hero's health and the effects damage and store them to variables. I incremented health by 50 and damage by 1 and then set them back in the data and watched as my hero's health increased and the damage relayed in the ability's tooltip increased. I had placed the hero twice on the map for player 1 and a few times for another player. Both of copies of the hero had their health and damage increased (as expected, it's per player), the heroes owned by the other player did not change in health. So it seems to be a great success!

I did run into a small got'cha that seems worth mentioning: I originally stored the damage as a real value, incremented it by 1.5, and then set it. The first time I then used the ability the damage increased by 2. The second time I used it, I got an error reading it. I believe this is because the amount is actually stored as an integer, not a real, so doing this would necessitate using like Math.floor when setting the value. There's nothing in the trigger editor to point out that it's going to fail so play with caution. :)

Sources:
www.sc2mapster.com/forums/development/data/29687-stat-attribute-based-abilities/
www.youtube.com/watch?v=64x8jRL5np0
 

X-maul

AKA: Demtrod
Reaction score
201
So this means you solved your question? :)
If not, I made a map with heroes, and the stat Ability Power, meaning that it increased the damage of some of the abilities :)

The way I did it, was to make a trigger that launched every time that a damage effect was used, and then checked the amount of the Ability Power attribute for the casting unit, and dealt bonus damage relative to that.

I'm not entirely sure if I made the trigger call an integer set when the attribute changed, but if you want me to elaborate, I'll be happy to find the system again :)
 

Nurdguy

New Member
Reaction score
0
I did end up finding an answer a couple hours later while digging through google some more. Thanks :)

I read about the trigger system idea.. it sounds like the simplest way to go but it only works for scaling damage, right? And the damage wouldn't be visible in the tooltip. However, I'd still love to take a look at what you did if you wouldn't mind finding it. :) It'd be nice to see someone else's work and how you set things up.

I'm still flying by the seat of my pants trying to figure all this out, and trying to break my old wc3 habits. Like when I needed to give vision of a diagonal corridor I originally started making invisible units to place in it rather than using the new diamond-shape for regions to give visibility. Glad I got that figured out the unit idea was ugly!
 

X-maul

AKA: Demtrod
Reaction score
201
I'll find it as soon as I get the time. In tooltips you can refer to effects for the player, so what I did, was to have an effect (not used by anything) named it Ability Power and refered to it in tooltips, so my tooltips looked something like the:
Deals 100 (+(0.7*Ability Power)) damage.
What I did, was to set a field in the effect using triggers, to the same as the stat for the hero.

This only works for 1 unit per player though, but as I used it for a hero map with 1 unit per player, it worked for me. I guess it's possible to do for multiple units aswell, but not with this system. :)

I'll find it for you as soon as I get the time :)
 

Nurdguy

New Member
Reaction score
0
Oh cool. Hm. That's a neat way of doing it. I also have just one hero per player. :)
 

X-maul

AKA: Demtrod
Reaction score
201
Sorry for not respondin' - I'll fetch it for ya in a few days - pretty busy sketchual these days, with all those christmas dinners comin' up. I see a hole comin' up thursdag or so, will probably have time to share it with ya :)
 

Nurdguy

New Member
Reaction score
0
Np been busy too. Just finished my spawn triggers thinking of turning it into a library. Trying to find a good community, sc2mapster seems to have the biggest but the forums are hideous and lack so many features. My hero development has kind of stagnated. Been drawing up a design document and planning things but I'm at such a loss when it comes to developing abilities. Anyhow. /end rant
 

X-maul

AKA: Demtrod
Reaction score
201
Sorry for not coming back here. I've been so damn bussy, havent opened my gaming computer for 14 days now. You can hit me up on skype, (check my member info) and I'll give you a helping hand, I'm pretty innovative, and I might be able to help finish hero concepts.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top