#Is it possible to get a particle to only show on one player's end?
1 messages · Page 1 of 1 (latest)
Easiest way is to play a particle on the player with q.is_local_player condition
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?
Able to use experimental?
Yep
Ok so if you really want to make particles this way, you can refer to this https://discord.com/channels/523663022053392405/1083410307197702185
Are you implying there's a better way than particles?
Yes
What would that be?
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
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
Does this require player.json?
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
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?
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
That requires editing RP player.json
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
Where would I check this?
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.
So I would need to modify every entity that I want this to work with?
Yes, how else would you be able to change their appearance
I was hoping I could just spawn the particle at their position
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
I see
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
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?
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