Solved Fixing Effect Chance?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

JustADev

Well-Known Member
Apr 8, 2017
379
9
18
BUG: The chance for Poison almost always happens, Even though its at 5% Chance,

CODE:

code_language.skript:
on damage:
        if {Poison::%attacker%} is more than 0:
                set {_Poisona} to 0.2 * {Poison::%attacker%}
                add 2 to {_Poisona}
                chance of 5%
        if {Poison_cooldown::%victim%} is not set:
                apply potion of poison 2 to victim for "%{_Poisona}% seconds" parsed as a timespan
                set {Poison_cooldown::%victim%} to now
        if difference between {Poison_cooldown::%victim%} and now is greater than 10 seconds:
                apply potion of poison 2 to victim for "%{_Poisona}% seconds" parsed as a timespan
                set {Poison_cooldown::%victim%} to now
 
you could try using a different expression maybe. I haven't noticed any trouble with this way:
code_language.skript:
set {_test} to a random integer between 1 and 100
if {_test} is between 1 and 5:
    apply potion of poison 2 to victim for 5 seconds
 
Eh but the thing is, I am doing a lvling system where you upgrade perks, so that wouldnt really work
 
BUG: The chance for Poison almost always happens, Even though its at 5% Chance,

CODE:

code_language.skript:
on damage:
        if {Poison::%attacker%} is more than 0:
                set {_Poisona} to 0.2 * {Poison::%attacker%}
                add 2 to {_Poisona}
                chance of 5%
        if {Poison_cooldown::%victim%} is not set:
                apply potion of poison 2 to victim for "%{_Poisona}% seconds" parsed as a timespan
                set {Poison_cooldown::%victim%} to now
        if difference between {Poison_cooldown::%victim%} and now is greater than 10 seconds:
                apply potion of poison 2 to victim for "%{_Poisona}% seconds" parsed as a timespan
                set {Poison_cooldown::%victim%} to now
Your using it wrong, just putting it at the end doesn't magically make it work

@Wynnevir
code_language.skript:
if random integer from 1 to 100 is between 1 and 5
 
OMG You are an angel among many! TYSM, IDK what I would do without you people :emoji_grinning: tysm again
 
Do I need to move Chance of 5: up further?
code_language.skript:
        if {Poison::%attacker%} is more than 0:
                set {_Poisona} to 0.2 * {Poison::%attacker%}
                add 2 to {_Poisona}
                chance of 5%:
        if {Poison_cooldown::%victim%} is not set:
                apply potion of poison 2 to victim for "%{_Poisona}% seconds" parsed as a timespan
                set {Poison_cooldown::%victim%} to now
        if difference between {Poison_cooldown::%victim%} and now is greater than 10 seconds:
                apply potion of poison 2 to victim for "%{_Poisona}% seconds" parsed as a timespan
                set {Poison_cooldown::%victim%} to now

It still occurs frequently, but a lot less than b4
 
Do I need to move Chance of 5: up further?
code_language.skript:
        if {Poison::%attacker%} is more than 0:
                set {_Poisona} to 0.2 * {Poison::%attacker%}
                add 2 to {_Poisona}
                chance of 5%:
        if {Poison_cooldown::%victim%} is not set:
                apply potion of poison 2 to victim for "%{_Poisona}% seconds" parsed as a timespan
                set {Poison_cooldown::%victim%} to now
        if difference between {Poison_cooldown::%victim%} and now is greater than 10 seconds:
                apply potion of poison 2 to victim for "%{_Poisona}% seconds" parsed as a timespan
                set {Poison_cooldown::%victim%} to now

It still occurs frequently, but a lot less than b4
Yes, it needs to go before everything you want it to do just like an "if" statement. and the effects after it pertaining to it gets tabbed once
 
I'm assuming it should only apply to your 1 if statement there above it so like this:
code_language.skript:
chance of 5%:
    if {Poison::%attacker%} is more than 0:
        set {_Poisona} to 0.2 * {Poison::%attacker%}
        add 2 to {_Poisona}
[doublepost=1501372528,1501372446][/doublepost]or this way if you want it to check that variable first
code_language.skript:
if {Poison::%attacker%} is more than 0:
    chance of 5%:
        set {_Poisona} to 0.2 * {Poison::%attacker%}
        add 2 to {_Poisona}
 
Status
Not open for further replies.