Adrenaline Shot thing

  • 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 comminuty!

    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!

SoulCeption

Member
Jun 18, 2024
1
0
1
23
I'm trying to make a potion where you drink it, it makes it so you are immune to damage for 30 seconds, but once the time ends, you get damaged with all of the damage you would of taken.
 
Code:
on drink:
  if player's held item is (#choose item):
    set {adrenilenshot%player%} to true
    set {adrenilin.player} to player
    wait 30 seconds
    set {adrenilenshot%player%} to false
    delete {adrenilin.player}

on damage:
  if victim is {adrenilin.player}:
    cancel event
 
if victim can compare to a variable use %{adrenilin.player}% instead
 
Code:
on drink:
  if player's held item is (#choose item):
    set {adrenilenshot%player%} to true
    set {adrenilin.player} to player
    wait 30 seconds
    set {adrenilenshot%player%} to false
    delete {adrenilin.player}

on damage:
  if victim is {adrenilin.player}:
    cancel event
ok several issues here

global vars
can only have 1 player at once
mfing wait 30 seconds
not storing the damage
no lists
 
i do loop all players, but i thnink is better with loop {adrenalinshot::*} but i'm not very sure how to work with this type of variables
Code:
options:
    time: 5  #The time after which the player will receive damage.

on drink:
#    broadcast event-item # to take the item, now is set to a potion of regeneration 2 of 22 seconds named "-Potion Name"
    if event-item is potion of strong regeneration named "-Potion Name":
        set {adrenalinshot::%player's uuid%::time} to now

on damage:
    if {adrenalinshot::%victim's uuid%::time} is set:
        if {adrenalinshot::%victim's uuid%::time} was less than {@time} seconds ago:
            cancel event
            if {adrenalinshot::%victim's uuid%::damage} is set:
                add damage to {adrenalinshot::%victim's uuid%::damage}
            if {adrenalinshot::%victim's uuid%::damage} isn't set:
                set {adrenalinshot::%victim's uuid%::damage} to damage

every 1 second:
    loop all players:
        if {adrenalinshot::%loop-player's uuid%::time} is set:
            if {adrenalinshot::%loop-player's uuid%::time} was more than {@time} seconds ago:
                set {_damage} to {adrenalinshot::%loop-player's uuid%::damage}
                delete {adrenalinshot::%loop-player's uuid%::time}
                delete {adrenalinshot::%loop-player's uuid%::damage}
                damage loop-player by {_damage}
 
Last edited: