Spawn NPC , can be killed, respawn after killed

Discussion in 'Skript' started by Juandiii, May 28, 2017.

  1. Can skript handle something like this?

    There's a NPC , it moves , then we can kill him ,after that , he will respawn again.
    I want to use NPC , and not mythicmobs

    If you know how to, please reply :)

    Thank you
  2. You can use Skellett and SkRayFall Skript addon to do that.
    And you need go to Skellett's Config File and set Citizen NPC support to 'true'.

    Here's the untested example code:
    Code (Text):

    on npc damage event:
        set {_ID} to npc event-npc's id
        move citizen {_ID} to location of event-entity

    on npc death:
        set {_ID} to npc event-npc's id
        set {_loc} to player's location
        respawn citizen {_ID} at {_loc}
        make citizen {_ID} vulnerable
    #2 NuCodes, May 29, 2017
    Last edited: May 29, 2017
  3. did not work

    can u try again , for an example
    There's a citizen named "Human"
    if he got killed,he will respawn again

    Anyway, the error of your example is on the line 1 , 3, 9 and 10
  4. Tested Code
    Something Like this?
    Code (Text):
    on death:
        if victim is a citizen:
            set {_id} to citizen id of victim
            if "%name of citizen {_id}%" is "Human":
                respawn citizen {_id} at {human.respawn}

    command /human:
            set {human.respawn} to player's location
            create a citizen named "Human" at {human.respawn}
            set {_i} to last created citizen
            make citizen {_i} vulnerable