I am pretty new to map making and with the help of this site and some other tutorials I am starting to become familiar with the trigger system, but I have run into one problem I can't seem to figure out although it is pretty simple...
In my map, the hero I am currently working on has an attack that just modifies the damage of his next attack, which is obviously pretty simple. The problem is I finally go an equation that will modify his damage just the right amount depending on his level but it uses a square route, and as far as I know you can't use square routes in triggers...
So my question is:
Is there any way to use square routes when calculating attack damage? If so then how? Note that I am not too familiar with custom scripts so if that is the answer an example script and an explanation would be very much appreciated.
In case anyone is wondering, this is the equation I want to use:
Modified Damage = Hero Level + (sqrt(Base Weapon Damage * 2)
Thanks in advance for any feedback and/or solutions!
You can use a square root just fine, but it's return type is Real, so you'll need to use Convert Real to Integer if you want to typecast it. As far as I'm aware, you can't modify the damage like that in the data editor, so you'll have to use a trigger.
You can use the trigger to modify the data, though.
The damage is dealt by an effect which simply deals X amount of damage. You can't add calcuations like square roots in there.
But you can set the damage dealt by this effect by using the trigger editor - and in triggers you can use square root.
So you can calculate it in the trigger editor, then change the values in the data editor accordingly.
Thanks for the reply, but actually I already saw that tutorial! Lol :p. It was very helpful, that is actually what I am using to modify the attack damage of my Backstab type ability.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello all,
I am pretty new to map making and with the help of this site and some other tutorials I am starting to become familiar with the trigger system, but I have run into one problem I can't seem to figure out although it is pretty simple...
In my map, the hero I am currently working on has an attack that just modifies the damage of his next attack, which is obviously pretty simple. The problem is I finally go an equation that will modify his damage just the right amount depending on his level but it uses a square route, and as far as I know you can't use square routes in triggers...
So my question is: Is there any way to use square routes when calculating attack damage? If so then how? Note that I am not too familiar with custom scripts so if that is the answer an example script and an explanation would be very much appreciated.
In case anyone is wondering, this is the equation I want to use: Modified Damage = Hero Level + (sqrt(Base Weapon Damage * 2)
Thanks in advance for any feedback and/or solutions!
You can use a square root just fine, but it's return type is Real, so you'll need to use Convert Real to Integer if you want to typecast it. As far as I'm aware, you can't modify the damage like that in the data editor, so you'll have to use a trigger.
@Unabsurdity: Go
Oh ok... Thank you. Like I said I am still new to making maps and all that so I didn't know this. Thanks for the info.
You can use the trigger to modify the data, though.
The damage is dealt by an effect which simply deals X amount of damage. You can't add calcuations like square roots in there.
But you can set the damage dealt by this effect by using the trigger editor - and in triggers you can use square root.
So you can calculate it in the trigger editor, then change the values in the data editor accordingly.
See this tutorial: http://forums.sc2mapster.com/development/tutorials/1250-triggers-catalog-field-value-get-set/
With the action (Set Catalog something) you can access and change the effect's damage. This tutorial teaches the use of this action. Depending on how new you are this might be a bit confusing. If so, just make yourself audible.
@s3rius: Go
Thanks for the reply, but actually I already saw that tutorial! Lol :p. It was very helpful, that is actually what I am using to modify the attack damage of my Backstab type ability.