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
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