#(zen9967) NPC hide using name
47 messages · Page 1 of 1 (latest)
(zen9967) NPC name
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
(zen9967) NPC hide using name
?
You use neither of them
You need to use the NPC object
I can recommend you save this object into a server or world flag and then read from it instead
- Run this command while looking at a NPC
/ex flag server my_fancy_npc:<player.target>
After this you can reference this specific npc via <server.flag[my_fancy_npc]> in any script.
im planning to make npc instances 😦
I was experimenting. I am creating a fake npc through spawning npc to a player's name - create player <player.name>_npc
Your question seems to be an XY Problem - you're asking about your attempted solution rather than your original problem.
Read in detail about the XY Problem here: http://xyproblem.info/
For an example of an XY Problem we've seen in Denizen, the question "how do I make an event for when a flag expires" has no answer, but the same question asked with full background detail will be something more like "I have this script: [LINK HERE], which sets a 3 minute cooldown flag on a player for when they use an ability. I want the player to be notified when the cooldown completes - how do I do this?" which we can then answer quite effectively (in this example, all that was needed was a simple wait command, no events or flag-listening or anything).
Citizens
npc
create [<entity>] [<name>] (<location>) (traits:<trait>|...) (registry:<name>)
Creates a new NPC, and optionally spawns it at a location.
Creates an npc which the entity type specified, or specify an existing npc to create a copy.
If no location is specified the npc is created despawned.
Use the 'save:<savename>' argument to return the npc for later use in a script.
Optionally specify a list of traits to immediately apply when creating the NPC.
Optionally specify a custom registry to create the NPC into. (Most users, leave this option off).
Will generate a new registry if needed.
<server.npcs> Returns a list of all NPCs.
<entry[saveName].created_npc> returns the NPC that was created.
You can use the save argument ^ to reference the NPC you just spawned
!lang save argument
The "save:<name>" argument is a special meta-argument that is available for all commands, but is only useful for some.
It is written like:
- run MyScript save:mysave
When the save argument is used, the results of the command will be saved on the queue, for later usage by the "entry" tag.
The useful entry keys available for any command are listed in the "Tags" documentation section for any command.
For example, the "run" command lists "<entry[saveName].created_queue>".
The "saveName" part should be replaced with whatever name you gave to the "save" argument,
and the "created_queue" part changes between commands.
Some commands have multiple save entry keys, some have just one, most don't have any.
Many users make the mistake of using dynamic save names like "save:<[something]>" - this is almost always wrong. Use a constant name, just like you do for definitions.
Script Command System
is there any way to create npc instances than this?
does npc instance can cause memory leak?
I mean, this is just creating NPCs - there's not really any other way to do that
does npc instance a bad idea?
otherwise i cant make a cinematic without using any external plugins
Memory leak (usually) happen when you don't clean up things your script made after it's done - as long as you delete the NPC you made for the player after the quest is done you'll be fine
okay i see but i dont know where to start on creating npc instances
is there fakenpc or no?
if there is, that will be good feature
There's no need to create fake NPCs, you can use normal NPCs and hide them as we suggested
That command creates a new NPC ^
With the save: argument ^, you can get the NPC the command created to use in your script
Then all you need to do is hide the NPC you created from other players
i use this /ex flag server my_fancy_npc:<player.target> to define npc id
That's storing information globally on the server, which you can use to store existing NPCs, but in this case you're trying to create new NPCs
So something like
- create ... save:new_npc
- define new_npc <entry[new_npc].created_npc>
^ is an example of using the save: argument
sorry im bit confused and new to this
i tried executing it but it does not show an npc
!e npc spawn
NPC
npc spawns
npc:<npc> to only process the event if the spawned NPC matches.
reason:<reason> to only process the event if the NPC's spawn reason matches. See https://jd.citizensnpcs.co/net/citizensnpcs/api/event/SpawnReason.html for a list of reasons.
when an NPC spawns.
Always.
<context.location> returns the location the entity will spawn at.
<context.reason> returns the reason of the spawn.
True - this adds switches in:<area> + location_flagged:<flag name>.
True - this adds <context.cancelled> and determines cancelled + cancelled:false.
!e fake npc
Did you mean to search for sentinel npc has no more targets?
@devout berry do you still need help? otherwise
Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.
If not yet resolved, please reply below to tell us what you still need.
(Note that if there is no reply for a few days, this thread will eventually close itself.)
@devout berry