Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Apply Trait Bonuses

Events

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Level of Trait: Ranger for TempUnit) Greater than or equal to 1




(Number of units in TraitGroup_Ranger[TempInt]) Greater than or equal to 3



Then - Actions




Unit - Add Ranger Bonus (atk spd) to TempUnit




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Number of units in TraitGroup_Ranger[TempInt]) Less than 15





Then - Actions






Unit - Set level of Trait: Ranger for TempUnit to (1 + ((Number of units in TraitGroup_Ranger[TempInt]) / 3))






Unit - Set level of Ranger Bonus (atk spd) for TempUnit to ((Number of units in TraitGroup_Ranger[TempInt]) / 3)






Unit - Set Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: ((Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m') at Index:1) x (1.00 + (0.10 x (Real(((Number of units in TraitGroup_Ranger[TempInt]) / 3))))))





Else - Actions






Unit - Set level of Trait: Ranger for TempUnit to 6






Unit - Set level of Ranger Bonus (atk spd) for TempUnit to 5






Unit - Set Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: ((Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m') at Index:1) x 1.50)




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m') at Index:1) Greater than (Current acquisition range of TempUnit)





Then - Actions






Unit - Set Unit: TempUnit's Real Field: Acquisition Range ('uacq') to Value: (Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m') at Index:1)





Else - Actions



Else - Actions
Apply Trait Bonuses

Events

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Level of Trait: Ranger for TempUnit) Greater than or equal to 1




(Number of units in TraitGroup_Ranger[TempInt]) Greater than or equal to 3



Then - Actions




Unit - Add Ranger Bonus (atk spd) to TempUnit




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Number of units in TraitGroup_Ranger[TempInt]) Less than 15





Then - Actions






Unit - Set level of Trait: Ranger for TempUnit to (1 + ((Number of units in TraitGroup_Ranger[TempInt]) / 3))






Unit - Set level of Ranger Bonus (atk spd) for TempUnit to ((Number of units in TraitGroup_Ranger[TempInt]) / 3)






Set VariableSet TempReal = ((Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m') at Index:0) x (1.00 + (Real(((Number of units in TraitGroup_Ranger[TempInt]) / 3)))))






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








TempReal Greater than (Current acquisition range of TempUnit)







Then - Actions








Unit - Set Unit: TempUnit's Real Field: Acquisition Range ('uacq') to Value: TempReal







Else - Actions






Unit - Set Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m')at Index:0 to Value: TempReal





Else - Actions






Unit - Set level of Trait: Ranger for TempUnit to 6






Unit - Set level of Ranger Bonus (atk spd) for TempUnit to 5






Set VariableSet TempReal = ((Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m') at Index:0) x 1.50)






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








TempReal Greater than (Current acquisition range of TempUnit)







Then - Actions








Unit - Set Unit: TempUnit's Real Field: Acquisition Range ('uacq') to Value: TempReal







Else - Actions






Unit - Set Unit: TempUnit's Weapon Real Field: Attack Range ('ua1m')at Index:0 to Value: TempReal



Else - Actions
call SetUnitAcquireRange(unit, 2000)
call BlzSetUnitWeaponRealField(unit, UNIT_WEAPON_RF_ATTACK_RANGE, 0, 2000)
call BlzSetUnitWeaponRealField(unit, UNIT_WEAPON_RF_ATTACK_RANGE, 1, 2000)
They are receiving the attack speed buff so I believe it is all working?
What would the custom script need to be? with the unit being TempUnit and the new range being TempReal?
Custom script: call SetUnitAcquireRange(udg_TempUnit, 2000)
Custom script: call BlzSetUnitWeaponRealField(udg_TempUnit, UNIT_WEAPON_RF_ATTACK_RANGE, 0, udg_TempReal)
Custom script: call BlzSetUnitWeaponRealField(udg_TempUnit, UNIT_WEAPON_RF_ATTACK_RANGE, 1, udg_TempReal)
You're welcome.It works! Thank you very much!!
You can try to set it's attack range to 0 or something before applying TempReal.OK no it doesn't quite work, TempReal is being calculated correctly but the ranges are being added together rather than replaced?
Example - unit with 500 range should be getting 10% bonus, 550 is being calculated (shown with test text) but the unit ends up with 1050 range? (500 + 550)
Any ideas?
I don't think there is a function. But you can always use a Variable/Hashtable to store this information if you can't get away with typing the exact value yourself.The fix I have done is that TempReal calculates the bonus not the total, this seems to have worked
As it's a round based game with duplicate units involved this shouldn't be recalculated at any time, but could be worth looking into anyway...what function would pick up the base attack range?
And yes you are correct I should definitely make a tempary count variable!
No problem. Do the TempUnit's have different attack ranges or something? What's stopping you from just doing this:Ahh no worries I will go with how it is for now, may have to revisit if it doesn't work further down the line.
Thanks for all your help though![]()
Set VariableSet TempReal = 500.00 x (1.00 + (Real(((Number of units in TraitGroup_Ranger[TempInt]) / 3)))))
No idea, Blizzard released these functions in 1.31 and then never touched them since. A lot are buggy/unfinished.@Uncle
So for some reason this doesn't work on a unit with 800 range? It is setting them to have melee range? Any ideas?
I have tried deleting the line where it adjusts the aquisition range and that wasn't the problem... all the other units still work just this one!
