#Issue, not sure why, prob right in front of me
1 messages · Page 1 of 1 (latest)
what isn't working
no idea
If you dont know whats wrong then there isnt a problem?
that's what shows when i redeem it
the picture
i meant as in idk what's causing it
@wicked reef
Why dont you check the name of the player's tool
wdym?
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
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
wdym? im new to all this skript stuff
You read it with "worth" tag of nbt...
So try to set "worth" tag of nbt
When you make the item
Weird
Yeah, i dont see why that would break it
Sure
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
it calcuates how many they need
and takes it from their inventory
here let me do this
1 sec
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
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?
I actually prefer it with the normal vars
oh lol
I just needed to figure out the purpose
see when i have 500 of it in my inventory it says i dotn have enough but i do
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
tbh i didnt even right this code, my friend took my old code and "made it better"
A year ago as in yesterday
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
That checks what type of fragment it is
You would need to set it here
Do that it can check the type in the function
so the item needs to have the nbt?
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
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}```
It uses nbt to find the fragments tho so i would keep it
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
like that?
Well in " but yeah
Literally just copy what you had
I cant show you because you deleted it
I replied to it here
here ill resend what i had
It was how you made the orb thing
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%}"
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}
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
What does this mean?
ignore me I just actually looked at your code and that's not the problem
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
Just like i told you a while ago
It was already a integer when you parse a integer as a integer it becomes none in skript
¯_(ツ)_/¯