#Is it possible to get a particle to only show on one player's end?

1 messages · Page 1 of 1 (latest)

slender ice
#

I want to spawn a particle either through a command or an entity that is only visible to a specific player. Is it possible to do so? I know query.is_local_player exists so maybe something with that?

celest plaza
#

Easiest way is to play a particle on the player with q.is_local_player condition

slender ice
#

Ok so I wanted to create an ability for the player that allows them to see nearby mobs, but I don't want other players to see that particle

#

Would that still be doable?

celest plaza
#

Able to use experimental?

slender ice
#

Yep

celest plaza
slender ice
#

Are you implying there's a better way than particles?

celest plaza
#

Yes

slender ice
#

What would that be?

celest plaza
#

Get nearby players, find the player with q.is_local_player true (that'd be the client player), check the conditions that u want to check and based on that alter whatever you need to on the client entity - animations, render controllers, textures, particles etc

slender ice
#

So I'd need to modify the entity's file, I can't really do that if I want it to work with stuff from other packs

slender ice
celest plaza
#

No, but it would depend on how and what conditions the players must have to see other entities, and whether u can make them without player.json (both BP and RP)

#

A few methods to think about, without player.json: scoreboard, items in inventory or hand

slender ice
#

I want it to trigger when they use an item

#

But if you spawn it with a special argument, it will emit only one particle
How would you spawn a particle with a special argument?

celest plaza
# slender ice I want it to trigger when they use an item

In this case, you might be able to get away with constantly checking from other entities if the client player is using an item. Although if you've already used it, and then a new entity appears within render distance, it won't know that u used an item

celest plaza
#

As u need to register a particle to spawn it from the player context, based on q.is_local_player

#

But animations and animation controllers do have pre_effect_expression or something similar, that executes a molang expression on the particle effect upon creation, and u can just set a variable from there to true, which will determine how many particles will spawn

#

Another option is temp leaking, but I wouldn't recommend it, it's too unreliable

celest plaza
#

From other entities, visibility of whom you want to control. Get nearby players -> find the client player -> constantly check if they're holding an item and using it -> if yes, alter visibility however u want. You also don't have to find local player every frame, it's enough to find once and save in a variable, as it will never change.

slender ice
#

So I would need to modify every entity that I want this to work with?

celest plaza
#

Yes, how else would you be able to change their appearance

slender ice
#

I was hoping I could just spawn the particle at their position

celest plaza
#

You can spawn particles or entity at other entity's positions and modify their visibility instead, but you obviously get less control and quality over the visuals

#

And particle method requires editing client player.json

slender ice
#

I see

celest plaza
#

If u don't need the visuals to follow entity position, you should be able to get away with spawning an entity that will emit particles and then despawn, and u don't need player.json for that. Also I think you can even make the particle follow the entity, if you pass the entity reference to a particle, so that it'll know always where said entity is. It's a bit to complex to set-up though

slender ice
#

I think for now I'll just have a dummy entity spawn and emit the particle and despawn

#

So to make sure that the particle it spawns are only visible to the local player I would need to get the client player and check if they are using the item?

celest plaza
#

Yes. Or instead, upon item usage you can set a scoreboard or replace said item with something else, or place some item on offhand, and instead of checking if player is using item you can check for that thing