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
#(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)
(giooorgiooo) How do I add this script to an npc so whenver I restart the server the npc runs the
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.
Triggers
when a player moves inside the NPC's proximity trigger's radius.
Context
None
!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.
Related Guide Page
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...
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
Okay so I want to spawn npcs that act like a wolf as a protective companion and fight with me and follow me, however, i want them to keep a distance of minimum 10 blocks
Also how can I refer to a specific player by his Minecraft name in code
Hoe would i do that
Returns the online player 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'.
Returns
PlayerTag
Nah i mean i wanna spaen bormsl human noc
!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
But i mean like the vanilla wolf behavior
use these tags to get usable PlayerTags from player names
then you'll have to code that yourself with sentinel, which i do not know how to
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
you can have it following you
thats basic citizens, you can find it in its wiki pretty easily
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
actually i dont think you need, iirc theres an option for exactly that
?
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```
No follow me always with a margin of at least 10 blocks
!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...
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).
THANK U
@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>.