[Trigger] how would I increase an integer slower the bigger it is.

Status
Not open for further replies.
Level 6
Joined
Jan 8, 2009
Messages
142
When an integer is at 1 I want to add one to it, but if it's say 50 i want it to have a lower chance of adding one to it, if it's like 300 the chance of adding one is significantly lower. It's for a sort of skill level increment, i'm sure there's a shorter mathematical way to do this without using a bunch of ifs but i can't see it. thanks
 
So you want the chance to increment decrease as the original value increase?
Then do something like this:
chance = 1/origValue.
at origValue = 1 then there is a 100% chance to increment since 1/1 = 1.
at origValue = 20, rhen chance = 0.05 or 5% to increment. If you want to control the rate, you can use something lie:
chance = (1/origValue)^ctrl. lets say ctrl = 0.3, then at
origValue = 20, chance = 0.47 or 47%.
 
So you want the chance to increment decrease as the original value increase?
Then do something like this:
chance = 1/origValue.
at origValue = 1 then there is a 100% chance to increment since 1/1 = 1.
at origValue = 20, rhen chance = 0.05 or 5% to increment. If you want to control the rate, you can use something lie:
chance = (1/origValue)^ctrl. lets say ctrl = 0.3, then at
origValue = 20, chance = 0.47 or 47%.

This is great, thanks.

  • Slow Inc
    • Events
    • Conditions
    • Actions
      • If (Multiple Conditions)
        • If - Conditions
          • (Random Integer between 0 and YourInteger Equal to 0 then
        • Then - Actions
          • Set YourInteger = (YourInteger + 1)
        • Else - Actions

this would also work great but if I understand it correctly the chance would always be 1/int? I was looking for something with a little more flexibility. thanks though.
 
You didn't really specify how flexible you want it to be. I can show you how to adapt that if you let me know how you want it to scale.

would it be possible to adjust the scale based on the maximum attainable level, somehow input that value into it? i'd like to scale it so that initially it's 100% success but say by 10% of max level it's at 90% success, at 25% max it's at 70% by 50% max it's at 40%, by 75% max it's at 10%, by 95% max it's at 5% or so.

I'm not sure how well i've worded that but i'm trying to get it so that each level is progressively harder to get to. i'm trying to make it not as much of a linear scale with the top end being quite fast and the bottom end taking a lot longer, in theory, to progress.
 
That scaling is pretty uneven. You'll either need formulaic scaling or set each scale threshold to an array value, like this:

  • Test
    • Events
    • Conditions
    • Actions
      • Set Array[0] = 0
      • Set Array[1] = 0
      • Set Array[2] = 10
      • ...
      • Set Array[5] = 30
      • ...
      • Set Array[10] = 40
      • ...
      • Set Array[15] = 90
      • ...
      • Set Array[19] = 95
      • Set Chance = Array[(SkillLevelPercent / 5)]
      • If (Multiple Conditions)
        • If - Conditions
          • (Random Integer between 1 and MaxSkillLevel Greater than Chance)
        • Then - Actions
          • Set YourVar = (YourVar + 1)
Every "..." I left in here you'd have to fill out with the missing numbers and the chance that you want them to represent
 
That scaling is pretty uneven. You'll either need formulaic scaling or set each scale threshold to an array value,

i want formulaic scaling, it was just a poor example on my part. i want the number to increase more often at lower levels and less often at higher levels
 
I dont really know the exact behavior of your spell but I would do it something like this:

Set Random = Random integer between (0) and (100)
Set Chance = 100 - (100 x (YourVar / MaxSkillLevel))
If Chance is greater than or equal to Random
Then Set YourVar = YourVar +1

This will decrease the chance by 1% for each 1% of already gained level.
 
You can also make it non-random by using a real instead of an integer. When requesting the value you take an integer view of the real, discarding the fractional component. When advancing the real you add some fractional part based on the current value of the real (or an integer view there of). The result is always the perfect average of a random approach (since the fractional part added is the probability).

The advantage of this is that it is not random so people cannot be subjected to the madness luck causes.
 
In which case:

Then Set YourVar = YourVar + (1 - (YourVar / MaxSkillLevel))
This will increase your value by 1 -> 0.99 -> 0.98 -> 0.97 etc if you have 100 levels.
This will result in a total of 51 as a maximum.
Be aware that when yourvar becomes greater than maxlevel then you will be decreasing yourvar.
however this wont be a big problem because then yourvar would be lower than maxlevel again :D
 
Status
Not open for further replies.
Back
Top