Taru-ReflectionAuraEffectEventsUnit-AnyUnittakesFatalorNon-FatalAnydamage(fromAnyeffects)LocalVariablesDamageAmount=0.0<Real>Conditions((Triggeringunit)hasTaru-ReflectionAura(Buff))==TrueActionsVariable-SetDamageAmount=(Triggeringdamageamount)General-If(Conditions)thendo(Actions)elsedo(Actions)IfReflectionAuraLevel[1] == True
Then
Variable - Set Damage Amount = (Damage Amount * 0.11)
UI - Display (Text(Damage Amount) with Any Precision decimal places) for (All players) to Subtitle area
Environment - Deal damage using Taru - Reflection Aura (Damage) on (Damaging unit) from (Triggering unit) with Damage Amount extra damage
Else
It's not returning 11% it's returning 2 or 3.
Why is this "Variable - Set Damage Amount = (Damage Amount * 0.11)" not setting it to 11%?
Also, display damage amount right when trigger fires, then before it gets into variable, then display variables value. Basically make make game send you info about needed data at every step, that way you might get an idea of where things went wrong.
And really, for all we know you're damaging unit with 25 damage effect and then complaining that game returns 2 as 11% of it. (Other than optimization suggested by Neonsz it looks perfectly fine)
Taru-ReflectionAuraEffectEventsUnit-AnyUnittakesFatalorNon-FatalAnydamage(fromAnyeffects)LocalVariablesDamageAmount=0.0<Real>Conditions((Triggeringunit)hasTaru-ReflectionAura(Buff))==TrueActionsVariable-SetDamageAmount=(Triggeringdamageamount)General-If(Conditions)thendo(Actions)elsedo(Actions)IfReflectionAuraLevel[1] == True
Then
Variable - Set Damage Amount = (Damage Amount * 0.11)
Environment - Deal damage using Taru - Reflection Aura (Damage) on (Damaging unit) from (Triggering unit) with Damage Amount extra damage
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Reflection Aura Level[2] == True
Then
Variable - Set Damage Amount = (Damage Amount * 0.12)
Environment - Deal damage using Taru - Reflection Aura (Damage) on (Damaging unit) from (Triggering unit) with Damage Amount extra damage
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Reflection Aura Level[3] == True
Then
Variable - Set Damage Amount = (Damage Amount * 0.13)
Environment - Deal damage using Taru - Reflection Aura (Damage) on (Damaging unit) from (Triggering unit) with Damage Amount extra damage
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Reflection Aura Level[4] == True
Then
Variable - Set Damage Amount = (Damage Amount * 0.14)
Environment - Deal damage using Taru - Reflection Aura (Damage) on (Damaging unit) from (Triggering unit) with Damage Amount extra damage
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
Reflection Aura Level[5] == True
Then
Variable - Set Damage Amount = (Damage Amount * 0.15)
Environment - Deal damage using Taru - Reflection Aura (Damage) on (Damaging unit) from (Triggering unit) with Damage Amount extra damage
Else
This is causing the map to break. It's overloading the game engine by firing so many instances of this I'm assuming. How can this be fixed?
First you could/should use 'switch' or make it if then elseif unless you want possibility of having multiple auras at same time reflecting more than once per damage.
condition fix is 2in1 it will prevent any possible loop errors you made and it will make sure auras won't bounce from each other between 2 units having aura
side notes, you could probably create behavior for this to make it data based, also you could do something like this (pseudo code)
variables i,n integers
for each integer i from 1 to 5
if Reflection Aura Level[i] == true
set variable n = i
Break (optional)
endif
Set Damage Amount = (Triggering Damage Amount * (0.1+(IntegerToReal(n)*0.01)))
deal damage
5 lines instead of 36. It makes difference in bigger projects when you want to save triggers/code size. Also it looks so neat! ;)
You display the text, before you actually set the variable, so the text always displays 0
Quote:
Is that setup right?
If your Reflection Aura Level variable always holds the current level of your aura (and you swap the set variable and display text) yes, it looks about right,
Quote:
I don't see how u can tell the level from this?
Previously, you had your level saved in an array of booleans. So, whenever the level changed, you did set the according boolean to true (and probably the others to false), correct?
Now you just save your current level as a number, you don't save "aura level 2 active = true" but instead you save "aura level = 2". Sounds logical?
The damage formula is based on the progression of your specific values of return damage percentage. You want to return 11% damage for the first level of the aura, 12% for the second leve, 13% for the 3rd one etc. Correct? So you would have 10% return damage for a "level 0" aura, and each level adds 1% to the damage. You can put that together in a simple formula like I did:
damage factor = 10% + lvl * 1%
Just replace "lvl" with the current level, and you will see, that this formula results in the exact same values you specified; setting lvl to 1 results in 10% + 1% = 11%, for 2 it is 12% and so on.
Quote:
I would prefer not to use a variable if I don't have too.
In this case, you can just replace the variable in the damage function with the entire calculation, like this:
But as you can see, it becomes really messy and lengthy. If you want it that way, very well, but I wouldn't recommend it. It is also a pain in the ass to modify, if you want to change something. Its your call.
Quote:
Also what do you mean by exclude the damage effect from being returned?
The same thing Nerfpl already included in his trigger. Modify your conditions like this:
Unit-AnyUnittakesFatalorNon-FatalAnydamage(fromAnyeffects)LocalVariablesDamageAmount=0.0<Real>x=0<Integer>n=0<Integer>Conditions(Damagingeffect)!=Taru-ReflectionAura(Damage)((Triggeringunit)hasTaru-ReflectionAura(Buff))==TrueActionsGeneral-Foreachintegerxfrom1to5withincrement1,do(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfReflectionAuraLevel[x] == True
Then
Variable - Set n = x
Else
Variable - Set Damage Amount = (Damage Amount * (0.1 + ((Real(n)) * 0.01)))
UI - Display (Text(Damage Amount) with Any Precision decimal places) for (All players) to Subtitle area
Environment - Deal damage using Taru - Reflection Aura (Damage) on (Damaging unit) from (Triggering unit) with Damage Amount extra damage
Returns 0. Also Kueken that didn't work that way cause I think the level store variable in map doesn't call to that.
And I don't store the levels. I do stuff like this:
Then where does your Reflection Aura Level[x] come from? o_0
And why would you use a switch, which checks for the level and then do the exact same action for every case? Or are these different upgrades (in which case I would still prefer an array with the ability level as index)?
It's not returning 11% it's returning 2 or 3.
Why is this "Variable - Set Damage Amount = (Damage Amount * 0.11)" not setting it to 11%?
@Zero0018: Go
Maybe delete the first set variable action and use triggering damage amount instead of (damage amount * 0.11)?
Seems more logical to me, maybe it'll work.
EDIT: 2 or 3 as in 200% or 300% or as in 2 or 3 damage?
Yeah, need more info.
Also, display damage amount right when trigger fires, then before it gets into variable, then display variables value. Basically make make game send you info about needed data at every step, that way you might get an idea of where things went wrong.
And really, for all we know you're damaging unit with 25 damage effect and then complaining that game returns 2 as 11% of it. (Other than optimization suggested by Neonsz it looks perfectly fine)
I'm retarded. Got it working. Thanks
Ok:
This is causing the map to break. It's overloading the game engine by firing so many instances of this I'm assuming. How can this be fixed?
First you could/should use 'switch' or make it if then elseif unless you want possibility of having multiple auras at same time reflecting more than once per damage.
Second you should change
into:
condition fix is 2in1 it will prevent any possible loop errors you made and it will make sure auras won't bounce from each other between 2 units having aura
side notes, you could probably create behavior for this to make it data based, also you could do something like this (pseudo code)
variables i,n integers
5 lines instead of 36. It makes difference in bigger projects when you want to save triggers/code size. Also it looks so neat! ;)
Your construct seems weird to me. Why do you use an array of booleans for the levels? Why not simply one integer variable holding the level?
This would make your damage return way simpler, you could shorten the actions to:
Same effect in 2 lines. Could do it in one, if you want, but I prefer an additional variable for clarity.
Also, this causes an infinite loop, if 2 units with the aura attack each other. You should exclude the damage effect you use from being returned.
€ I was ninja-edited :(
If you absolutely need the boolean array for some reason, use Nerfpl's trigger.
@Kueken531: Go
This returns 0 damage. Is that setup right? I would prefer not to use a variable if I don't have too. I don't see how u can tell the level from this?
Also what do you mean by exclude the damage effect from being returned?
You display the text, before you actually set the variable, so the text always displays 0
If your Reflection Aura Level variable always holds the current level of your aura (and you swap the set variable and display text) yes, it looks about right,
Previously, you had your level saved in an array of booleans. So, whenever the level changed, you did set the according boolean to true (and probably the others to false), correct?
Now you just save your current level as a number, you don't save "aura level 2 active = true" but instead you save "aura level = 2". Sounds logical?
The damage formula is based on the progression of your specific values of return damage percentage. You want to return 11% damage for the first level of the aura, 12% for the second leve, 13% for the 3rd one etc. Correct? So you would have 10% return damage for a "level 0" aura, and each level adds 1% to the damage. You can put that together in a simple formula like I did:
damage factor = 10% + lvl * 1%
Just replace "lvl" with the current level, and you will see, that this formula results in the exact same values you specified; setting lvl to 1 results in 10% + 1% = 11%, for 2 it is 12% and so on.
In this case, you can just replace the variable in the damage function with the entire calculation, like this:
But as you can see, it becomes really messy and lengthy. If you want it that way, very well, but I wouldn't recommend it. It is also a pain in the ass to modify, if you want to change something. Its your call.
The same thing Nerfpl already included in his trigger. Modify your conditions like this:
otherwise the game will crash, if 2 units with the aura buff attack each other.
@Nerfpl: Go
Returns 0. Also Kueken that didn't work that way cause I think the level store variable in map doesn't call to that.
Replace the 2nd damage amount with Triggering Damage Amount.
Where and how exactly do you store your level? It cannot be that hard to get it as an integer.
@Kueken531: Go
Got it working thanks. And I don't store the levels. I do stuff like this:
Then where does your Reflection Aura Level[x] come from? o_0
And why would you use a switch, which checks for the level and then do the exact same action for every case? Or are these different upgrades (in which case I would still prefer an array with the ability level as index)?
@Kueken531: Go
Oh. I used this for her:
THey are the same upgrade. IDK it just works and how I learned how 2 do it lol
oops xD