How can i detect an npc?

  • 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 community!

    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!

TheDever

Member
Sep 2, 2023
31
5
8
I tried this but it didnt work!
Code:
on right-click on entity:
    if event-entity is named "&6Inmate":
        give player orange wool named "&6BasketBall"

sorry about the backround stuff, at the time, my server had 23 players.

1737324661958.png
 
Code:
on right-click:
    if entity is player:
        if entity's display name is "&9discord":
            send "test" to player

no errors but dosen't seem to work
 
You can use CitizensAPI with sk-reflect. Download sk-reflect's latest version and paste this code:

isNPC.sk:
code_language.skript:
import:
    net.citizensnpcs.api.CitizensAPI

  

function isNPC(e: entity) :: boolean:

    set {_registry} to CitizensAPI.getNPCRegistry()



    return true if {_registry}.isNPC({_e}) is true

    return false

example:

code_language.skript:
on spawn:
    if isNPC(event-entity) is true:
        send "it's a NPC!" to players

SK-Reflect
 
Last edited: