#Issue, not sure why, prob right in front of me

1 messages · Page 1 of 1 (latest)

rigid spoke
#
            set {_worth} to ("worth" tag of nbt of player's tool)
            remove 1 of player's tool from player's inventory
            set {_worth} to ({_worth} parsed as integer)

Any idea why this doesnt work
Picture of item

vernal python
#

what isn't working

rigid spoke
#

it says this when i redeem it

rigid spoke
wicked reef
rigid spoke
#

that's what shows when i redeem it

#

the picture

#

i meant as in idk what's causing it

wicked reef
#

The code you sent

#

Has no sends

#

So send the full code

rigid spoke
#

@wicked reef

wicked reef
#

Why dont you check the name of the player's tool

rigid spoke
#

wdym?

wicked reef
#

If name of player's tool is ""

#

Instead of "%player's tool%" contains

#

Also

#

You used 2 different nbt tags

#

You set it as worth

#

But then read value

#

Try it

rigid spoke
#

fixed those issues

#

that's what it shows

wicked reef
#

Hm

#

Havent messed with nbt much

#

Might have to look into it more

#

But why dont you try to set it the same way you read it

#

Because it might be using a seperate section

rigid spoke
#

wdym? im new to all this skript stuff

wicked reef
#

You read it with "worth" tag of nbt...

#

So try to set "worth" tag of nbt

#

When you make the item

rigid spoke
#

i fixed it

#

it was this

#
set {_worth} to ({_worth} parsed as integer)
wicked reef
#

Weird

rigid spoke
#

ikr

#

that shouldve worked with it

#

thanks brotha

wicked reef
#

Yeah, i dont see why that would break it

rigid spoke
#

i do got another one for you though if u want

#

@wicked reef

wicked reef
#

Sure

rigid spoke
#
function purchaseCheck(p: player, type: text, amount: integer, item: item, c: text, c2: text, kind: text):
    loop all items in {_p}'s inventory:
        if tag "Fragment" of nbt of loop-item is set:
            set {_x} to tag "Fragment" of nbt of loop-item
            if {_x} = {_type}:
                add 1 to (amount currently in inventory)
                add loop-value to 500
        exit loop if (amount currently in inventory) >= 500
    if (amount currently have in inventory) >= 500:
        remove 500 from {_p}
#

ok so i got this right

#

but it doesnt read that i have "500" in my inventory

#

let me send 1 more thing

#
            give arg-1 arg-3 of cyan dye named "&3&lTron &7Fragment" with lore "&7Fragments can be used to craft" and "&7magical armor in &f/armor&7!"
#

this is the item

#

that you need 500 of to buy

wicked reef
#

Im confused

#

What is this doing

rigid spoke
#

it calcuates how many they need

#

and takes it from their inventory

#

here let me do this

#

1 sec

wicked reef
#

Hm

#

Are they stackable

#

Because it looks like it only counts how many slots have it

#

Instead of add 1 to y

#

I would add item amount of loop-item

rigid spoke
#

ok can u read ity better

#

look now

wicked reef
#

But you might have to do more checks

#

To make sure it doesnt go over

rigid spoke
#

function purchaseCheck(p: player, type: text, amount: integer, item: item, c: text, c2: text, kind: text):
    loop all items in {_p}'s inventory:
        if tag "Fragment" of nbt of loop-item is set:
            set {_x} to tag "Fragment" of nbt of loop-item
            if {_x} = {_type}:
                add 1 to (amount currently in inventory)
                add loop-value to 500
        exit loop if (amount currently in inventory) >= 500
    if (amount currently have in inventory) >= 500:
        remove 500 from {_p}
#

easier to read?

wicked reef
#

I actually prefer it with the normal vars

rigid spoke
#

oh lol

wicked reef
#

I just needed to figure out the purpose

rigid spoke
#

see when i have 500 of it in my inventory it says i dotn have enough but i do

wicked reef
#

So if you have a stack of 64

#

It counts it as 1

#

It counts how many slots you have

#

No matter how many item each slot has

rigid spoke
#

tbh i didnt even right this code, my friend took my old code and "made it better"

wicked reef
#

Might wanna read through it then

#

Or question them about it

rigid spoke
#

it was from like a year ago

#

dont remember his user lol

wicked reef
#

A year ago as in yesterday

rigid spoke
#

i thought it was this here

#
        if tag "Fragment" of nbt of loop-item is set:
            set {_x} to tag "Fragment" of nbt of loop-item
#

no literally prob a year ago

#

i just had to go in and make evertything work with new skript stuff

#

@wicked reef should i just give up on it

wicked reef
wicked reef
#

Do that it can check the type in the function

rigid spoke
#

so the item needs to have the nbt?

wicked reef
#

The problem is when it finds a valid stack it only adds one even if thay stack has 64 fragments

#

For this function. Yes

#

You can rewrite the function tho

rigid spoke
#
function purchaseCheck(p: player, type: text, amount: integer, item: item, c: text, c2: text, kind: text):
    loop all items in {_p}'s inventory:
        if tag "Fragment" of nbt of loop-item is set:
            set {_x} to tag "Fragment" of nbt of loop-item
            if {_x} = {_type}:
                add 1 to {_y}
                add loop-value to {_remove::*}
        exit loop if {_y} >= {_amount}
    if {_y} >= {_amount}:
        remove {_remove::*} from {_p}
        give {_p} dirt
        play sound "entity.experience_orb.pickup" with volume 100 with pitch 1 at {_p} for {_p}
    else:
        play sound "block.anvil.place" with volume 100 with pitch 1 at {_p} for {_p} 
        close inventory of {_p}
        send "&c[!] You do not have enough %{_type}% &cfragments." to {_p}```
wicked reef
#

It uses nbt to find the fragments tho so i would keep it

rigid spoke
#

something like this?

wicked reef
#

You already did the nbt correctly in the other code

#

Just copy that

#

It would be like "{Fragment:tron}"

#

Or something

#

Then in the function you would input tron as the type

#

Also i think its nbt from

#

But just copy your other code

rigid spoke
#

like that?

wicked reef
#

Well in " but yeah

#

Literally just copy what you had

#

I cant show you because you deleted it

rigid spoke
#

wait what other code

#

what did i delete

wicked reef
rigid spoke
#

here ill resend what i had

wicked reef
#

It was how you made the orb thing

rigid spoke
#

oh

#

1 sec

#
on right click:
    if player's tool is magma cream:
        If name of player's tool is "&e&lOrb Voucher &7(Right Click)":
            cancel event
            set {_worth} to ("worth" tag of nbt of player's tool)
            remove 1 of player's tool from player's inventory
            add {_worth} to {orbs::%player's uuid%}
            send "&a&l+ ⛁%spaced({_worth})% &a&lOrbs"
            cancel event
#
                        give player 1 magma cream named "&e&lOrb Voucher &7(Right Click)" with lore "&aValue: &f%arg-2%" with nbt of "{worth:%arg-2%}"
wicked reef
#

So do it like that

#

But Fragment:tron

rigid spoke
#

it doesnt give them to my inventory

#

but when i remove the nbt it works

#
            give arg-1 arg-3 of cyan dye named "&3&lTron &7Fragment" with lore "&7Fragments can be used to craft" and "&7magical armor in &f/armor&7!" with nbt from "{Fragment:tron}"
#

@wicked reef

#

wait

#

its like weird now

#

if i type in like 300

#

it gives me 44 everytime

#

or like 100

#

it gives me 44

#

and it takes a stack and replaces it with the boots

#
function purchaseCheck(p: player, type: text, amount: integer, item: item, c: text, c2: text, kind: text):
    loop all items in {_p}'s inventory:
        if tag "Fragment" of nbt of loop-item is set:
            set {_x} to tag "Fragment" of nbt of loop-item
            if {_x} = {_type}:
                add 1 to {_y}
                add loop-value to {_remove::*}
        exit loop if {_y} >= {_amount}
    if {_y} >= {_amount}:
        remove {_remove::*} from {_p}
next silo
#

I just scanned through the chat not looking at anything but have you tried setting the nbt tag to a float or int tag

#

because if it's somehow a byte then it only goes from -128 to 127

next silo
#

ignore me I just actually looked at your code and that's not the problem

wicked reef
#

I still think its because you are adding 1 to y here

#

Because the if {_x} = {_type} check if that stack is valid but you never check how many items are in that stack. Therefore by adding 1 you are forcing the skript to think that there is only 1 fragment in each slot, giving you a maximum of like 36 fragments or something.

#

Instead you should add item amount of loop-value to {_y} which should hopefully give you the right amount of items

wicked reef
grizzled swallow
wicked reef
#

Why

#

Thats dumb

grizzled swallow
#

¯_(ツ)_/¯