#How do I edit someones scoreboard with querys

1 messages · Page 1 of 1 (latest)

left perch
#

So they lose points on a stamina scoreboard when running jumping or punching

tired oar
#

v.attack time is greater than 0 when using an item, placing a block, or attacking

#

I do not recommend attempting this with purely commands but there are afk detection systems, as well as ways to detect jumping and crouching that you can find on youtube

left perch
#

I want it so you constantly lose a scoreboard called stamina by running

#

And each time you punch or jump you lose stamina too

tired oar
#

You cannot detect punching with only commands

left perch
#

Ik

#

So molang is the way to go

tired oar
#

Yes

left perch
#

I originally was just trying to do it with animation controllers and functions

tired oar
left perch
#

?

#

Why the molang doc then?

#

@tired oar

tired oar
left perch
#

?

#

Isnt it transistions?

tired oar
#

Transitions use molang queries and statements

left perch
#

I did execute at @a[variable.attack_time=1] run scoreboard players remove @s stamina 25

tired oar
#

that is incorrect

#

Molang cannot be ran using commands they are sperate languages

left perch
#

?

#

Can you connect them?

tired oar
#

variable.attack_time is a variable stored by the player, it can only be accessed via molang. Commands are not molang. Animation controllers are used to bridge the gap

left perch
#

Hm

tired oar
#

Set v.attack_time as the condition to the transition and !v.attack_time as the transition back to default

#

This will allow you to run commands only when the player attacks

left perch
#

So use molang to make custom transistion requirements?

tired oar
#

Although it will not be perfect, you may want to use timers instead or aswell

tired oar
#

There are examples on the wiki of how to write transitions

left perch
#

@tired oar

tired oar
#

There is a logic error, you are not checking that the player has 25 or more stamina before remove 25

#

You will need to edit the name and link it to the server-side player file

left perch
#

I can make a constant function that will set any players stamina scoreboard to 0 if it is -9999..-1

#

What is that

#

Ive never done anything with player.json

tired oar
#

Just write /scoreboard players remove @s[scores={stamina=25..}] stamina 25 you could also just set it back to 0 if it dropped below 0 as long as you write it in the on entry below the remove command. This will allow it to deplete to 0 instead of them staying at 24 or whatever they are on. Alternatively, you can set them to 0 in the previous command if they do not have 25 or more stamina

tired oar
left perch
#

@tired oar oh ok

#

So you think I should add a event to the player entity

#

Its components

#

And make the on entry run a event

tired oar
#

no, just like the controller to the player

left perch
#

You add the controller to the player

#

?

#

@tired oar how

tired oar
#

no, you link it. Add the controller identifier into the list of animations and run it through the scripts component

left perch
#

I did behavior melee attack cooldown 0 3

#

0.3

tired oar
left perch
#

Now theres a java like cooldown

#

@tired oar

#

Is this why my anims never worked???

#

The people in bridge never told me this

#

Ive been trying to get anims work for about a month now

tired oar
#

You have not added blank into the scripts

#

Look at the site i sent you it has an example of how to run a controller

#

Also a month?? There is so much documentation for beginner devs

#

There are also vanilla files that you could've looked at although you would've needed to known that server and client side animation controllers are linked in the same way

left perch
tired oar
#

"scripts": { "animate": [ "blank" ] }

#

Add that directly below the animations

left perch
#

@tired oar

#

How is it not a valid value

#

I edited the anim

#

To be controller.animation.staminadrain

#

Update

tired oar
#

staminadrian in an alias for the controller and needs to be linked to the controller

#

You have an empty object instead of the controller's identifier

#

You also have two empty objects inside of the scripts?

left perch
#

?

#

@tired oar what?

#

A empty object?

#

Where

left perch
#

I will try to delete them

#

K done

left perch
#

Like do I put the nscp:

#

In that empty object

#

Also Ik what you mean by object now

left perch
#

@tired oar please give me a example

#

@tired oar Nvm

left perch
#

[Molang][error]-My World | /storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/minecraftWorlds/LpefZCR1AwA=/behavior_packs/Nitro'sSim/animation_controllers/stamina_drain_anim.json | animation_controllers | controller.animation.blank | states | default | transitions | punching | v.attack_time=>0.2 | Error: complex expressions (contains either '=' or ';') must end with a ';'

[Molang][error]-My World | /storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/minecraftWorlds/LpefZCR1AwA=/behavior_packs/Nitro'sSim/animation_controllers/stamina_drain_anim.json | animation_controllers | controller.animation.blank | states | jumping | transitions | punching | v.attack_time=>0.2 | Error: complex expressions (contains either '=' or ';') must end with a ';'

[Molang][error]-My World | /storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/minecraftWorlds/LpefZCR1AwA=/behavior_packs/Nitro'sSim/animation_controllers/stamina_drain_anim.json | animation_controllers | controller.animation.blank | states | punching | transitions | default | v.attack_time=<0.2 | Error: complex expressions (contains either '=' or ';') must end with a ';'

[Commands][warning]-Function repeat_function failed to load correctly with error(s):

[Commands][warning]-Error on line 1: command failed to parse with error 'Syntax error: Unexpected ")": at "mina:§e">>)<<,("score":"'

[Commands][warning]-Error on line 2: command failed to parse with error 'Syntax error: Unexpected "}": at "900..1000}>>}<<] speed 9 "'

[Commands][warning]-Function listed in tick.json with name repeat_function not found.

#

@tired oar

tired oar
#

=> is not a comparator, >= is what you are looking for

#

Id recommend just using v.attack_time and !v.attack_time

#

The repeat_function.mcfunction file referenced in tick.json doesn't exist. It is either the wrong path or it has an error in it

#

You made a mistake in the tellraw command

left perch
#

Yeah

#

I fixed the anim