#(zen9967) NPC hide using name

47 messages · Page 1 of 1 (latest)

devout berry
#

how do you hide npc using npc name instead if id?

light gateBOT
#

(zen9967) NPC name

light gateBOT
#

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.

devout berry
#

(zen9967) NPC hide using name

steep lotus
#

?

#

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

#
  1. 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.

devout berry
#

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

steep lotus
#

Yeah you can do this too.

#

!xyproblem

flat briarBOT
# steep lotus !xyproblem
Info: xyproblem

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).

steep lotus
#

Your question is actually a XY Problem

#

!c create t

flat briarBOT
# steep lotus !c create t
Required Plugins or Platforms

Citizens

Group

npc

Syntax

create [<entity>] [<name>] (<location>) (traits:<trait>|...) (registry:<name>)

Short Description

Creates a new NPC, and optionally spawns it at a location.

Description

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.

Related Tags

<server.npcs> Returns a list of all NPCs.
<entry[saveName].created_npc> returns the NPC that was created.

steep lotus
#

You can use the save argument ^ to reference the NPC you just spawned

#

!lang save argument

flat briarBOT
# steep lotus !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.

Group

Script Command System

devout berry
#

is there any way to create npc instances than this?

#

does npc instance can cause memory leak?

honest quiver
devout berry
#

does npc instance a bad idea?

#

otherwise i cant make a cinematic without using any external plugins

honest quiver
devout berry
#

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

honest quiver
#

There's no need to create fake NPCs, you can use normal NPCs and hide them as we suggested

honest quiver
honest quiver
# flat briar

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

devout berry
#

i use this /ex flag server my_fancy_npc:<player.target> to define npc id

honest quiver
#

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

devout berry
#

sorry im bit confused and new to this

#

i tried executing it but it does not show an npc

#

!e npc spawn

flat briarBOT
# devout berry !e npc spawn
Group

NPC

Event Lines

npc spawns

Switches

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.

Triggers

when an NPC spawns.

Has NPC

Always.

Context

<context.location> returns the location the entity will spawn at.
<context.reason> returns the reason of the spawn.

Has Known Location

True - this adds switches in:<area> + location_flagged:<flag name>.

Cancellable

True - this adds <context.cancelled> and determines cancelled + cancelled:false.

devout berry
#

!e fake npc

flat briarBOT
#
Possible Confusion

Did you mean to search for sentinel npc has no more targets?

steep lotus
#

@devout berry do you still need help? otherwise

fluid shellBOT
#
Thread Closing Reminder

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