Delete NPCs by name?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

YourMCAdmin

Member
Jan 31, 2017
18
0
0
37
Skript Version:2.2-dev23
Skript Author:Bensku
Minecraft Version:1.11.2


Other plugins used:
Skellett
Citizens
(all up to date)
---
I have spawned in an NPC with the following code:
code_language.skript:
set {_npc} to a npc with name "%player%'s NPC" and entity type "WITCH"
spawn npc {_npc} at {_npcSpawnLoc}
NPC spawns fine and dandy.
I cannot for the life of me figure out how to remove the NPC without using Citizens' commands directly. I don't want to despawn the NPC, but I want to completely delete/remove it. There isn't much information on this in the docs or the forums here. And the docs aren't quite up to date for Skellett and Citizens. I had to figure out some of the stuff by searching the forums here.

I have tried:
code_language.skript:
command /bye:
    trigger:
        set {_npc} to a npc with name "%player%'s NPC" and entity type "WITCH"
        remove npc {_npc}
It doesn't throw any errors. But this doesn't do anything except for create another NPC with an identical name.

All I see in the docs is:
"(despawn|remove) (npc|citizen) %npc% [with [despawn] reason %-despawnreason%]"
Adding a despawn reason throws a "Can't understand this condition/effect" error. Unless the despawn reason must be something specific? But still, I don't want to despawn, I want to delete.


Any ideas? I hope you folks may be able to help! Possibly @LimeGlass may be able to weigh in?

Thanks!!! :emoji_grinning:


Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? Crying into my pillow. As well as trying to use SkRayFall in conjunction with skellett
 
Skript Version:2.2-dev23
Skript Author:Bensku
Minecraft Version:1.11.2


Other plugins used:
Skellett
Citizens
(all up to date)
---
I have spawned in an NPC with the following code:
code_language.skript:
set {_npc} to a npc with name "%player%'s NPC" and entity type "WITCH"
spawn npc {_npc} at {_npcSpawnLoc}
NPC spawns fine and dandy.
I cannot for the life of me figure out how to remove the NPC without using Citizens' commands directly. I don't want to despawn the NPC, but I want to completely delete/remove it. There isn't much information on this in the docs or the forums here. And the docs aren't quite up to date for Skellett and Citizens. I had to figure out some of the stuff by searching the forums here.

I have tried:
code_language.skript:
command /bye:
    trigger:
        set {_npc} to a npc with name "%player%'s NPC" and entity type "WITCH"
        remove npc {_npc}
It doesn't throw any errors. But this doesn't do anything except for create another NPC with an identical name.

All I see in the docs is:
"(despawn|remove) (npc|citizen) %npc% [with [despawn] reason %-despawnreason%]"
Adding a despawn reason throws a "Can't understand this condition/effect" error. Unless the despawn reason must be something specific? But still, I don't want to despawn, I want to delete.


Any ideas? I hope you folks may be able to help! Possibly @LimeGlass may be able to weigh in?

Thanks!!! :emoji_grinning:


Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? Crying into my pillow. As well as trying to use SkRayFall in conjunction with skellett
code_language.skript:
(delete|unregister) (npc|citizen) %npc%

All of Skellett's syntax are generated in a file called Syntax.yml found at plugins/Skellett/Syntax.yml which contains every registered syntax. That is enabled.

You can also delete all npc's too if you need
code_language.skript:
(delete|unregister|remove) (the|all) [of] [the] (npcs|citizens)
 
Thanks for the reply :emoji_slight_smile:
Unless I'm doing something wrong, I can't get it to delete.

code_language.skript:
command /hi:
    trigger:
        set {_npc} to a npc with name "%player%'s NPC" and entity type "WITCH"
        spawn npc {_npc} at player

command /bye:
    trigger:
        set {_npc} to a npc with name "%player%'s NPC" and entity type "WITCH"
        send "test 1"
        unregister citizen {_npc}
        send "test 2"
Both of my test messages fire. No errors. But the NPC still exists. Hrmmm... Am I doing something wrong?
 
Thanks for the reply :emoji_slight_smile:
Unless I'm doing something wrong, I can't get it to delete.

code_language.skript:
command /hi:
    trigger:
        set {_npc} to a npc with name "%player%'s NPC" and entity type "WITCH"
        spawn npc {_npc} at player

command /bye:
    trigger:
        set {_npc} to a npc with name "%player%'s NPC" and entity type "WITCH"
        send "test 1"
        unregister citizen {_npc}
        send "test 2"
Both of my test messages fire. No errors. But the NPC still exists. Hrmmm... Am I doing something wrong?
I will test it out. You can also get the entity from the disgusie

code_language.skript:
[skellett] [[Libs]Disguises] [the] entity of disguise %disguise%

[skellett] [[Libs]Disguises] %disguise%'s disgusie entity
And clear the entity like you would with any other entity.
 
Thank you LimeGlass. Let me know what you find out. I could probably just use LibsDisguise and a mob no AI if I have to. But using Citizens would be easier :emoji_slight_smile:
[doublepost=1491183898,1490656505][/doublepost]I'm curious as to if you tested the NPC thing yet?

Another issue I'm having (a work around for the Citizens thing):
I have the latest Skellet, Skript, and LibsDisguise installed. I tried using Skellet's disguise syntaxes, and I can't get anything to work.

I've tried using:
code_language.skript:
[skellett] [[Libs]Disguises] [set] Disguise [of] next [spawned] (as|to) %disguise%
Examples:
skellett LibsDisguises set Disguise of next spawned to witch
skellett LibsDisguises set Disguise of next spawned to "witch"
..and get "Can't understand this condition/effect" errors on every reload. I have made sure LibsDisguise hook is enabled in the config. Would you be able to provide an example on how this is supposed to be used?

Also, I'm totally confused about how to use:
code_language.skript:
[skellett] [[Libs]Disguises] %disguise%'s disgusie entity
(and there is a misspelling there of disguise :emoji_wink:)

Unfortunately googling all of the old Bukkit and SKUnity threads no longer exist, so years of Skript help threads seems to be flushed away :emoji_frowning:

I appreciate the help!
 
I've tried using:
  • [skellett] [[Libs]Disguises] [set] Disguise [of] next [spawned] (as|to) %disguise%
  • Examples:
  • skellett LibsDisguises set Disguise of next spawned to witch
  • skellett LibsDisguises set Disguise of next spawned to "witch"
..and get "Can't understand this condition/effect" errors on every reload. I have made sure LibsDisguise hook is enabled in the config. Would you be able to provide an example on how this is supposed to be used?
This syntax is not a thing. I have no clue where you got this syntax. A really old version? Or you need to delete and let your syntax regenerate? idk

But the syntax is
code_language.skript:
[skellett] [[Libs]Disguises] [set] Disguise [of] next [spawned] [entity] (as|to) %disguise%

This will disguise the next entity to spawn. Example:

code_language.skript:
set {_d} to a new disguise of type "ZOMBIE"
set disguise of next spawned to {_d}

Also, I'm totally confused about how to use:
  • [skellett] [[Libs]Disguises] %disguise%'s disgusie entity
This is used to get the actual entity of the disguise. So you can use entity syntax to modify the physical disguise if you want.

code_language.skript:
set {_entity} to entity of disguise {_d}
set health of {_entity} to 100
equip {_entity} with diamond armour
 
Thank you! This worked. (just had to remove the word "of")

code_language.skript:
set {_d} to a new disguise type "ZOMBIE"
set disguise of next spawned to {_d}

It's a good workaround for the NPC thing not working. However, if you can figure out a way to delete single NPC's by name (which was my original problem), that would work so much better for what I'm working on. NPCs just have so many more options to play with.
For now, I'll spawn in a mob with no-AI and disguise it to make it feel like an NPC instead.
 
Status
Not open for further replies.