Logout Villager

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

Computerize

Member
Oct 10, 2019
38
0
0
23
Ok, so I would like a skript that if there are people in a 200 block radius or combat timer is true and the person logout a villager will spawn named "&c%player%& &7(Logout Villager)". When this villager is killed, the player's inventory is dropped and when the player logs back on they are TPed to spawn and their inventory and armor is cleared. When the villager dies it will also set {pvpTimer.%player%} to 1800 and will set {deathBan.%player%} to 600. Hopefully someone can help me, thanks! Also please make the villager have no AI.

Here is my current PvP Timer Skript:
Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
    else:
      set {combatTag.%attacker%} to 30
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
    else:
      set {combatTag.%victim%} to 30
every second:
  loop all players:
    if {combatTag.%loop-player%} is set:
      if {combatTag.%loop-player%} > 0:
        remove 1 from {combatTag.%loop-player%}
      else:
        delete {combatTag.%loop-player%}
        send "&aYou are no longer in combat." to loop-player
on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
 
Assuming your combat tag skript works, here you go!
Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
    else:
      set {combatTag.%attacker%} to 30
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
    else:
      set {combatTag.%victim%} to 30
every second:
  loop all players:
    if {combatTag.%loop-player%} is set:
      if {combatTag.%loop-player%} > 0:
        remove 1 from {combatTag.%loop-player%}
      else:
        delete {combatTag.%loop-player%}
        send "&aYou are no longer in combat." to loop-player
on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
on disconnect:
    if {combattag.%player%} is set:
        spawn a villager
        set {combatvillager::%spawned villager%::%player's uuid%::*} to true
        set the name of the spawned villager to "%event-player%"
        add "{NoAI:1}" to nbt of last spawned entity
        set {inventory::%player's uuid%::*} to all items in player's inventory
        set {logged.%player's uuid%} to true
on death:
    if victim is a villager:
        if {combatvillager::%victim%::%player's uuid%::*} is true:
            drop all items in inventories {inventory::%player's uuid%::*}
            set {killed.%player's uuid%} to true
on join:
    if {logged.%player's uuid%} is true:
        if {killed.%player's uuid%} is true:
            clear player's inventory
            set {logged.%player's uuid%} to false
            set {killed.%player's uuid%} to false

Have a good day.
 
Assuming your combat tag skript works, here you go!
Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
    else:
      set {combatTag.%attacker%} to 30
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
    else:
      set {combatTag.%victim%} to 30
every second:
  loop all players:
    if {combatTag.%loop-player%} is set:
      if {combatTag.%loop-player%} > 0:
        remove 1 from {combatTag.%loop-player%}
      else:
        delete {combatTag.%loop-player%}
        send "&aYou are no longer in combat." to loop-player
on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
on disconnect:
    if {combattag.%player%} is set:
        spawn a villager
        set {combatvillager::%spawned villager%::%player's uuid%::*} to true
        set the name of the spawned villager to "%event-player%"
        add "{NoAI:1}" to nbt of last spawned entity
        set {inventory::%player's uuid%::*} to all items in player's inventory
        set {logged.%player's uuid%} to true
on death:
    if victim is a villager:
        if {combatvillager::%victim%::%player's uuid%::*} is true:
            drop all items in inventories {inventory::%player's uuid%::*}
            set {killed.%player's uuid%} to true
on join:
    if {logged.%player's uuid%} is true:
        if {killed.%player's uuid%} is true:
            clear player's inventory
            set {logged.%player's uuid%} to false
            set {killed.%player's uuid%} to false

Have a good day.
Hey, could you make the villager die and not drop items after 45 seconds and if the player joins before those 45 seconds to die and not drop anything
 
Sure. Here's the new skript.


Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
    else:
      set {combatTag.%attacker%} to 30
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
    else:
      set {combatTag.%victim%} to 30
every second:
  loop all players:
    if {combatTag.%loop-player%} is set:
      if {combatTag.%loop-player%} > 0:
        remove 1 from {combatTag.%loop-player%}
      else:
        delete {combatTag.%loop-player%}
        send "&aYou are no longer in combat." to loop-player
on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
on disconnect:
    if {combattag.%player%} is set:
        spawn a villager
        set {combatvillager::%spawned villager%::%player's uuid%::*} to true
        set the name of the spawned villager to "%event-player%"
        add "{NoAI:1}" to nbt of last spawned entity
        set {inventory::%player's uuid%::*} to all items in player's inventory
        set {logged.%player's uuid%} to true
on death:
    if victim is a villager:
        if {combatvillager::%victim%::%player's uuid%::*} is true:
            set {waiting.%player's uuid%} to true
            wait 45 seconds
            set {waiting.%player's uuid%} to false
            drop all items in inventories {inventory::%player's uuid%::*}
            set {killed.%player's uuid%} to true
on join:
    if {logged.%player's uuid%} is true:
        if {killed.%player's uuid%} is true:
            if {waiting.%player's uuid%} is false:
                clear player's inventory
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
            if {waiting.%player's uuid%} is true:
                set {waiting.%player's uuid%} to fals
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
[doublepost=1577059146,1577058820][/doublepost]So I didnt really read your full post I just added that villager part, didnt send them to spawn or set your variables to specific values like you wanted. Here is that if you still want it: (I also had a few typos and indentation errors in the previous one so u will want this skript) (THIS CODE IS ALSO SHORTENED SO THE FILE SIZE IS SMALLER REE)
Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to victim
    else:
      set {combatTag.%victim%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to victim
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to attacker
    else:
      set {combatTag.%attacker%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to attacker

on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
on disconnect:
    if {combattag.%player%} is set:
        spawn a villager
        set {combatvillager::%spawned villager%::%player's uuid%::*} to true
        set the name of the spawned villager to "%event-player%"
        add "{NoAI:1}" to nbt of last spawned entity
        set {inventory::%player's uuid%::*} to all items in player's inventory
        set {logged.%player's uuid%} to true
on death:
    if victim is a villager:
        if {combatvillager::%victim%::%player's uuid%::*} is true:
            set {waiting.%player's uuid%} to true
            wait 45 seconds
            set {waiting.%player's uuid%} to false
            drop all items in inventories {inventory::%player's uuid%::*}
            set {killed.%player's uuid%} to true
            set {pvpTimer.%player%} to 1800
            set {deathBan.%player%} to 600
on join:
    if {logged.%player's uuid%} is true:
        if {killed.%player's uuid%} is true:
            if {waiting.%player's uuid%} is false:
                clear player's inventory
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
                execute console command "spawn %player%"
            if {waiting.%player's uuid%} is true:
                set {waiting.%player's uuid%} to false
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
[doublepost=1577074640][/doublepost]might not work but no errors sooo


Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to victim
    else:
      set {combatTag.%victim%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to victim
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to attacker
    else:
      set {combatTag.%attacker%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to attacker
 
on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
on disconnect:
    if {combattag.%player%} is set:
        spawn a villager
        set {combatvillager::%spawned villager%::%player's uuid%::*} to true
        set the name of the spawned villager to "%event-player%"
        add "{NoAI:1}" to nbt of last spawned entity
        set {inventory::%player's uuid%::*} to all items in player's inventory
        set {logged.%player's uuid%} to true
        set {waiting2.%player's uuid%} to true
        wait 45 seconds
        set {waiting2.%player's uuid%} to false
        set {combatvillager::%spawned villager%::%player's uuid%::*} to false
        kill spawned villager
        stop
on death:
    if victim is a villager:
        if {combatvillager::%victim%::%player's uuid%::*} is true:
            set {waiting.%player's uuid%} to true
            wait 45 seconds
            set {waiting.%player's uuid%} to false
            drop all items in inventories {inventory::%player's uuid%::*}
            set {killed.%player's uuid%} to true
            set {pvpTimer.%player%} to 1800
            set {deathBan.%player%} to 600
on join:
    if {logged.%player's uuid%} is true:
        if {killed.%player's uuid%} is true:
            if {waiting.%player's uuid%} is false:
                clear player's inventory
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
                execute console command "spawn %player%"
            if {waiting.%player's uuid%} is true:
                set {waiting.%player's uuid%} to false
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
 
Sure. Here's the new skript.


Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
    else:
      set {combatTag.%attacker%} to 30
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
    else:
      set {combatTag.%victim%} to 30
every second:
  loop all players:
    if {combatTag.%loop-player%} is set:
      if {combatTag.%loop-player%} > 0:
        remove 1 from {combatTag.%loop-player%}
      else:
        delete {combatTag.%loop-player%}
        send "&aYou are no longer in combat." to loop-player
on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
on disconnect:
    if {combattag.%player%} is set:
        spawn a villager
        set {combatvillager::%spawned villager%::%player's uuid%::*} to true
        set the name of the spawned villager to "%event-player%"
        add "{NoAI:1}" to nbt of last spawned entity
        set {inventory::%player's uuid%::*} to all items in player's inventory
        set {logged.%player's uuid%} to true
on death:
    if victim is a villager:
        if {combatvillager::%victim%::%player's uuid%::*} is true:
            set {waiting.%player's uuid%} to true
            wait 45 seconds
            set {waiting.%player's uuid%} to false
            drop all items in inventories {inventory::%player's uuid%::*}
            set {killed.%player's uuid%} to true
on join:
    if {logged.%player's uuid%} is true:
        if {killed.%player's uuid%} is true:
            if {waiting.%player's uuid%} is false:
                clear player's inventory
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
            if {waiting.%player's uuid%} is true:
                set {waiting.%player's uuid%} to fals
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
[doublepost=1577059146,1577058820][/doublepost]So I didnt really read your full post I just added that villager part, didnt send them to spawn or set your variables to specific values like you wanted. Here is that if you still want it: (I also had a few typos and indentation errors in the previous one so u will want this skript) (THIS CODE IS ALSO SHORTENED SO THE FILE SIZE IS SMALLER REE)
Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to victim
    else:
      set {combatTag.%victim%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to victim
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to attacker
    else:
      set {combatTag.%attacker%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to attacker

on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
on disconnect:
    if {combattag.%player%} is set:
        spawn a villager
        set {combatvillager::%spawned villager%::%player's uuid%::*} to true
        set the name of the spawned villager to "%event-player%"
        add "{NoAI:1}" to nbt of last spawned entity
        set {inventory::%player's uuid%::*} to all items in player's inventory
        set {logged.%player's uuid%} to true
on death:
    if victim is a villager:
        if {combatvillager::%victim%::%player's uuid%::*} is true:
            set {waiting.%player's uuid%} to true
            wait 45 seconds
            set {waiting.%player's uuid%} to false
            drop all items in inventories {inventory::%player's uuid%::*}
            set {killed.%player's uuid%} to true
            set {pvpTimer.%player%} to 1800
            set {deathBan.%player%} to 600
on join:
    if {logged.%player's uuid%} is true:
        if {killed.%player's uuid%} is true:
            if {waiting.%player's uuid%} is false:
                clear player's inventory
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
                execute console command "spawn %player%"
            if {waiting.%player's uuid%} is true:
                set {waiting.%player's uuid%} to false
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
[doublepost=1577074640][/doublepost]might not work but no errors sooo


Code:
on damage of player:
  if attacker is a player:
    if {combatTag.%victim%} isn't set:
      send "&cYou are now in combat." to victim
      set {combatTag.%victim%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to victim
    else:
      set {combatTag.%victim%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to victim
    if {combatTag.%attacker%} isn't set:
      send "&cYou are now in combat." to attacker
      set {combatTag.%attacker%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to attacker
    else:
      set {combatTag.%attacker%} to 30
      wait 30 seconds
      send "&aYou are no longer in combat." to attacker
 
on command:
  if {combatTag.%player%} is set:
    cancel event
    send "&cYou cannot use commands while in combat."
on disconnect:
    if {combattag.%player%} is set:
        spawn a villager
        set {combatvillager::%spawned villager%::%player's uuid%::*} to true
        set the name of the spawned villager to "%event-player%"
        add "{NoAI:1}" to nbt of last spawned entity
        set {inventory::%player's uuid%::*} to all items in player's inventory
        set {logged.%player's uuid%} to true
        set {waiting2.%player's uuid%} to true
        wait 45 seconds
        set {waiting2.%player's uuid%} to false
        set {combatvillager::%spawned villager%::%player's uuid%::*} to false
        kill spawned villager
        stop
on death:
    if victim is a villager:
        if {combatvillager::%victim%::%player's uuid%::*} is true:
            set {waiting.%player's uuid%} to true
            wait 45 seconds
            set {waiting.%player's uuid%} to false
            drop all items in inventories {inventory::%player's uuid%::*}
            set {killed.%player's uuid%} to true
            set {pvpTimer.%player%} to 1800
            set {deathBan.%player%} to 600
on join:
    if {logged.%player's uuid%} is true:
        if {killed.%player's uuid%} is true:
            if {waiting.%player's uuid%} is false:
                clear player's inventory
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
                execute console command "spawn %player%"
            if {waiting.%player's uuid%} is true:
                set {waiting.%player's uuid%} to false
                set {logged.%player's uuid%} to false
                set {killed.%player's uuid%} to false
The villager disappears after 10 seconds and the player joins back and {pvpTimer.%player%} and {deathBan.%player%} does not set when the villager dies and the items do not drop and the player joins back and nothing has changed.
 
tbh piling all this code on top of each other is confusing alright