#Script API General

1 messages · Page 107 of 1

livid elk
#

if i store a dynamic property in an entity and then kill it, does the dynamic property will also be permanently removed?

remote oyster
nimble schooner
#

Does anyone have a link to a custom slash command example in javascript?

livid elk
#

check minato custom command builder

nimble schooner
#

Oh wait the wiki has one

distant tulip
livid elk
#

i see, thanks!

warped blaze
#

does anyone know a good way to simulate an elastic movement with applyKnockback/Impulse for entities?, i want to simulate a Black hole and when entities go through its center they do some elastic-like movement

halcyon phoenix
#

LOL HE ASKED YOU 4 TIMES, you gotta be so confused after asked thrice

distant tulip
#

i was

spice finch
#

Is there an easy way to detect when a block is placed and what block is was placed on including if it was placed on the side of said block?

warped blaze
runic maple
#

Sup, how do you like make teleporting instant

#

What am actually trying to do is like a system where left click activates something ,even on air especially for mobile players,
so I made it when you hold an item a mob spawns on your head that if you click it activates the stuff, and I made the mob always to to your head
But it's bad when the player is moving so I calculated the velocity of the player and accounted for drag and stuff to get the location of the player the next tick
But the entity like still lags behind when the player is moving
Sorry for the yap

warped blaze
runic maple
sudden verge
#

it doesnt, it might appear that way because its smoothed by the client side

runic maple
spice finch
sudden verge
halcyon phoenix
runic maple
wary edge
sudden verge
#

why not?

#

parrots can

halcyon phoenix
#

like this

#

this one is a circle

#

don't judge it

wary edge
sudden verge
#

thats not true, i have made an addon that lets players ride other players, so you can get anything to ride players

sudden verge
#

yeah

wary edge
#

Yeah not recommended. Good luck though then.

distant tulip
#

make a custom entity with the parrot_tame family

runic maple
runic maple
runic maple
halcyon phoenix
runic maple
distant tulip
halcyon phoenix
runic maple
distant tulip
#

basically an entity that have the parrot_tame and every entity can ride it
so you make it ride the player and make any other mob ride it
even if the player have a parrot you can just make it ride that entity instead

runic maple
distant tulip
halcyon phoenix
halcyon phoenix
#

I see, thanks

runic maple
drowsy scaffold
#

is Entity.getDynamicProperties not a method?

runic maple
#

Like hurt it?

drowsy scaffold
#

script API be making no sense sometimes man

#

there's a Entity.setDynamicProperties method, which I feel like infers that there's also an accessor to go with it but okay I guess

granite cape
#

day 4 learning ScriptAPI💦

halcyon phoenix
drowsy scaffold
wary edge
#

It's just how and what would it return. We had a previous convo about this either here or in OSS.

#

#879773489601585244 message

halcyon phoenix
drowsy scaffold
#

which yes I can filter and map the dynamic property ids to get what I want from them, but that's not the point of it

#

though I do see the argument against it for the reasons that smokey said above

dusky flicker
#

but i dont think it should exist, what exactly do you expect getting from it?

#

if that existed

#

because for me a way of batching dynamic properties is enough

halcyon phoenix
#

yeah, getDynamicProperty() already exists

#

just loop it through all the Ids

runic crypt
#

How to detect a player head with event entityHurt?

unique acorn
slender bolt
#

How to detect when a player shoots an entity with a specific projectile then plays a command on the player who shot the projectile?

slender bolt
slender bolt
deep quiver
#

Also check if gotHit is still valid

slender bolt
deep quiver
slender bolt
deep quiver
#

Maybe gotHit is already dead

deep quiver
#

Try it again on an entity that survives the shot

slender bolt
deep quiver
#

For what?

slender bolt
#

this line is not a function
const health = gotHit.getComponent('health').currentValue;

deep quiver
slender bolt
deep quiver
#

add an .entity at the end

slender bolt
iron apex
#

Hello everyone! I updated my game to version 1.21.100 yesterday, and all my scripts in my addons stopped working. Does anyone know what's going on?

unique acorn
amber rapids
prisma shard
#

Lmao

amber rapids
halcyon phoenix
round bone
#

I think it's still easier to recreate PVP system rather than modifying it

distant tulip
#

entity hit entity event -> clear velocity

halcyon phoenix
distant tulip
halcyon phoenix
#

Welp I guess I'll just research more of it

stuck ibex
#

Does applyDamage ignore armors?

warm mason
stuck ibex
#

Okay nice

stark kestrel
#

Does anyone have hive/cubecraft/vanilla kb values

#

Updated .applyKnockback

stark kestrel
warm mason
#

So? What do you need?

stark kestrel
#

Like values

#

Mine feels weird

warm mason
#

what values?

stark kestrel
#

...

warm mason
#

You ask for values for applyKnockback, but there could be any values, so I don't understand what you mean.

stark kestrel
#

Horizontal force
VerticalStrength

warm mason
stark kestrel
#

..

#

How do I explain

warm mason
#

you can put a number there, like, from 0 to however many you want

stark kestrel
#

I know

stark kestrel
prisma shard
#
applyKnockback({ x: 0, z: 0 }, 0):``` its used like that read documentation
stark kestrel
#

Wha

warm mason
stark kestrel
prisma shard
#

Oh you mean vanilla entity hit replica values?

stark kestrel
prisma shard
#
let horizontalKB = 0.2789
let verticalKB = 0.1023
let knockbackX = victimLocation.x - attackerLocation.x;
let knockbackZ = victimLocation.z - attackerLocation.z;

const magnitude = Math.sqrt(knockbackX * knockbackX + knockbackZ * knockbackZ);
if (magnitude !== 0) {
    knockbackX /= magnitude;
    knockbackZ /= magnitude;
}
entity.applyKnockback(knockbackX, knockbackZ, horizontalKB, verticalKB);
#

here, i have it here

stark kestrel
#

TYSM

prisma shard
#

wait

#

that wouldnt work

#

uh its old

prisma shard
# prisma shard ```js let horizontalKB = 0.2789 let verticalKB = 0.1023 let knockbackX = victimL...
let horizontalKB = 0.2789;
let verticalKB = 0.1023;

let knockbackX = victimLocation.x - attackerLocation.x;
let knockbackZ = victimLocation.z - attackerLocation.z;

const magnitude = Math.sqrt(knockbackX * knockbackX + knockbackZ * knockbackZ);
if (magnitude !== 0) {
    knockbackX /= magnitude;
    knockbackZ /= magnitude;
}

const horizontalForce = {
    x: knockbackX * horizontalKB,
    y: knockbackZ * horizontalKB
};

entity.applyKnockback(horizontalForce, verticalKB);

#

here's the fixed one

#

@stark kestrel

stark kestrel
opal lantern
stark kestrel
#
  let victimLocation = hitEntity.location;
  let attackerLocation = damagingEntity.location;
  let horizontalKB = 0.2789;
  let verticalKB = 0.1023;
  let knockbackX = victimLocation.x - attackerLocation.x;
  let knockbackZ = victimLocation.z - attackerLocation.z;

  const magnitude = Math.sqrt(knockbackX * knockbackX + knockbackZ * knockbackZ);
  if (magnitude !== 0) {
      knockbackX /= magnitude;
      knockbackZ /= magnitude;
  }
  const horizontalForce = {
    x: knockbackX * horizontalKB,
    y: knockbackZ * horizontalKB
  };

  hitEntity.applyKnockback(horizontalForce, verticalKB);```
warped blaze
# stark kestrel ```js let victimLocation = hitEntity.location; let attackerLocation = damagi...
  let victimLocation = hitEntity.location;
  let attackerLocation = damagingEntity.location;
  let horizontalKB = 0.2789;
  let verticalKB = 0.1023;
  let knockbackX = victimLocation.x - attackerLocation.x;
  let knockbackZ = victimLocation.z - attackerLocation.z;

  const magnitude = Math.sqrt(knockbackX * knockbackX + knockbackZ * knockbackZ);
  if (magnitude !== 0) {
      knockbackX /= magnitude;
      knockbackZ /= magnitude;
  }
  const horizontalForce = {
    x: knockbackX * horizontalKB,
    z: knockbackZ * horizontalKB
  };

  hitEntity.applyKnockback(horizontalForce, verticalKB);```
wooden zealot
#

What wld be an efficnet way to despawn a mob with script

wary edge
wooden zealot
#

Cheers

sleek grove
#

Why when I run player.playSound while in camera does it not work.

#

is it still locational if I just have player.playSound(sound)?

distant tulip
#

wait, player.playSound should do that

cinder shadow
warm mason
cinder shadow
#

can't set it to negative values anymore

#

or 0

warm mason
cinder shadow
#

I don't make the rules

warm mason
#

I need to test this.

sleek grove
cinder shadow
#

yeah, unfortunately sounds have to be played from the camera location

warm mason
sleek grove
#

So if a camera is moving a sound can't move with it

#

bruh

cinder shadow
#

Sounds have never been able to move with the player aside from whatever biome music is doing

#

try defining the sound as music instead, that might work

sleek grove
#

But there are ways to do non-locational sounds right?

#

okay ill try that

cinder shadow
warm mason
sleek grove
spice finch
#

Does anyone have an addon that lets items stack past 64 on the ground? Thought I should ask before I go reinventing something

#

Mainly for lag preventative reasons

livid elk
#

is it possible to get the item damage value?

spice finch
#

Hmm. I know I could get it to work with players picking it up, but getting hoppers and things like that to work is a struggle

wary edge
#

Not possible.

livid elk
#

okay, thanks!

shut junco
cinder shadow
livid elk
#

for my custom crit damage, but i already found another way, i made a list of my custom weapons with their damage values and used it for my crit damage logic

warped blaze
wary edge
#

Whar use case do you have?

warped blaze
#

I don't have one, but there will be people who need it at some point

wary edge
silver agate
#

Can I define more than one ““function”” on custom components? Like, I can define a component with onStepOn and onEntityFallOn?

silver agate
silver agate
#

Nice

#

Also, how can I detect if the block has an optional param(it won’t be on every block with this component)?

if (params.(my_param)) {
…
}```
^
Like this?
buoyant canopy
subtle cove
spice finch
subtle cove
#

Hrmmm indeed bao_panda_munching

sterile epoch
#

do you remove dynamic properties with null or undefined? someone said a while back undefined still keeps it stored

subtle cove
#

setDynamicProperty('prop')

sterile epoch
thorn flicker
#

yeah you can just leave it empty

subtle cove
#

Make a wrapper out of it, ig...

sterile epoch
thorn flicker
sterile epoch
#

alr

night acorn
#

does anyone know how to get the biome at a location? theres no func in stable, but there is dimension.getBiome() but my game keeps saying it doesnt exist (im on 1.21.101, using script api 2.2.0-beta). i even went as far as to use the alpha version but its just gaslighting me at this point

night acorn
#

ohh

#

i need to install preview

#

grate

thorn flicker
#

there's findClosestBiome but it takes time to complete

night acorn
#

pretty sure findClosestBiome searches for a specific biomes location, not the biome at a location

thorn flicker
#

people have used it for this though.

#

however, I dont recommend it

night acorn
#

essentially im making a heat system:

export function getSurfaceCondition(player) {
    let heat = 5;
    let weather = sv.world.getDynamicProperty(consts.DPK_WEATHER);
    if (weather == null) weather == "Clear";
    let biome = player.dimension.getBiome(player.location).id;

    if (weather == "Rain") heat--;
    if (weather == "Thunder") heat--;
    if (!isDay()) heat--;

    if (biome.includes("desert")) heat++;
    if (biome.includes("frozen") || biome.includes("ice")) heat--;
    if (biome.includes("jungle")) heat--;
    if (biome.includes("cave")) heat--;
    if (biome.includes("ocean")) heat--;

    if (biome == "hell") heat = 10;

    return HEATLEVELS[heat];
}
#

and it should be colder in caves oceans and frozen places

thorn flicker
#

yeah ive made a temp system too, just not with numbers.

#

first thing I did when getBiome dropped in preview

night acorn
#
const HEATLEVELS = [
    "§b§lFrigid",  // 0
    "§bFrosty",    // 1
    "§9Chilly",    // 2
    "§3Cold",      // 3
    "§2Neutral",   // 4
    "§6Warm",      // 5
    "§6Hot",       // 6
    "§eBoiling",   // 7
    "§cSearing",   // 8
    "§4Furnace",   // 9
    "§4§lHELL"     // 10
]
thorn flicker
#

I have 4 types

#

hot, warm, cold, freezing

night acorn
#

simple

#

functional

thorn flicker
#

I like simple

night acorn
#

im making a mod where the sun hurts you

#

the hotter it is, the more damage it does

#

so you have to stay under shade

#

or underground or wear helmets that degrade

thorn flicker
#

so what, a vampire addon?

night acorn
#

i guess

#

just without any bloodsucking

#

or bats

thorn flicker
#

lol

#

cool, I just created a system, its not part of anything yet

#

ill think of something

night acorn
#

it shows whenever its the first time surfacing that day

solar dagger
#

is there a way to change the player's seat position through script?

halcyon phoenix
solar dagger
stuck ibex
#

How does this work?

world.afterEvents.itemReleaseUse.subscribe((data) => {
  console.warn(data.useDuration / 20 / 60);
})
#

I can't seem to get it to format into seconds

wary edge
stuck ibex
#

wait isn't it suppose to be 1000

unique acorn
#

20 ticks = 1 second

#

I don't think script api uses miliseconds anywhere

stuck ibex
#

It's returning arbitrary numbers, but nevermind, I was going to track how charged the arrow is but I'll just use the velocity of the arrow

subtle cove
prisma shard
prisma shard
# thorn flicker undefined

In the .setDynamicProperty() function, trying to set undefined doesn't actually remove the value. It works and actually removes the Key, only when, setting it to null OR you can just leave the parameter and don't fill it up, like world.setDynamicProperty("key") and the value will be deleted.

prisma shard
unique acorn
prisma shard
#

xdxd

distant tulip
prisma shard
distant tulip
#

you can confirm with nbt

prisma shard
#

I need to confirm that

woven loom
#

Whats going on

thorn flicker
prisma shard
#

yeah

thorn flicker
#

how about you go do that

prisma shard
#

Let's ask him

#

Alr..

thorn flicker
#

im curious

distant tulip
woven loom
#

Oh

thorn flicker
#

since you are scripting leader you should know right /j

prisma shard
#

xd fr

distant tulip
#

the doc itself says undefined remove it
it doesn't

prisma shard
#

hmm lets check the changelogs

#

Update 1.21.40

  • Removed function removeDynamicProperty - Please use setDynamicProperty with a value of undefined to remove a property
#

Yeah, I'm sorry guys

#

I was wrong, I wanna test though with a NBT editor, It's interesting

thorn flicker
#

better to do these things before correcting someone

distant tulip
thorn flicker
distant tulip
#

yeah, even
p.setDynamicProperty('test3')

thorn flicker
#

yeah.

woven loom
#

Can we spawn simulated players directly in the stable version?

thorn flicker
thorn flicker
distant tulip
#

np

subtle cove
distant tulip
#

@woven loom not yet

thorn flicker
distant tulip
#

yeah

thorn flicker
#

I might use this now

distant tulip
#

same

hazy nebula
#

is there anyway to teleport a entity to player location and follow player direction view?

#

stable api or beta api

thorn flicker
#

or if you mean make them face towards the player, just change facingLocation to the player's location.

#

this is stable.

distant tulip
hazy nebula
thorn flicker
thorn flicker
#

make the entity look where the player is looking?

thorn flicker
#

you have to spam the method.

#

it wont magically follow after 1 teleport.

#

entity.teleport(player.location, {rotation: player.getRotation()})

#

ofc this will make the entity unable to move

proper pumice
#

is it possible to spawn a block break particle with a chosen texture?

#

or it'll be better to create a custom emiter that mimics that behavior instead?

woven loom
#

Nope afaik

livid elk
distant tulip
woven loom
#

U can also use old Universal Minecraft Editor

livid elk
#

okay, thanks!

livid elk
woven loom
#

Ye

lucid dust
#

how do i get a 2nd script file to run that's not the main.js?

unique acorn
lucid dust
#

wait u don't need to restart ur world?

unique acorn
#

you do

#

well idk, before you didn't need to now you need to?

lucid dust
# unique acorn you do

no but i meant u said u need to restart ur world which implies that sometimes u don't need to

unique acorn
#

you have to do this everytime you create a new file

lucid dust
#

still says not found :/

narrow lintel
#

Hello, how to return launched projectile like trident's loyalty, anybody can give me a script?

prisma shard
amber granite
#

What s new in script api ?

unique acorn
unique acorn
prisma shard
amber granite
#

:-:

#

I mean is there anything interesting that got added ?

prisma shard
#

Hmmmm

#

Idk really

amber granite
#

:-:

halcyon phoenix
halcyon phoenix
halcyon phoenix
#

you can just use projectileHitEntity and projectileHitBlock

amber granite
halcyon phoenix
narrow lintel
umbral dune
#

Is it possible to fetch the texture of a block using scripts?
Is the texture of an item/block accessible via script?

umbral dune
#

hmmmmm thx :]

round bone
#

A path to a texture, or blob of a texture?

umbral dune
#

a blob

round bone
#

Not possible then

#

Consider using BDS loaders like Endstone or LeviMC then

umbral dune
#

Have custom biomes arrived in the stable version yet?

#

I didn't pay much attention

round bone
#

Yes.

#

They were added in 1.21.80 or 1.21.90, I might be incorrect; but still, it's 1.21.100 already.

umbral dune
#

ok thx :)

round bone
#

No problem.

umbral dune
#

How to know the recipe of an item via script? Especially items from other add-ons

unique acorn
#

you can't

umbral dune
#

I was waiting for an answer like that.

#

thx

#

any news about tile entities?

warm mason
umbral dune
#

last time I checked we didn't have support for this

warm mason
#

ah, you mean something like a custom chest? If yes, there are still no improvements in this direction :/

round bone
granite cape
#

🛌 mc_fox_sleeping

wary edge
#

New preview btw.

round bone
umbral dune
#

Is it possible to keep a chuck updated via script?

distant tulip
coral ermine
#

why player.playSound() never works for me? No errors but still doesn’t play the sound

dusky flicker
#

@merry cove

lavish surge
north frigate
#

is there a way to have multiple threads in the Script API?

north frigate
round bone
umbral dune
warm mason
umbral dune
#

-# note: this is a javascript issue, not minecraft

snow apex
#

does anyone know of anywhere i can get a movement detection script? just need a basic one and wondering if there is a resource with a template

round bone
gaunt salmonBOT
halcyon phoenix
#

check #1067535712372654091 for template, I doubt it exists

warped blaze
#

so what's the utility for .getBlockStandingOn()?

#

i mean, isn't it like
Dimension.getBlock(Entity.location).below()?

#

ig it would be for entites with big hitboxes, that's the reason for .getBlocksStandingOn() afaik

thorn flicker
#

also its getAllBlocksStandingOn()

thorn flicker
#

the block will return undefined if you are flying above it when using getBlockStandingOn() unless you are sneaking

#

and when it comes to paths, using getBlock(Entity.location).below() will return the block under the path.

#

You could just do {x: pl.x, y: pl.y - 0.1, z: pl.z} instead to fix the path issue.

#

either way, I rather use the method that tells you when the game recognizes you actually standing on a block.

short barn
#

QQ, are entity custom components a thing yet?

thorn flicker
short barn
thorn flicker
short barn
#

😔, thanks anyway

halcyon phoenix
halcyon phoenix
thorn flicker
thorn flicker
halcyon phoenix
thorn flicker
halcyon phoenix
thorn flicker
#

entityHurt beforeEvent would be better.

halcyon phoenix
#

but you know boyh would be nice

distant tulip
#

it has been answered, my bad

halcyon phoenix
#

allgoods

thorn flicker
warm mason
#

👀

distant tulip
#

discord didn't show the "x new messages" thing

untold magnet
#

ummm, what is this used for exactly? PlayerSwingEventOptions

#

detecting when the player swing its arms?

warm mason
#

left click detection I guess

untold magnet
#

Added class PlayerSwingStartAfterEvent to beta. This contains information regarding a player starting to swing their arm

distant tulip
#

it detect every swing, left or right click, it doesn't matter

untold magnet
#

Added class PlayerSwingStartAfterEventSignal to beta. This event is fired at the start of a player's swing (e.g. attacking, using an item, interacting). It can be subscribed/unsubscribed via world.afterEvents.playerSwingStart and optionally filtered by passing in PlayerSwingEventOptions.

#

jeez, thats extremely useful, that will make my ||""""""|| addon way better

woven loom
distant tulip
junior shadow
#

Only thing I could think of was for more exact timing with combat type addons. Curious to see how it gets used and why

alpine ibex
#

Custom form or Message Form 😜🙏

warm mason
#
const menu = new ModalFormData();
menu.button('test1');
menu.label('text');
menu.button('test2');
livid elk
#

is there a way to stop player from sprinting?

warm mason
livid elk
#

how?

warm mason
#

Well, in theory you need to change the value of movement component

#
player.getComponent('movement').setCurrentValue(1);
#

but you need to calculate the speed yourself, which will be without sprinting

narrow lintel
#

Hello, can someone tell me how to scale player at 0.01 when it riding any mob?

livid elk
#

wait, you can change component values, or only for some components?

warm mason
#

as i remember sprint gives +20% to speed so... try ```js
const movement = player.getComponent('movement');
movement.setCurrentValue(movement.currentValue / 1.2);

narrow lintel
warm mason
livid elk
narrow lintel
woven loom
#

try scale component

narrow lintel
woven loom
#

other vvalues woeking fine ?

narrow lintel
distant tulip
warm mason
distant tulip
#

Why do yon need to take into account the sprinting speed when you are disabling it

warm mason
distant tulip
#

That just slow the player down even with speed effects

warm mason
distant tulip
#

No, i know my version does the same.
If speed effects is that important you will have to figure out the formula the player speed increase when speed effect increases

#

Hopefully it is lineare

warm mason
#

Well, we need to see how it will work. For example, I have the speed set every tick taking into account the effects, sprint + my additional modifiers

livid elk
#

how can i detect if the player move left/right? like if the player moves right - run something, if left - run something

warm mason
#
const vector = player.inputInfo.getMovementVector();
livid elk
#

thanks

rigid torrent
#

Can I check when a player opens and closes an entity inventory?

subtle cove
#

bp animation, maybe

#

theres no script-api method for it iirc

rigid torrent
#

Oof

cinder shadow
#

wouldn't that just be interactWithEntity?

subtle cove
#

then spam a form for when player closed the inventory ui...

#

its good approach, but it has its bugs. the choice is on the scripter

rigid torrent
#

I'm testing this method

#

I think the inventory closes the form

cinder shadow
#

is it a vanilla entity? or a custom entity

rigid torrent
#

Custom entity

cinder shadow
#

Why can't you use the interactWith event then?

rigid torrent
#

How can I test when the inventory is closed after the first interaction with that?

cinder shadow
#

good point. We don't have a player.isInUi option lol

#

you could check for the player not moving, but that might not be great

#

I have an idea, let me try something

rigid torrent
#

WhAt iF tHe PlAyEr iS iN mOvInG wAtEr

#

lol

rigid torrent
#

Testing the form method, but is not working as I wish

cinder shadow
#

I have a moment to test my idea hold on

#

unfortunate

#

these were finger crossed copium tests

#

I tried checking whether the player input controls are disabled when going into a ui and whether the hud ui elements are changed to true for onScreenDisplay.isForcedHidden();

#

unfortunately neither of these are effected when going into ui or doing anything else

rigid torrent
#

oof

#

And the form method won't work neither

#

I think the best bet is the movement

cinder shadow
#

it depends on what you're using it for

distant tulip
#

not script api but there is an entity filter

#

has_container_open

cinder shadow
#

yeah, there's literally the is_in_ui thing isn't there?

#

oh

rigid torrent
cinder shadow
#

I have one more thing to check

open urchin
distant tulip
#

it is

cinder shadow
#

darn

#

Yeah I think you either have to do that or check for player movement

#

Tried to see if I could "open" a form for the player and just have it returned as true/false

#

it did not work

rigid torrent
#

yeah no it doesnt work

#

trying the container thing now

distant tulip
cinder shadow
#

Yeah but it's not going to return a true or false

#

it's just always going to open up

distant tulip
#

you can use useBusy to confirm it didn't open, and if it did open close it
not the best thing tho

untold magnet
#

hmmm,

#

@distant tulip u great at math?
tryin' to make a temperature system, but apparently it requires alot of math for some reason,

distant tulip
#

i wouldn't say great but i am alright

cinder shadow
#

chatGPT is really good at math

#

sometimes

distant tulip
#

if you know what to ask and how to ask

rigid torrent
#

and when to ask

#

because is down

#

is appeared on my instagram for some reason

distant tulip
#

it is not

rigid torrent
#

not for everyoe i assume

untold magnet
rigid torrent
#

I am running the event 3 seconds after interaction with the entity, this is the event:

"kai:poll_container": {
                "sequence": [
                    {
                        "filters": {
                            "test": "has_container_open",
                            "subject": "player",
                            "operator": "equals",
                            "value": true
                        },
                        "sequence": [
                            { "set_property": { "kai:open": true } },
                            { "queue_command": { "command": ["playanimation @s open", "say open"] } }
                        ]
                    },
                    {
                        "filters": {
                            "test": "has_container_open",
                            "subject": "player",
                            "operator": "equals",
                            "value": false
                        },
                        "queue_command": {
                            "command": ["say closed"]
                        },
                        "trigger": {
                            "event": "kai:chest_close",
                            "target": "self"
                        }
                    }
                ]
            }

And even though the event is being ran successfully(console warns says), the debug say commands are not triggered. Any ideas?

#

Script:

import { world, system } from "@minecraft/server";

const POLL_EVENT = "kai:poll_container";

world.beforeEvents.playerInteractWithEntity.subscribe((event) => {
    const { player, target } = event;

    if (target.typeId === "kai:dead_chest") {
        console.warn(`${player.name} interacted with a chest. Event will trigger in 3 seconds.`);

        system.runTimeout(() => {
            try {
                target.triggerEvent(POLL_EVENT);
                console.warn(`Event '${POLL_EVENT}' triggered on ${target.id} after delay.`);
            } catch (error) {
                console.error("Failed to trigger event due to a script error.", error);
            }
        }, 60);
    }
});
rigid torrent
#

say open and say closed

wary edge
#

Ah Wait hang on. You're trying to make a pseudo chest yeah?

rigid torrent
#

Yeah

wary edge
#

I didn't have the closing animation but

world.beforeEvents.playerInteractWithEntity.subscribe((eventData) => {
    if (eventData.target.typeId != 'toycat:fake_chest') return;

    system.run(() => {
        eventData.target.playAnimation('animation.fake_chest.open');
        system.runTimeout(() => {
            eventData.target.playAnimation('animation.fake_chest.close');
        }, 100);
    });
});
``` I had this.
rigid torrent
#

But that will make it close after 5 seconds no?

#

Ideally I wanted it to close after the container was closed

untold magnet
#

it will

untold magnet
untold magnet
rigid torrent
#

yeah

untold magnet
#

i thought u are missing that, anyways

wary edge
rigid torrent
#

I tried doing it even after 15 seconds but nothing

#

I feel like the problem is on the event

#

And even though, if it checks it before it should say in chat the word closes

untold magnet
#

yeah the script are fine

wary edge
#

Try putting that check inside the interact component instead.

rigid torrent
#

I'm not using the interact component, if I do, I would need to interact twice with the chest for it to open the inventory

untold magnet
rigid torrent
#

Yes

#

I also did tried running the event through timer and is not saying none of the say commands

untold magnet
#

what about triggering an entity event using scripts? 20x per second

#

will it has the same lag as the timer?

rigid torrent
#

I think whathever problem is on the event needs to be fixed first

untold magnet
#

hmmm

rigid torrent
#

I'm not sure of why

#

I just know it happens

wary edge
#

Youre approaching this wrong Kai.

rigid torrent
#

Did you read the last part?

wary edge
#

Use the interact component to set the property to true and play animation and use entity sensor to close itself.

untold magnet
untold magnet
#

that might keep spamming the commands tho, so u only need it for the close thing

rigid torrent
wary edge
#

Check the piglin code.

rigid torrent
#

I made it! Thanks

#

Works perfectly

#

Still, dont use minecraft:interact + minecraft:inventory

#

Requires double interact

untold magnet
rigid torrent
#

No idea at all

#

I just replaced interact with a script, way better

untold magnet
#

anyways, d u have any suggestions about how am i going to make a temperature system?

#

cuz idk from where i should start,

rigid torrent
#

Do you already know how you want it to work?

untold magnet
# rigid torrent Do you already know how you want it to work?

yeah, hot biomes will increase the player temperature, cold biomes will decrease it,
light armor (leather, chain) will make u cooler
heavy armor (iron, gold, etc) will make u hotter
heavy armor with fire resistance will make u feel somewhere cooler, depending on the enchantment level

#

and standing nearby lava/fire/magma will increase the temperature,
standing inside water will decrease the temperature

#

hot biomes are hot during daytime and cold during nighttime,

#

overall, complicated asf, and im completely lost idk from where i should start

rigid torrent
#

I think a script for checking player surroundings would be a good start

untold magnet
alpine ibex
#

When before hurt event 🗿

untold magnet
alpine ibex
grim raft
#

Yo how can I display a scoreboard on sidebar

untold magnet
untold magnet
#

then ill use 4 itemStakcs for each part, and get the enchantments of each one

#

afaik, loops will slow the interval at somepoint, so im trying to avoid using it

#
  • i already have to detect each part individually so i can do better math
umbral dune
#

Excuse me, how are you getting the enchantments so far?

untold magnet
umbral dune
#

referring to the loop you mentioned

untold magnet
#

im not using any loops

kind zenith
#

100.000 TH MESSAGE

north frigate
regal folio
#

I need help

#

#1407574751370678495

flat barn
#

Is there any recreations of vanilla boss bar?

spice finch
#

is there a way to detect players hitting entities like "world.afterEvents.entityHurt", but doesn't have the delay between registering hits?

warm mason
spice finch
distant gulch
#

Is there any way to fix this error?

unique acorn
distant gulch
lucid dust
#

What would be the best way to detect a block update?

thorn flicker
lucid dust
#

Ah

#

shame

thorn flicker
#

not yet anyway

strong oar
#

Does anyone have a better suggestion for my code or modification.

subtle cove
#

ohboi

distant tulip
#

oh boi indeed

strong oar
#

😅

thorn flicker
#

separate world initializes for each custom component

#

...

subtle cove
#

w8, ima send a function

strong oar
thorn flicker
#

bro hearted my message like its a good thing

#

lol

distant tulip
#
world.afterEvents.playerInteractWithBlock.subscribe(e => {
    const { player, block, dimension } = e;

    const variant = block.permutation.getState("goobli:variant");
    if (variant === undefined) return;

    const toolComp = player.getComponent("equippable");
    if (!toolComp) return;
    const tool = toolComp.getEquipment("mainhand");
    if (!tool) return;

    if (tool.typeId === "gooblideco:goobli_screw") {
        let newVariant = variant === 0 ? 1 : 0;
        block.setPermutation(block.permutation.withState("goobli:variant", newVariant));
        dimension.spawnParticle("goobli:place_effect", block.center());
        dimension.playSound("item.bone_meal.use", block.center());
    }
});
thorn flicker
#

minato back with the spoon

#

/j

distant tulip
#

come on

thorn flicker
distant tulip
#

was about to fix the whole thing, but it is basically the same

subtle cove
#

edible enuf ;-;

strong oar
thorn flicker
#

because you are subscribing to an event listener multiple times when you do not need to.

distant tulip
#

the only really bad thing was using switch for one case switch
just use if statement. also you are repeating codes a lot

thorn flicker
#

only bad thing

#

lmao

warm mason
#

🍿 👀

thorn flicker
#

smacks popcorn out of serty's hand

distant tulip
thorn flicker
#

so rude for me discouraging bad practices

strong oar
thorn flicker
#

im just joking with minato

distant tulip
thorn flicker
#

you fixed it

#

thank you

thorn flicker
#

serty deserves it though

#

lets be real

#

he roles his eyes because its the truth

warm mason
#

I'm just drinking tea with cookies and I'm lazy to type

thorn flicker
#

what kind of cookies

thorn flicker
subtle cove
# strong oar Does anyone have a better suggestion for my code or modification.
import { BlockStates, system } from "@minecraft/server";


function clockVariantPermutation(permutation, stateId) {
    const newState = (permutation.getState(stateId) + 1) % BlockStates.get(stateId).validValues.length;
    return permutation.withState(stateId, newState);
};

system.beforeEvents.startup.subscribe(eventData => {

    const customComponents = Array.from({ length: 15 }, (_, i) => `goobli:change${i + 2}`);
    
    for (const componentId of customComponents) {
        eventData.blockComponentRegistry.registerCustomComponent(componentId, {
            onPlayerInteract: e => {
                const { player, block, dimension } = e;
                const tool = player.getComponent('equippable').getEquipment('Mainhand');

                if (tool && tool.typeId === 'gooblideco:goobli_screw') {
                    const newVariant = clockVariantPermutation(block.permutation, "goobli:variant");
                    block.setPermutation(newVariant);
                    dimension.spawnParticle("goobli:place_effect", block.center());
                    dimension.playSound("item.bone_meal.use", block.center());
                }
            }
        });
    }
    
});```
thorn flicker
#

i guess ill never know

#

yooo, remember m9 with the superior spoonfeed

#

@distant tulip you got a competitor

warm mason
subtle cove
#

w8, so whos chef

thorn flicker
#

you are the chefs that hold the spoon and feed the people

warm mason
thorn flicker
#

oh hell no

subtle cove
#

special iNgRiDiEnT

thorn flicker
#

never ask m9 to help with script ever again

distant tulip
thorn flicker
distant tulip
thorn flicker
#

freaky ass scripting

warm mason
thorn flicker
#

yeah you gotta use setVector3

warm mason
subtle cove
#

so viewDir....

warm mason
#

also, you don't need to add variable to the name

distant tulip
#

lol, he did say not tested

thorn flicker
#

eye rolling serty

#

=

#

you right

wary edge
#

Calm down with the damn reaction spam.

warm mason
#

ok

thorn flicker
#

lmao

thorn flicker
subtle cove
#

@strong oar also remember that BlockStates is like a library of state values

#

ngl, for the clockVariantPermutation function I was abt to get the last value from validValues as reference of max, but ai suggested % values.length

subtle cove
#

auto completion bot...

thorn flicker
#

ah.

strong oar
whole sable
#

is it possible to add dynamicproperty to item?

whole sable
#

thank you

warm mason
gaunt salmonBOT
# subtle cove

Debug result for [code](#1067535608660107284 message)

Compiler Result

Compiler found 2 errors:

vanillaItemsDynamicPropertyEligibles.js:1:1 - error TS2304: Cannot find name 'mc'.

1 mc.ItemTypes.getAll().filter(t => {
  ~~

``````ansi
vanillaItemsDynamicPropertyEligibles.js:3:13 - error TS2304: Cannot find name 'mc'.

3         new mc.ItemStack(t).setDynamicProperty(t.id, 1);
              ~~

Lint Result

There are no errors from ESLint.

halcyon phoenix
halcyon phoenix
#

never ever again

#

he'll give the best code that you won't even understand it

subtle cove
#

setDynamicProperty on uneligibles throws error, thats why

halcyon phoenix
#

LMAO

round bone
distant tulip
subtle cove
#

straight to setDynamicProperty is more accurate

round bone
#
import { ItemTypes, ItemStack } from "@minecraft/server"

const canSetDynamicPropertyOn: Readonly<Set<string>> = new Set<string>(
  ItemTypes.getAll().filter(({ id: typeId }) => !(new ItemStack(typeId, 1).isStackable))
)
stuck ibex
#

Hey @shy leaf, thought that you're the right person to ask-have you made a custom damage system for projectiles before?

halcyon phoenix
round bone
shy leaf
stuck ibex
shy leaf
#

iframes

#

its quite complicated

stuck ibex
shy leaf
#

ill get back to you in a few minutes

stuck ibex
#

Okay nice, no rush

shy leaf
#

can you tell me what youre doing btw

#

just wondering

stuck ibex
#

Basically rebuilding vanilla damage system but combining my own stuff

shy leaf
#

i see

shy leaf
#

you can refer to the wiki, though its slightly different in bedrock edition (and its somehow not noted in the page)

stuck ibex
shy leaf
#

nah, runTimeout is not reliable for this

#

for whatever reason, script environment doesnt 100% sync with ingame environment

#

especially when it comes to ticks/time

stuck ibex
#

So I need to use realtime?

shy leaf
#

thats even worse

#

instead, try storing currentTick in the entity whether by writing in memory or DP

#

and then compare ticks

shy leaf
#

now that i think about it

#

if youre using applyDamage for this, it probably doesnt matter

stuck ibex
#

Yeah I am using that

shy leaf
#

yeah i think it doesnt matter

#

soz

#

you said youre recreating vanilla combat, right?

stuck ibex
#

Yeah

#

but with custom stuff

shy leaf
#

i see

shy leaf
stuck ibex
#

Okay thanks for the advice. Although dealing with another problem with projectiles because there isn't beforeEvent for projectileHit 😬 Mojang when 🙏

shy leaf
#

😔

subtle cove
subtle cove
#

U can modify the projectile before it hits anything

#

There's only a few properties tho

stuck ibex
subtle cove
#

I don't think it has access to item, so u gota make a map for it ig

stuck ibex
wary edge
#

I used that to track bows.

stuck ibex
#

Oh wait yeah, gosh, thank you, this will surely work

untold magnet
distant tulip
#

You can

untold magnet
#

bec this Boots?.setLore(['Test']); doesnt work (setting lore for specific boots)

distant tulip
#

Yeah, and give the player/container the item back

untold magnet
#

ohh i see

untold magnet
distant tulip
#

Nope

untold magnet
# distant tulip Nope

changing the item name and use \n will make lore-like string under the item name, but it will be visible always, right?

#

-# making sure.

distant tulip
untold magnet
#

then ill stick with setLore

untold magnet
#

meh, it will make the naming thing messy

distant tulip
#

Players shouldn't have to deal with that

silver agate
#

This script is nothing working. Does absolutely nothing. I suspect it is the is_shifting…


import { world, system, EquipmentSlot, ItemStack, GameMode } from "@minecraft/server";

world.afterEvents.playerInteractWithBlock.subscribe((e) => {
    const { player, block } = e;
    const {x, y, z} = block.location;
    const chance = Math.random();
    const grassBlocks = [
    "minecraft:short_grass",
    "minecraft:tall_grass",
    "minecraft:fern",
    "minecraft:large_fern"
];
const vineBlocks = [
    "minecraft:vine",
    "minecraft:twisting_vines",
    "minecraft:weeping_vines"
];

    if ( grassBlocks.includes(block.typeId) && player.isSneaking) {
        let fiberCount = 0;
        if (chance < 0.1) {
            fiberCount = 3;
    } else if (chance < 0.3) {
        fiberCount = 2;
    } else if (chance < 0.65) fiberCount = 1;
    if (fiberCount != 0) block.dimension.spawnItem(new ItemStack("sca:small_fiber",fiberCount), block.location);
    block.dimension.runCommand(`setblock ${x} ${y} ${z} air destroy`);
    } else if (vineBlocks.includes(block.typeId) && player.isSneaking) {
        let fiberCount = 0;
        if (chance < 0.3) {
            fiberCount = 2;
        } else if (chance < 0.75) fiberCount = 1;
        if (fiberCount != 0) block.dimension.spawnItem(new ItemStack("aca:big_fiber", fiberCount), block.location);
        block.dimension.runCommand(`setblock ${x} ${y} ${z} air destroy`);
    }
    return;
});```
cinder shadow
#

I don't see an is_shifting

snow knoll
#

Yh, that's what i thought

snow knoll
gaunt salmonBOT
small cloak
#

Can you even get an entity's collision box? I can't find anything in the docs.

sharp elbow
#

Not directly, but technically you can.

#

Find a fixed point offset from the entity, then cast an axis-aligned ray towards the entity. The hitbox width is approximately offset - distance

#

Similar deal with the height; find a fixed vertical offset from the entity, then cast a ray downward.

#

You may want to fiddle with the difference some, I think it can be 0.1 meters off

#

You may find this interesting @small cloak @wary edge

umbral dune
#

I wish add-ons had more freedom with what they can do.

wary edge
small cloak
sharp elbow
small cloak
#

I just wish there was a better way to do this. Doing a couple raycasts is a bit jank.

wary edge
small cloak
#

There's a mob spawning experiment?

wary edge
#

Theres been a qna where they want to rework the mob spawning and whrn v2 first released there were a bunch of scripting stuff related to mob spawning.

small cloak
#

Interesting.

#

I guess I'll just have to deal with raycasts for now.

#

I had to make my own AABB class too because BlockBoundingBox didn't work as expected.

chrome gyro
#

Is there a way to do a forEach after using getBlocks for a volume area?

cinder shadow
#

anyone remember what hte difference between healthComponent.defaultValue and .effectiveMax were?

cinder shadow
thorn flicker
cinder shadow
#

yeah, I think everytime I've looked at it I straight up avoided using that call because it just looked like a convoluted mess

chrome gyro
#
        const blocks = player.dimension.getBlocks( area, { includeTypes: [ `cnb_inb:essence_block` ] })
        console.error(blocks.location)
        if (blocks == undefined) return;
            blocks.forEach((block) => {
                const loc = block.location
                player.runCommandAsync(`fill ${loc.x} ${loc.y} ${loc.z} ${loc.x} ${loc.y} ${loc.z} cnb_inb:essence_block["cnb_inb:invis"= 2]`)
            });

Here's what I have so far if it helps.

chrome gyro
thorn flicker
chrome gyro
#

I'm going to have to think about this one for a while too XD. Might try it tomorrow when I'm more awake.

small cloak
#

@sharp elbow @subtle cove Thanks for the help. I got it working.

#

As you mentioned, the size is a bit off, but I don't really need perfect accuracy.

silver agate
silver agate
snow knoll
silver agate
#

maybe the after event?

thorn flicker
#

yes.

#

the afterEvent wont trigger because the grass blocks are not interactable.

#

use beforeEvents.

thorn flicker
halcyon phoenix
small cloak
#

Working on portals.

safe stream
#

Is there a way to spawn a is_summonable false entity via scriptAPI?

thorn flicker
amber nest
#

How do i make my entity spin

amber nest
#

Thx

round bone
#

Run a interval and change entity's rotation

narrow lintel
#

Hey devlopers, can we make hold release use button event like bow? If anybody know how to do, can you help please? 🙏

buoyant canopy
#

we can't use rawtext for custom command descriptions?

stuck ibex
#

I am not really sure why they dont automatically support that

#

been like that for setLore until recent changes

strong oar
#

does anyone have bedrock documentation for the 1.18.0 module in minecraft/server?

distant tulip
subtle cove
distant tulip
#

was, not sure if it still do

warped blaze
buoyant canopy
warped blaze
buoyant canopy
#

@warped blaze @distant tulip It works!

warped blaze
#

nice

buoyant canopy
#

It adds a little awkward whitespace before the command description tho

warped blaze
#

minato said "space or something is needed"

buoyant canopy
#

That's the same thing i thought about

#

it worked, i added §.

buoyant canopy
subtle cove
#

so u can font-format the translated key there...

warped blaze
buoyant canopy
#

§. works fine

buoyant canopy
steep hamlet
#

whats the difference between usingblock.setPermuation(block.permutation.withState()) and using BlockPermutation.resolve()

subtle cove
steep hamlet
#

ohh

#

it makes sense the first one didnt work on permutationToPlace in beforeOnPlayerPlace

#

thanks

strong oar
#

i am having the same concerns, thanks for that answer

subtle cove
steep hamlet
#

your variant works fine though :D

subtle cove
#

thats great then

strong oar
#

May I ask because I also have the same topic (super duper identical)

subtle cove
#

just ask

#

if it feels like it'll take super duper long conv, then make a post

sly valve
subtle cove
#

fine...

sly valve
#

Good M9

subtle cove
#

should that behave like tall grass, vines, pillar or what?

strong oar
#

like tall grass

subtle cove
#

onPlayerBreak could work, but not when the block gets moved/destroyed by piston/explosion

strong oar
#

i tried to use it before but nothing happens still the same, maybe because it is for 2.0.0? Because i am using 1.18.0 module version

subtle cove
#

onPlayerDestroy

#

this one's from 1.18.0

strong oar
subtle cove
strong oar
#

in vs code?

subtle cove
#

add a package.json file containing {}

strong oar
#

thanks I am going, to try it out

subtle cove
#

then choose any package

silver agate
cinder shadow
#

Has anyone ever ran into an issue where when the player alive, it's meant to do one thing, and when the player dies, it's meant to stop that thing, but instead of stopping that thing, it pauses it until the player has respawned?

#

I have a stamina system that only drains stamina when the player is sprinting, when the player dies, it should stop. However, it pauses it entirely and the second the player respawns it drains their stamina. What's even weirder is that whether this happens or not depends on the time that the player had paused their game or not. Pausing the game and unpausing affects all of the tick intervals and can throw them off.

if (player.isSprinting && !player.isGliding && !player.__staminaDraining && currentHealth > 0) {
        if (currentStamina > 0) {
            player.__staminaDraining = true;
            world.sendMessage(`${player.__staminaDraining} ${currentHealth} ${player.isSprinting}`)
            drainStamina(player, currentStamina, staminaDrainAmount);
            system.runTimeout(() => {
                player.__staminaDraining = false
            }, 5);
            player.__staminaGainTimer = 20;
        }
        else {
            player.addEffect('slowness', 60, { showParticles: false, amplifier: 1 });
        }
    }```
thorn flicker
silver agate
#

Same error message

thorn flicker
#

you are doing it wrong then

lapis heart
silver agate
#

No, I didn’t

#

I looked better now

lapis heart
#

make it:


        system.run(() => {
   //code
        })

silver agate
#

Here is the code:


import { world, system, EquipmentSlot, ItemStack, GameMode } from "@minecraft/server";
world.beforeEvents.playerBreakBlock.subscribe((e) => {
    const { player, block } = e;
    const {x, y, z} = block.location;
    const chance = Math.random();
    const grassBlocks = [
        "minecraft:short_grass"
    ];
    const vineBlocks = [
        "minecraft:vine"
    ];
    const isCreative = player.matches({gameMode:GameMode.Creative});

    if ( grassBlocks.includes(block.typeId) && player.isSneaking) {
        let fiberCount = 0;
        if (chance < 0.1) {
            fiberCount = 3;
    } else if (chance < 0.3) {
        fiberCount = 2;
    } else if (chance < 0.65) fiberCount = 1;
    system.run(() => {
    block.dimension.spawnItem(new ItemStack("sca:small_fiber",fiberCount), block.location);
    });
    block.dimension.runCommand(`setblock ${x} ${y} ${z} air`);
    } else if (vineBlocks.includes(block.typeId) && player.isSneaking) {
        let fiberCount = 0;
        if (chance < 0.3) {
            fiberCount = 2;
        } else if (chance < 0.75) fiberCount = 1;
        system.run(() => {
        block.dimension.spawnItem(new ItemStack("sca:big_fiber", fiberCount), block.location);
        });
        block.dimension.runCommand(`setblock ${x} ${y} ${z} air`);
    }
    return;
});```
thorn flicker
lapis heart
# silver agate Here is the code: ```js import { world, system, EquipmentSlot, ItemStack, GameM...

import { world, system, EquipmentSlot, ItemStack, GameMode } from "@minecraft/server";
world.beforeEvents.playerBreakBlock.subscribe((e) => {
    const { player, block } = e;
    const {x, y, z} = block.location;
    const chance = Math.random();
    const grassBlocks = [
        "minecraft:short_grass"
    ];
    const vineBlocks = [
        "minecraft:vine"
    ];
    const isCreative = player.matches({gameMode:GameMode.Creative});

    if ( grassBlocks.includes(block.typeId) && player.isSneaking) {
        let fiberCount = 0;
        if (chance < 0.1) {
            fiberCount = 3;
    } else if (chance < 0.3) {
        fiberCount = 2;
    } else if (chance < 0.65) fiberCount = 1;
    system.run(() => {
    block.dimension.spawnItem(new ItemStack("sca:small_fiber",fiberCount), block.location);

    block.dimension.runCommand(`setblock ${x} ${y} ${z} air`);
        });
    } else if (vineBlocks.includes(block.typeId) && player.isSneaking) {
        let fiberCount = 0;
        if (chance < 0.3) {
            fiberCount = 2;
        } else if (chance < 0.75) fiberCount = 1;
        system.run(() => {
        block.dimension.spawnItem(new ItemStack("sca:big_fiber", fiberCount), block.location);

        block.dimension.runCommand(`setblock ${x} ${y} ${z} air`);
                });
    }
    return;
});

#

You should also put runCommand in system.run.

silver agate
#

Ok

thorn flicker
#

I said that

silver agate
#

I’ll test

lapis heart
silver agate
#

Nothing happens now

#

Content log doesn’t even say the error

thorn flicker
#

something might be off with your logic.

silver agate
#

I thought I gave the file with onInteractWithBlock, but it was onPlayerBreakBlock

thorn flicker
#

ah

silver agate
#

Everything worked alright 👍

#

Thank you guys so much

round bone
#

Or add return statement that checks if player's health is below or equal zero.

cinder shadow
#

That doesn't work

#

It pauses it and resumes when the player is alive again

loud brook
round bone
#

System.clearRun(interval: number)

distant tulip
loud brook
#

Btw guys, did setProperty change in 2.0.0 or something?

#

I am asking this because for some reason it doesn't work correctly

#

For some reason this increases its value

var final = (open_count - 1)
garage_door[i].setProperty("bd:open_count", final)

Meanwhile, this decreases it

var final = (open_count + 1)
garage_door[i].setProperty("bd:open_count", final)
#

(One is minus and the other is plus)

cinder shadow
# round bone Clear interval?

That won't work. There is no way to discern the difference between a player that just died and respawned and a player that didn't

distant tulip
cinder shadow
#

Thank you for saying what I'm trying to do

#

🗿

#

I think I fixed it, I was trying to avoid making a new property just for this but I needed one

#

It's hard to tell if I actually fixed it though since it's being caused by whatever pausing the game does to interval timers

distant tulip
#

why do you need property for that

cinder shadow
#

to disable it

#

I can't use health directly, because it pauses whatever is running and resumes it when the player spawns

#

so I have to set a property when health is 0 so when it runs back through when the player spawns it checks that and just exits

distant tulip
#

dynamic property?

cinder shadow
#

no, just doing player.__disabledStaminaDrain or whatever

#

temp

distant tulip
#

ah, alright
i thought you meant entity property

cinder shadow
#

I try to avoid entity properties since they're so limited

#

We don't have any limits on dynamic properties right?

round bone
cinder shadow
#

there we go, finally got the weird interval timing difference from pausing/unpausing so it would trigger

#

fixed it with the temp property

distant tulip
#

while riding an entity and both jump and dismount are disabled playerButtonInput event trigger for jump but not for sneak, any work around?

viscid horizon
#

can i get the entity that’s doing the raycast instead of the entity getting detected by one or am i stupid

#

nevermind i just used the player

#

in a function that was in it

hazy nebula
#

execute in scripts uses old version, that's silly

loud brook
#

I am going to lose my mind. Why doesn't setProperty work properly anymore???

distant tulip
#

It work fine for me

loud brook
#

I literally wrote zero in this code, but somehow it sets as one

garage_door[i].setProperty("bd:open_count", 0)
loud brook
distant tulip
#

How are you checking the value

loud brook
#

And it displays it as one

distant tulip
#

Weird

#

Send your entity file

loud brook
#

For some reason this increases its value

var final = (open_count - 1)
garage_door[i].setProperty("bd:open_count", final)

Meanwhile, this decreases it

var final = (open_count + 1)
garage_door[i].setProperty("bd:open_count", final)
loud brook
#

sure then

distant tulip
#

Yeah

wary edge
loud brook
#

@distant tulipDid you seem to figure out something? (sorry about the ping)

loud brook
#

which didn't work