#(giooorgiooo) How do I add this script to an npc so whenver I restart the server the npc runs the

45 messages · Page 1 of 1 (latest)

arctic crest
#
npc_script:
    type: assignment
    actions:
        on assignment:
            - while True:
                - if <player.location.distance[<npc.location>]> > 10:
                    - follow followers:<npc> target:<player>
                - else:
                    - follow stop
                - wait 1s
        on spawn:
            - while True:
                    - if <player.location.distance[<npc.location>]> > 10:
                        - follow followers:<npc> target:<player>
                    - else:
                        - follow stop
                    - wait 1s
thorny basinBOT
#

(giooorgiooo) How do I add this script to an npc so whenver I restart the server the npc runs the

thorny basinBOT
#

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.

somber inlet
#

Could probably just use a proximity action instead

#

!a proximity

deep raftBOT
somber inlet
#

!c trigger

deep raftBOT
# somber inlet !c trigger
Required Plugins or Platforms

Citizens

Group

npc

Syntax

trigger [name:<trigger>] (state:{toggle}/true/false) (cooldown:<duration>) (radius:<#>)

Short Description

Enables or disables a trigger.

Description

This command enables or disables an interact script trigger for the linked NPC.
This is generally meant to be used within the 'on assignment' action in an assignment script.
This might also be useful on timed activations or other special events (such as an NPC that "goes to bed" at the end of the day,
you might disable the proximity trigger that would otherwise normally show a greeting message).

The "name" argument is required, and can have any supported trigger name.
The 4 triggers available b...

rigid badger
#

my man trust me you will NEVER need to use an infinite loop like while true

#

if you ever catch yourself doing that, PLEASE post here so we can help you find the proper way to do things

#

in this case, tech's solution is the right one

arctic crest
#

Also how can I refer to a specific player by his Minecraft name in code

arctic crest
#

Hoe would i do that

rigid badger
#

spawn a wolf npc then, and make its follow range 10

#

!t server.match_player

deep raftBOT
arctic crest
#

Nah i mean i wanna spaen bormsl human noc

rigid badger
#

!t server.match_offline_player

deep raftBOT
# rigid badger !t server.match_offline_player

Returns any player (online or offline) that best matches the input name.
EG, in a group of 'bo', 'bob', and 'bobby'... input 'bob' returns player object for 'bob',
input 'bobb' returns player object for 'bobby', and input 'b' returns player object for 'bo'.
When both an online player and an offline player match the name search, the online player will be returned.

Returns

PlayerTag

arctic crest
#

But i mean like the vanilla wolf behavior

rigid badger
#

use these tags to get usable PlayerTags from player names

rigid badger
arctic crest
#

Okay so i should use the proximity trigger

#

Lets assume for now normal wolf

#

Is proximity trigger the only method or can i also have it following me always

#

If i am not near the npc

rigid badger
#

you can have it following you

#

thats basic citizens, you can find it in its wiki pretty easily

arctic crest
#

Yes i know but my goal is to have a margin between me and the npc when he follows me

#

Which is why i need denizen

rigid badger
#

actually i dont think you need, iirc theres an option for exactly that

arctic crest
#

I didnt find that

#

You got it?

arctic crest
#

?

somber inlet
#

from what I gathered, you want the npc to only follow you if it's within 10 blocks from the player?

#
follow_assignment:
  type: assignment
  actions:
    #this fires when you assign the script to the npc, you set the proximity radius this way
    on assignment:
    - trigger name:proximity state:true radius:10
    #when the player enters the proximity of the npc, make it follow the player
    on enter proximity:
    - follow
    #when they exit, make it stop following the player
    on exit proximity:
    - follow stop```
arctic crest
#

No follow me always with a margin of at least 10 blocks

somber inlet
#

!c follow

deep raftBOT
# somber inlet !c follow
Group

entity

Syntax

follow (followers:<entity>|...) (stop/target:<entity>) (lead:<#.#>) (max:<#.#>) (speed:<#.#>) (allow_wander) (no_teleport)

Short Description

Causes a list of entities to follow a target.

Description

Causes a list of entities to follow a target.

Specify the list of followers or just one. If no follower is specified, will use the linked NPC.

Specify either the target to follow, or 'stop'. If no target is specified, will use the linked player.

Use 'speed' to set the movement speed multiplier.
Use 'lead' to set how far away the follower will remain from the target (ie, it won't try to get closer than the 'lead' distance).
Use 'max' to set the maximum distance between the follower and the tar...

somber inlet
#

Use 'lead' to set how far away the follower will remain from the target (ie, it won't try to get closer than the 'lead' distance).

arctic crest
#

THANK U

grim gullBOT
#

@arctic crest

Thread Close Blocked

Thread was closed either automatically by timeout or by the Discord manual close button. If closing was intentional, please use </resolved:1028673926114594866> or </invalid:1028673926898909185>.