| 09-20-2006, 03:20 AM | #1 |
I'm good at math, but this kind of confused me. If I put a negative value in like "Movement Speed Reduction", would it end up adding it instead? So like instead of lowering speed by 25, if I put in -25, would it increase it by 25? (confusing isn't it?) |
| 09-20-2006, 03:27 AM | #2 |
Yea. Although, gotta be careful on some abilities where things are labeled wrong/weirdly lol. |
| 09-20-2006, 09:34 AM | #3 |
Movement Speed Reduction lowers movement by whatever you put in it's field, let's say 25. If you put in -25, it removes -25. - and - is +. That why it adds 25 when you put -25 in a reduction field. Is this right or have I missed something? |
| 09-20-2006, 10:57 AM | #4 |
Thats what I thought. Makes enough sense to me! |
| 09-20-2006, 12:28 PM | #5 |
Testing would remove any doubt. |
| 09-23-2006, 04:00 AM | #6 |
That is correct. Usually this can be best seen in the configuration functions done for our spells. I'll give you an example. We have in our spell a region where you heal units (doesn't matter how: hit by spirals, buff spell or life drain). The code will probably look something like one of the two possibilities: JASS:call SetWidgetLife(target, GetWidgetLife(target)+ amount*config_FUNC()) call SetWidgetLife(u, GetWidgetLife(u)+config_FUNC()) Obviously we have our configuration function which, since it is healing, we will give a positive value, let it be percentage or amount. Now, let's study the value "added" to widget's life. amount*config_FUNC() - well, we have a product. So it will be positive only if both amount & value of confing_FUNC have the same sign. If you have a negative percentage for a negative amount, perhaps unlogically for this situation it will actually ADD life to the unit. In order to achieve a negative value (so actually substract life, a.k.a damage) you need to make either the amount or the config_FUNC negative. usually configuration function is prefered. Now second usually occurs more often. It's obvious that we simply add the value. But adding a negative value will mean substracting it. Conclusion, for a positive value it deals damage for a negative value it takes damage. If the spell normally was supposed to damage target, native code of the spell might've either actually damaged the target or substracted life. I believe first because of the bounty stuff, but nevertheless here are both situations: JASS:call UnitDamageTarget(caster, target, ..., config_Damage_Amount(),..] call SetWidgetLife(target, GetWidgetLife(target)-amount Dealing negative damage will result in actually healing the unit. If you substract a negative amount, you actually add it. Conclusion, yes, in most cases polarization of the value in GUI will normally mean switching reducing with increasing, damaging with healing and so on. Do not try this for durations though!!! I never tried a negative duration but I have a hunch that it will crash or last forever. ~Daelin |
| 09-23-2006, 11:27 AM | #7 |
Wow Daelin that was like 10 steps farther then I expected it to be taken... I was wondering about Negative reduction (subtracting a negative) not in triggers, but just in the object editor... But still thanks, that was good reading, it will come in handy sometime. |
