#Keep potion effects on death and remove one tier of what you currently have
1 messages · Page 1 of 1 (latest)
Not at all
Keep potion effects on death and remove one tier of what you currently have
Seems like your code is working just as it was intended/written
It adds the active effects into a list
I added a broadcast
And it broadcasts everything just fine
well when i die on my server i don’t get any effects back
Well thats because you have not written that code
and it definitely doesn’t remove one tier of an effect as is
wait im blind
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
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 ;)
you are a life saver
i’ll test it in just a sec
i was pretty far off 💀
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
lmao i was trying it other ways but it didn’t seem to be working the best
Hopefully it works now
checking now
it works but is there a way to make it remove one tier of the potion or is this the best it gets?
I can try
thanks dude
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
check if attacker is a player
thanks man
yeah i figured that out but now i can't figure out how to check if the victim has any potion effects at all
i'm just gonna have to use a ton of if strings ig
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
what is the syntax for checking size of a string?
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%::*}
you are an actual life saver
:)
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
first of all, do {%attacker%.points}