#Bounty skript

1 messages · Page 1 of 1 (latest)

spice sluice
#

So basicly you can do /bounty put a bounty on someone with a priority; High Mid Low If the bounty player gets killed by another player they get their minecraft skull with in the lore "This bounty had a priority High/Mid/low!" Then they can go up to a npc which opens a gui where you can click on event slot 23 to give the skull and they get money and the skull gets removed. The problem is I need to make sure its the right skull and not a random one.

#
                    set {_playerhead} to player head
                    set {_randomnumber} to random integer between 500 and 1000
                    remove {_playerhead} from player's inventory
                    add {_randomnumber} to player's balance
                    send "&aYou have received %{_randomnumber}% from the bounty."
                else if {_prio} contains "Low":
                    set {_playerhead} to player head
                    set {_randomnumber} to random integer between 200 and 500
                    remove {_playerhead} from player's inventory
                    add {_randomnumber} to player's balance
                    send "&aYou have received %{_randomnumber}% from the bounty."
                else if {_prio} contains "Mid":
                    set {_playerhead} to player head
                    set {_randomnumber} to random integer between 100 and 200
                    remove {_playerhead} from player's inventory
                    add {_randomnumber} to player's balance
                    send "&aYou have received %{_randomnumber}% from the bounty."```
#

This is my skript but could be changed tho

spice sluice
#

@azure canyon Sorry for the ping but I know you smart with skript since you helpt me before

viral escarp
#

I would set the bounty type in the nbt of the item, that way you don't need to check the name for that.
https://www.github.com/ShaneBeee/SkBee/wiki

GitHub

SkBee is a Skript addon that aims to add more useful elements to Skript. - ShaneBeee/SkBee

azure canyon
#

^

#

You can also just check with has tag to see if it’s acceptable

spice sluice
azure canyon
#

You can use an int tag, 1/2/3, or a string tag, high/mid/low

spice sluice
# azure canyon You can use an int tag, 1/2/3, or a string tag, high/mid/low
  if attacker is a player: 
    if {bounty::list::*} contains victim:
      remove victim from {bounty::list::*}
      send "<##FD4337>&lBounty: &7The bounty of &b%victim% &7has been claimed by &b%attacker%" to all players
      if {priority::%victim's uuid%} is "Low":
        set {_bountypriority} to "low"
        add nbt from "{tag:High}" to nbt of {_nbt}
      else if {priority::%victim's uuid%} is "Mid":
        set {_bountypriority} to "Mid"
        add nbt from "{tag:Mid}" to nbt of {_nbt}
      else if {priority::%victim's uuid%} is "High":
        set {_bountypriority} to "high"
        add nbt from "{tag:Low}" to nbt of {_nbt}
      give attacker victim's head with name "&8&l%victim%'s head" with lore "&7&lThis bounty had a %{_bountypriority}% priority!" with nbt {_nbt}```
#

Idk what I did wrong

azure canyon
spice sluice
#
            if player has a player head:
                set {_playerhead} to player head
                if (NBT compound of {_playerhead}) has NBT tag "{tag:High}":
                    set {_playerhead} to player head
                    set {_randomnumber} to random integer between 500 and 1000
                    remove {_playerhead} from player's inventory
                    add {_randomnumber} to player's balance
                    send "&aYou have received %{_randomnumber}% from the bounty."
                if (NBT compound of {_playerhead}) has NBT tag "{tag:Mid}":
                    set {_playerhead} to player head
                    set {_randomnumber} to random integer between 200 and 500
                    remove {_playerhead} from player's inventory
                    add {_randomnumber} to player's balance
                    send "&aYou have received %{_randomnumber}% from the bounty."
                if (NBT compound of {_playerhead}) has NBT tag "{tag:Low}":
                    set {_playerhead} to player head
                    set {_randomnumber} to random integer between 100 and 200
                    remove {_playerhead} from player's inventory
                    add {_randomnumber} to player's balance```
#

So like if I click on the event-slot 23 in the gui

#

Nothing happends

azure canyon
#

Nononono

#

Dont ask me to look through 200 lines, especially if i dont know what to look for

#

Try debugging first

spice sluice
#

but its about this line I think in the gui

#

if (NBT compound of {_playerhead}) has NBT tag "{tag:High}":

viral escarp
spice sluice
viral escarp
#

right, but that variable wasn't initially set to anything, so it can't have anything added to it

spice sluice
#

So instead of the adds I should make them set?

viral escarp
#

yeah, so something like set {_nbt} to nbt compound from "{custom;tag:High}"

#

you also need the custom; because this is a custom tag you are using

spice sluice
#
        set {_bountypriority} to "high"
        set {_nbt} to nbt compound from "{custom;tag:Low}"```
#

Well I have this but if I later check the {_nbt} its nothing

#

<none>

azure canyon
#

Where are you checking it?

#

Is it in the same structure?

viral escarp
#

to debug, you can just broadcast nbt compound of player's tool while holding the item

spice sluice
azure canyon
#

Can we se where you apply the tag to the item?

spice sluice
azure canyon
#

Okay

#

Thats where you create {_nbt}

#

Do you ever apply that to the item

spice sluice
#
        set {_bountypriority} to "high"
        set {_nbt} to nbt compound from "{custom;tag:Low}"
      give attacker victim's head with name "&8&l%victim%'s head" with lore "&7&lThis bounty had a %{_bountypriority}% priority!" with nbt {_nbt}``` here
viral escarp
#

try setting a variable to the item, apply the nbt, then give the variable

azure canyon
#

^

#

add NBT from {_NBT} to NBT compound of {_item}

spice sluice
#

But wouldn’t I need to give the item first and then change the nbt?

azure canyon
#

Why?

spice sluice
#

How can I otherwise set a nbt to something that doesn’t exist yet

azure canyon
#

It does exist, in the variable

spice sluice
#

Well I did something but dont know if its right

#
        set {_bountypriority} to "low"
      else if {priority::%victim's uuid%} is "Mid":
        set {_bountypriority} to "Mid"
      else if {priority::%victim's uuid%} is "High":
        set {_bountypriority} to "high"
      set {_item} to victim's head with name "&8&l%victim%'s head" with lore "&7&lThis bounty had a %{_bountypriority}% priority!"
      if {priority::%victim's uuid%} is "Low":
        set {_nbt} to nbt compound from "{custom;tag:High}"
      else if {priority::%victim's uuid%} is "Mid":
        set {_nbt} to nbt compound from "{custom;tag:Mid}"
      else if {priority::%victim's uuid%} is "High":
        set {_nbt} to nbt compound from "{custom;tag:Low}"
      add NBT from {_nbt} to NBT compound of {_item}
      give attacker {_item}```
#

It doesnt work but I think I could have messed up somwhere

azure canyon
#

you can set {_nbt} to nbt compound from "{custom;tag:%{_bountypriority}%}", no need for 3 if statements

azure canyon
spice sluice
#
  if attacker is a player: 
    if {bounty::list::*} contains victim:
      remove victim from {bounty::list::*}
      send "<##FD4337>&lBounty: &7The bounty of &b%victim% &7has been claimed by &b%attacker%" to all players
      if {priority::%victim's uuid%} is "Low":
        set {_bountypriority} to "Low"
      else if {priority::%victim's uuid%} is "Mid":
        set {_bountypriority} to "Mid"
      else if {priority::%victim's uuid%} is "High":
        set {_bountypriority} to "High"
      set {_item} to victim's head with name "&8&l%victim%'s head" with lore "&7&lThis bounty had a %{_bountypriority}% priority!"
      set {_nbt} to nbt compound from "{custom;tag:%{_bountypriority}%}"
      add NBT from {_nbt} to NBT compound of {_item}
      give attacker {_item}```
#

If I check the tag of the item

#

It doesnt have the tag that I gave it

#

Its just give me the skillowner the name and the lore

#

not the {custom;tag:%{_bountypriority}%}

azure canyon
#

try setting it manually

#

set string tag "example;something" of NBT compound of {_item} to "potato"

spice sluice
#

I tried this

#

if string tag "custom;tag" of NBT compound of {_playerhead} is "High":

azure canyon
#

broadcast it

#

see what it is

spice sluice
#

its

#

custom:{tag:"High"}

#

Could this work?

#

if string tag "custom:{tag:""High""}" of NBT compound of {_playerhead} is "High":

#

I dont think it works

#

could have made a mistake

azure canyon
#

what did you broadcast?

#

the tag?

#

nonono, dont set it to "{stuff}"

#

set it to "high"

spice sluice
#

Dont get the last two messages really

azure canyon
#

show me the line where you set the tag

spice sluice
#

oh whait no

#

This one

#

set string tag "custom;tag" of NBT compound of {_item} to "%{_bountypriority}%"

azure canyon
#

okay, now broadcast string tag "custom;tag" of NBT compound of {_item}

spice sluice
#

It is High

#

I have like the feeling that this should work but it doesnt

#

if string tag "custom;tag" of NBT compound of {_playerhead} is "High":

azure canyon
#

okay

#

so then its a problem with {_playerhead}

spice sluice
#

Could we maybe like

#

Loop all player heads

azure canyon
#

broadcast the tag

#

but for {_playerhead}, not {_item}

spice sluice
#

nothing

#

Nothing gets send

azure canyon
#

so then {_playerhead} doesnt have the tag

spice sluice
#

and

#

It doesnt even say it has a skull owner if I look at the whole nbt

#

But it does

azure canyon
#

where do you set the var

spice sluice
#
            if player has a player head:
                set {_playerhead} to player head ```
azure canyon
#

well yeah

#

thats not gonna do anything

#

thats just an item type

#

not the actual item the player has

spice sluice
#

to player head in player’s inventory