Chance by Hero Level

Status
Not open for further replies.
What happens if the level of the killed unit is greater than the level of the killer unit ?
It will return as < 0 (which returns Real, not Integer).

  • Actions
    • Set StatGainChance = ((Level of (Triggering unit)) / (Hero level of (Killing unit)))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 100) Less than or equal to StatGainChance
      • Then - Actions
        • -------- THIS BLOCK IS SUCCESS BLOCK --------
      • Else - Actions
        • -------- THIS BLOCK IS FAIL BLOCK --------
 
Thanks. I ended up doing this:

  • Stat Gain
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) is A Hero) Equal to True
    • Actions
      • Set StatGainChance = (Real((Random integer number between 0 and (Hero level of (Killing unit)))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StatGainChance Less than or equal to (Real((Level of (Dying unit))))
        • Then - Actions
          • Hero - Modify Strength of (Killing unit): Add 5
          • Hero - Modify Agility of (Killing unit): Add 5
          • Hero - Modify Intelligence of (Killing unit): Add 5
        • Else - Actions
 
You should make the random starts from 1 to n because you will have a zero error calculation.

Let's say you want to random a 10% chance, you would do this;
  • (Random integer number between 1 and 10) Less than or equal to 1
The detail is like this:
1, 2, 3, 4, 5, 6, 7, 8, 9, 10.

The total number would be ? Yes, 10% chance.

But let's say you do this;
  • (Random integer number between 0 and 10) Less than or equal to 1
The detail is like this:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.

The total number would be ? Yes, this is 20% (18% to be exact) chance, and this is zero error I mentioned earlier, it would defect your calculations.
 
Status
Not open for further replies.
Back
Top