Solved Little math problem :}

Discussion in 'Plugin Development' started by Digi, Apr 20, 2013.

Thread Status:
Not open for further replies.
  1. I'm making duration for potion effects, the problem is certain effects have a duration modifier which is handled after you input the duration.
    potion effects with duration modifier list (open)
    Code:
     ID    Name                     Instant ?  Duration modifier
     1     SPEED                    false      1.000000
     2     SLOW                     false      0.500000
     3     FAST_DIGGING             false      1.500000
     4     SLOW_DIGGING             false      0.500000
     5     INCREASE_DAMAGE          false      1.000000
     6     HEAL                     true       1.000000
     7     HARM                     true       0.500000
     8     JUMP                     false      1.000000
     9     CONFUSION                false      0.250000
     10    REGENERATION             false      0.250000
     11    DAMAGE_RESISTANCE        false      1.000000
     12    FIRE_RESISTANCE          false      1.000000
     13    WATER_BREATHING          false      1.000000
     14    INVISIBILITY             false      1.000000
     15    BLINDNESS                false      0.250000
     16    NIGHT_VISION             false      1.000000
     17    HUNGER                   false      0.500000
     18    WEAKNESS                 false      0.500000
     19    POISON                   false      0.250000
     20    WITHER                   false      0.250000

    Which means that 40 ticks for SPEED effect is 2 seconds but 40 ticks for HARM is 1 second... and 40 ticks for FAST_DIGGING is 3 seconds.

    How could I compensate for that so I always get the same duration regardless of type ?

    EDIT: Pfff 'duh! I really need to get some sleep... the answer was ticks divided by multiplier.
     
Thread Status:
Not open for further replies.

Share This Page