#WHAT AM I DOING WRONG

1 messages · Page 1 of 1 (latest)

pallid beacon
#

I am making a rougelike because gerg failed me with descendent so im making my own, in a function im trying to make walls randomized between runs and I heard randomizing off of a fake player would work but.... no luck scoreboard players random wall1 rand 0 99 / execute if score wall1 rand matches 0..50 run fill -280 200 20 -280 202 20 minecraft:waxed_weathered_copper_bars
execute if score wall1 rand matches 51..99 run fill -280 200 20 -280 202 20 minecraft:air

pallid beacon
#

(I want to have a chance of walls existing or not so new pathways can open with extended play) (random chance)

#

as of now I have the code to seperate runs apart and make it more streamlined but my 'start run' button is tied to a function which is doing many things at once, I am also trying to tie the wall randomization into the button press along with everthing else

#

(end goal is have enemies loot and walls randomized when I click start run) (when a run ends or all players die my run ender script cleans up all items and mobs)

#

(at least it feels like it)

#

[03:20:06 ERROR]: Failed to load function servitude:start_run
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 19: Incorrect argument for command at position 19: ...d players <--[HERE]
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?]
at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$prepareTasks$0(SimpleReloadInstance.java:68) ~[purpur-1.21.11.jar:1.21.11-2542-6452678]
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423) ~[?:?]
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) ~[?:?]
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) ~[?:?]
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) ~[?:?]
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) ~[?:?]
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) ~[?:?]
Caused by: java.lang.IllegalArgumentException: Whilst parsing command on line 19: Incorrect argument for command at position 19: ...d players <--[HERE]
at net.minecraft.commands.functions.CommandFunction.fromLines(CommandFunction.java:84) ~[purpur-1.21.11.jar:1.21.11-2542-6452678]
at net.minecraft.server.ServerFunctionLibrary.lambda$reload$3(ServerFunctionLibrary.java:88) ~[purpur-1.21.11.jar:1.21.11-2542-6452678]
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
... 7 more

#

The entirety of it just DOESNT work

#

everything else I have works except this wierd code line that the internet swears works

#

I am reading up about some 'Predicate method'

#

I am also feeling like I am getting lied to at every turn

#

is this a bedrock thing?

#

I am using purpur java 1.21.11

versed sage
#

Read your error log that you sent

[03:20:06 ERROR]: Failed to load function servitude:start_run
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Whilst parsing command on line 19: Incorrect argument for command at position 19: ...d players <--[HERE]
Line 19
scoreboard players random wall1 rand 0 99
that's not proper command format for java

#

random is not a players subcommand in java

#
Minecraft Wiki

The scoreboard system is a complex gameplay mechanic utilized through commands. Mainly intended for mapmakers and server operators, scoreboards are used to track, set, and list the scores of entities in a myriad of different ways.

#

(Bedrock Edition)

#

if you want to set a scoreboard to a random value in java commands you have to use execute store and /random

the format looks like
execute store result score <player> <objective> run random value <range>
read the page on /random for more info on how it works
https://minecraft.wiki/w/Commands/random

Minecraft Wiki

Generates a random integer, or controls random sequences in the world.

versed sage
# pallid beacon

I'd also definitely recommend vscode with the extensions syntax-mcfunction and Datapack Helper Plus by Spyglass. It adds error highlighting and can help catch some of these issues. As opposed to using notepad where its just coding blind

pallid beacon
#

did my own thing

#

and it worked

#

execute if predicate servitude:wall_chance50 run fill -281 200 20 -281 201 20 minecraft:air

#

this command line

#

super stoked I figured something out

#

I will look into what you sent