• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Permanent Stat Boost (in Decimal) for every unit killed?

Status
Not open for further replies.
Level 5
Joined
Mar 18, 2023
Messages
52
Hi. I'm a new scrub to world editor. I was creating a passive to give 0.1 all stats (perma) for every unit killed by 1 of my hero. The trigger itself works but not in decimals. I did some research and found that the world editor always round up or down for stats so I'm not sure how to fix this. I know some maps I've played had a decimal boost to stats. At least, that's how it seemed from the player perspective. An alternative, if someone can do this for me, is make it that every 10 units killed gives 1 to all stats. I'd be fine with that too. Thanks ahead of time!

Adaptability Copy
Events
Unit - A unit Dies
Conditions
Actions
Set VariableSet BobUnit = (Killing unit)
Set VariableSet AdaptKills = (Dying unit)
-------- STR --------
Set VariableSet AdaptCurrent[1] = (Strength of BobUnit (Exclude bonuses))
Set VariableSet AdaptGain[1] = ((Real(AdaptCurrent[1])) + 0.10)
Set VariableSet AdaptFinal[1] = (Integer(AdaptGain[1]))
-------- AGI --------
Set VariableSet AdaptCurrent[2] = (Agility of BobUnit (Exclude bonuses))
Set VariableSet AdaptGain[2] = ((Real(AdaptCurrent[2])) + 0.10)
Set VariableSet AdaptFinal[2] = (Integer(AdaptGain[2]))
-------- INT --------
Set VariableSet AdaptCurrent[3] = (Intelligence of BobUnit (Exclude bonuses))
Set VariableSet AdaptGain[3] = ((Real(AdaptCurrent[3])) + 0.10)
Set VariableSet AdaptFinal[3] = (Integer(AdaptGain[3]))
-------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of BobUnit) Equal to Chad (Bob)
(AdaptKills is A structure) Equal to False
Then - Actions
Hero - Modify Strength of BobUnit: Add (AdaptFinal[1] - AdaptCurrent[1]).
Hero - Modify Agility of BobUnit: Add (AdaptFinal[2] - AdaptCurrent[2]).
Hero - Modify Intelligence of BobUnit: Add (AdaptFinal[3] - AdaptCurrent[3]).
Else - Actions
 
Level 24
Joined
Feb 27, 2019
Messages
833
Hero stats are integers so you cant increase them by a decimal real value, as you say it would only round the value. The solution is exactly as you say to only add a stat after 10 kills.

If there can only be one of these units on the map then the trigger will work fine.

Set AdaptGain = AdaptGain + 1
If AdaptGain equal to 10 then
Hero - Modify Strength of BobUnit: Add 1.
Hero - Modify Agility of BobUnit: Add 1.
Hero - Modify Intelligence of BobUnit: Add 1.
Set AdaptGain = 0
endif
  • (Unit-type of BobUnit) Equal to Chad (Bob)
  • (AdaptKills is A structure) Equal to False
Since you are only increasing stats under these cirumstances you should add them to the triggers conditions instead of having a seperate if then else statement at the bottom of the trigger, if you want to use if then else then at least add it at the top and include all the relevant actions. You may want to add to the condition that the triggering unit has to be an enemy of the killing unit too and also not an illusion.
 
Level 5
Joined
Mar 18, 2023
Messages
52
Hero stats are integers so you cant increase them by a decimal real value, as you say it would only round the value. The solution is exactly as you say to only add a stat after 10 kills.

If there can only be one of these units on the map then the trigger will work fine.

Set AdaptGain = AdaptGain + 1
If AdaptGain equal to 10 then
Hero - Modify Strength of BobUnit: Add 1.
Hero - Modify Agility of BobUnit: Add 1.
Hero - Modify Intelligence of BobUnit: Add 1.
Set AdaptGain = 0
endif
  • (Unit-type of BobUnit) Equal to Chad (Bob)
  • (AdaptKills is A structure) Equal to False
Since you are only increasing stats under these cirumstances you should add them to the triggers conditions instead of having a seperate if then else statement at the bottom of the trigger, if you want to use if then else then at least add it at the top and include all the relevant actions. You may want to add to the condition that the triggering unit has to be an enemy of the killing unit too and also not an illusion.
Big thanks. It works and having no problems so far. Appreciate the solution!
 
Status
Not open for further replies.
Top