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!
You can always check out skUnity Downloads for downloads and any other information about Skript!
I can't quite get the NBT to work, no errors but doesn't seem like the NBT tag is being added, see any issues?You could use NBT, add custom nbt like {Owner:%player%} to the mob
on damage of an animal:
if attacker's tool is lead:
cancel event
if {animals::%attacker%::listen} is true:
send "Confirmed, you now own this %victim%." to attacker
set {animals::%attacker%::listen} to false
add "{Owner:%attacker%}" to nbt of victim
else:
if nbt of victim does not contain "{Owner:}":
send "Punch the %victim% again to confirm ownership" to attacker
set {animals::%attacker%::listen} to true
on damage of an animal:
if attacker's tool is lead:
cancel event
wait 5 seconds
set {animals::%attacker%::listen} to false
That if statements seems to be always outputting false, would you mind testing the script for yourself? I'm truly lost, been working on this for 5 hoursTo check the tag, use `if tag "Owner" of nbt of victim is "%attacker%"`
That if statements seems to be always outputting false, would you mind testing the script for yourself? I'm truly lost, been working on this for 5 hours
what do you get if you broadcast the tag?
send tag "Owner" of nbt of victim to attacker
Accidenally deleted my reply, in case you didn't catch it;How do you use code blocks here?
on damage of an animal:
if attacker's tool is lead:
cancel event
if {animals::%attacker's uuid%::listen} is not set:
set {animals::%attacker's uuid%::listen} to true
send "Punch the %victim% again to confirm ownership" to attacker
wait 5 seconds
delete {animals::%attacker's uuid%::listen}
else:
add "{Owner:%attacker%}" to nbt of victim
send "Confirmed, you now own this %victim%." to attacker
Oh my god, you did it, thanks!Code:on damage of an animal: if attacker's tool is lead: cancel event if {animals::%attacker's uuid%::listen} is not set: set {animals::%attacker's uuid%::listen} to true send "Punch the %victim% again to confirm ownership" to attacker wait 5 seconds delete {animals::%attacker's uuid%::listen} else: add "{Owner:%attacker%}" to nbt of victim send "Confirmed, you now own this %victim%." to attacker
Actually, how would I check if the animal is already owned by someone?Code:on damage of an animal: if attacker's tool is lead: cancel event if {animals::%attacker's uuid%::listen} is not set: set {animals::%attacker's uuid%::listen} to true send "Punch the %victim% again to confirm ownership" to attacker wait 5 seconds delete {animals::%attacker's uuid%::listen} else: add "{Owner:%attacker%}" to nbt of victim send "Confirmed, you now own this %victim%." to attacker
check the tag, as I showed before (if tag "Owner" of nbt of victim is set)Oh my god, you did it, thanks!
[doublepost=1631823504,1631823263][/doublepost]
Actually, how would I check if the animal is already owned by someone?
check the tag, as I showed before (if tag "Owner" of nbt of victim is set)
if tag "Owner" of nbt of victim is not set:
if {animals::%attacker's uuid%::listen} is not set:
set {animals::%attacker's uuid%::listen} to true
send "Punch the %victim% again to confirm ownership" to attacker
wait 5 seconds
delete {animals::%attacker's uuid%::listen}
else:
add "{Owner:%attacker%}" to nbt of victim
send "Confirmed, you now own this %victim%." to attacker
Does the NBT not get set? Broadcast the nbt after it's supposed to get setThis seems to always be trueCode:if tag "Owner" of nbt of victim is not set: if {animals::%attacker's uuid%::listen} is not set: set {animals::%attacker's uuid%::listen} to true send "Punch the %victim% again to confirm ownership" to attacker wait 5 seconds delete {animals::%attacker's uuid%::listen} else: add "{Owner:%attacker%}" to nbt of victim send "Confirmed, you now own this %victim%." to attacker
Just did that, doesn't seem like it. I might try SkStuff for NBTs instead.Does the NBT not get set? Broadcast the nbt after it's supposed to get set
what? no, never. the addon is not the issue, skstuff hasn't been updated in 5 years, skbee is up to date and one of the best addons, you just don't give enough context for me to understand what you actually try and what doesn't workJust did that, doesn't seem like it. I might try SkStuff for NBTs instead.
Right, okay. The issue is that the NBT tag never gets added to the entity.what? no, never. the addon is not the issue, skstuff hasn't been updated in 5 years, skbee is up to date and one of the best addons, you just don't give enough context for me to understand what you actually try and what doesn't work
does the message get sent to you?Right, okay. The issue is that the NBT tag never gets added to the entity.
This is the current script.does the message get sent to you?
on damage of an animal:
if attacker's tool is lead:
cancel event
send nbt of victim to console
if tag "Owner" of nbt of victim is not set:
if {animals::%attacker's uuid%::listen} is not set:
set {animals::%attacker's uuid%::listen} to true
send "Punch the %victim% again to confirm ownership" to attacker
wait 5 seconds
delete {animals::%attacker's uuid%::listen}
else:
add "{Owner:%attacker%}" to nbt of victim
send "Confirmed, you now own this %victim%." to attacker
{AbsorptionAmount:0.0f,Age:0,AgeLocked:0b,Air:300s,ArmorDropChances:[0.085f,0.085f,0.0f,0.085f],ArmorItems:[{},{},{},{}],Attributes:[{Base:0.21916751001978602d,Name:"minecraft:generic.movement_speed"},{Base:21.0d,Name:"minecraft:generic.max_health"},{Base:0.0d,Name:"minecraft:generic.armor"},{Base:16.0d,Modifiers:[{Amount:0.0031947673230036293d,Name:"Random spawn bonus",Operation:1,UUID:[I;1978012985,833571285,-1771715006,378728803]}],Name:"minecraft:generic.follow_range"},{Base:0.5593834170847802d,Name:"minecraft:horse.jump_strength"}],Brain:{memories:{}},Bred:0b,Bukkit.Aware:1b,Bukkit.MaxDomestication:100,Bukkit.updateLevel:2,CanPickUpLoot:0b,DeathTime:0s,EatingHaystack:1b,FallDistance:0.0f,FallFlying:0b,Fire:-1s,ForcedAge:0,HandDropChances:[0.085f,0.085f],HandItems:[{},{}],Health:21.0f,HurtByTimestamp:0,HurtTime:0s,InLove:0,Invulnerable:0b,LeftHanded:0b,Motion:[0.0d,-0.0784000015258789d,0.0d],OnGround:1b,Paper.Origin:[-287.5d,4.0d,54.5d],Paper.OriginWorld:[I;1733674433,134760230,-1952856429,1826994894],Paper.SpawnReason:"NATURAL",PersistenceRequired:1b,PortalCooldown:0,Pos:[-287.1304967023017d,4.0d,74.8592314286132d],Rotation:[315.25912f,0.0f],Spigot.ticksLived:15143,Tame:0b,Temper:0,UUID:[I;322025419,-760984888,-1241188896,-1346078824],Variant:1030,WorldUUIDLeast:-8387454494511351090L,WorldUUIDMost:7446074991781103398L}