#Max upgrading bug
1 messages · Page 1 of 1 (latest)
i know. its a lot, but ive been looking through this for days and i cant do it anymore
- We arent here to look through a thousand lines of code. You can try debugging
- if you know the issue pertains to upgrading, start debugging there. Or, only send that code here
- This is basically copy+paste a whole bunch of times...
- for the command, you can jus give
{gens::%arg-2%}. - Also for the command,
[<>]makes an argument optional, while<>is mandatory. - And use the
permission:property instead of an if statement checking for a permission (you do this in all commands)
- Your
on place:event is literally the same section copy and pasted. you can just use a function or something similar here. Also, half the lines aren't even changed, you could just run them once instead of in every section
- at the very least, you can check for the max gens and then
stopthe code
- same with all the other events. The less code you have, the better. Not just running faster, but also easier to read through.
(and use else ifs)
those item names are so unreadable
use a function to create a gradient from two hex values so you won't have uneditable and unreadable item names
edited it down to this and it fixed the problem, ill add something later to specify the generators so you cant just upgrade every oak log or every oak plank.
if player is sneaking:
if {placedgens::%player's uuid%::*} contains location of event-block:
if event-block is hay bale:
gensUpgrade(player, location of event-block, pumpkin, 150)
play sound "block.note_block.pling" at volume 3 at pitch 10 to player
else if event-block is pumpkin:
gensUpgrade(player, location of event-block, melon, 300)
play sound "block.note_block.pling" at volume 3 at pitch 10 to player
else if event-block is melon:
gensUpgrade(player, location of event-block, oak log, 1000)
play sound "block.note_block.pling" at volume 3 at pitch 10 to player
else if event-block is oak log:
gensUpgrade(player, location of event-block, oak plank, 2500)
play sound "block.note_block.pling" at volume 3 at pitch 10 to player
function gensUpgrade(P: player, L: location, B: itemtype, N: int):
if {_P}'s balance >= {_N}:
remove {_N} from {_P}'s balance
set block at {_L} to {_B}
send "&a&lYou upgraded your gen!" to {_P}
else:
send "&c&lYou dont have enough money!" to {_P}```