#Keep potion effects on death and remove one tier of what you currently have

1 messages · Page 1 of 1 (latest)

solar badger
#

Any console errors when it triggers or is reloaded?

coarse shoal
#

Keep potion effects on death and remove one tier of what you currently have

solar badger
#

It adds the active effects into a list

#

I added a broadcast

#

And it broadcasts everything just fine

coarse shoal
solar badger
#

Well thats because you have not written that code

coarse shoal
#

and it definitely doesn’t remove one tier of an effect as is

solar badger
#

wait im blind

coarse shoal
#

but i don’t know where to start exactly

#

I tried printing the potion effects to see how it formats them but i couldn’t get that to work

solar badger
# coarse shoal I tried printing the potion effects to see how it formats them but i couldn’t ge...
on death:
    loop all active potion effects of victim:
        add loop-value to {_victimEffects::*}
#debug line        broadcast "&d%loop-value%"
    wait 3 seconds
    loop {_victimEffects::*}:
        apply loop-value to victim

    set {_randomEffect} to random element out of {_victimEffects::*}
    remove {_randomEffect} from potion effects of victim
#debug line    if {_randomEffect} is a potion effect:
#debug line        broadcast "&5%{_randomEffect}%"
#

This works as intended

#

Try to stay away from execute console command :)

#

And so you know, if a player respawns after 3 seconds, they will not get the effects back ;)

#

So you could change that to another event

#
on death:
    loop all active potion effects of victim:
        add loop-value to {victimEffects::%victim's uuid%::*}
        broadcast "&d%loop-value%"


on respawn:
    wait 3 seconds
    loop {victimEffects::%player's uuid%::*}:
        apply loop-value to player

    set {_randomEffect} to random element out of {victimEffects::%player's uuid%::*}
    remove {_randomEffect} from potion effects of player
    if {_randomEffect} is a potion effect:
        broadcast "&5%{_randomEffect}%"
    wait 4 ticks
    delete {victimEffects::%player's uuid%::*}

Better version so a player will always get their effects back ;)

coarse shoal
#

i’ll test it in just a sec

#

i was pretty far off 💀

solar badger
#

well no i did not even change that much

#

I just resorted to default skript syntax

#

and I try to not use execute console command

coarse shoal
solar badger
#

Hopefully it works now

coarse shoal
#

checking now

coarse shoal
coarse shoal
#

thanks dude

solar badger
#

Well I know a way, but it's not gonna be fun for me

#

But I'll try

coarse shoal
#

thank you so much'

#

one last thing, is there a way to differentiate player kills form any death?

#

i can't seem to find an event on the docs

rancid magnet
#

check if attacker is a player

solar badger
#

I know how to do it now

coarse shoal
coarse shoal
#

i'm just gonna have to use a ton of if strings ig

rancid magnet
#

you know how. look back at your original code. you are already looping the active effects and storing it in a list, so just do that

#

then you can check the size of the list to see how many and if it's over 0, they have some

coarse shoal
#

hmmm

#

let me try that

coarse shoal
solar badger
#

I am cool now

coarse shoal
#

fr?

#

bro thank you so much

solar badger
#

Like this right?

#

@coarse shoal ^

coarse shoal
#

yes'

#

thank you so much

solar badger
#
on death:
    loop all active potion effects of victim:
        add loop-value to {victimEffects::%victim's uuid%::*}
        #debug line broadcast "&d%loop-value%"


on respawn:
    wait 3 ticks
    loop {victimEffects::%player's uuid%::*}:
        apply loop-value to player

    set {_randomEffect} to random element out of {victimEffects::%player's uuid%::*}
    remove {_randomEffect} from potion effects of player
    if {_randomEffect} is a potion effect:
        set {_list::*} to ("%{_randomEffect}%" parsed as "potion effect of %potion effect type% of tier %number% for %timespan%")
        #debug line broadcast "&c%{_list::*}%"
        if {_list::2} > 0:
            apply potion of {_list::1} of tier ({_list::2} - 1) to player for {_list::3}
            #debug line broadcast "&dfewfwfwef"
    wait 4 ticks
    delete {victimEffects::%player's uuid%::*}
coarse shoal
#

you are an actual life saver

solar badger
#

:)

coarse shoal
# solar badger :)

last thing, how can i make this work? lmao
on death of player: if attacker is player: if victim is player: add 1 to {%attacker%point} loop all active potion effects of victim: add loop-value to {victimEffects::%victim's uuid%::*} if {victimEffects::%victim's uuid%::*} contains nothing: subtract 1 from {%victim%point}

#

this is the last thing until my plugin is done lmao

solar badger
#

first of all, do {%attacker%.points}

coarse shoal
#

well that works

#

already

#

i think it's the way i set the variable up

#

it only works like that

#

it just doesn't remove a point when the value contains nothing

#

no errors