#(JustinS) custom npc wander

28 messages · Page 1 of 1 (latest)

sudden bear
#

How would I make this logic with denizen? Fulwall said it will be added as featute but only after a while so I wantef to try it myself.
Normal scenario:

  1. NPC wanders around (forever)
  2. Player gets in a 2 block range to the NPC
  3. NPC stops walking for 2 seconds and looks at the player.
  4. After those 2 seconds, continue walking, even when the player is still close to the NPC.
  5. Reset after like 5 seconds

In the scenario where the player keeps following the npc and stays in the 2 block range the whole time:

  1. NPC stops walking for 2 seconds and looks at the player.
  2. Continue walking, wait for 5 secs,
  3. NPC stops walking again for 2 seconds and looks at the player again
  4. Repeat
brittle marshBOT
#

(JustinS) custom npc wander

brittle marshBOT
#

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.

sudden bear
#

Currently, using citizens, the npcs stop when the player is close enough and look at the player, but they stop forever. Eventually you just have 20 npcs stopped around you in a circle

#

My question is basically what events would I need to use for this?

keen thunder
#

you can just use flags & proximity trigger for this

sudden bear
#

So... proximity trigger to check if player is close. Then somehow disable navigating, add a cooldown for stopping again, wait 2 secs, and somehow enable navigating again?

keen thunder
#

you just disable it

#

all you need here is flags with an expiration

#

and a move proximity

#
wander_justin:
  type: assignment
  actions:
    #enable prox & set radius
    on assignment:
    - trigger name:proximity radius:4 state:true
    on move proximity:
    #if it has flag it means it's looked at a player in the last 5s
    - stop if:<npc.has_flag[stopped]>
    #flag for however many seconds for cooldown + the time you have in the wait cmd below (meaning it'll stop and look at you every 5 seconds like this)
    - flag <npc> stopped expire:7s
    #stop wandering & look
    - adjust <npc> waypoint_provider:linear
    - lookclose state:true
    #wait however much you want
    - wait 2s
    #disable look & re-enable wander
    - lookclose state:false
    - adjust <npc> waypoint_provider:wander```
#

thats all this is

sudden bear
#

Youre amazing. Ill have a good look at the code. Not yet familiar with triggers

sudden bear
#

What's the
- trigger name:proximity.... for?

gilded slate
#

how to use

upper kindleBOT
# gilded slate how to use
ASCII Name Rule Enforcement

Non-ASCII nickname for @gilded slate changed to base username. Please only use a readable+typable US-English ASCII nickname.

thin loom
keen thunder
worn ferryBOT
# keen thunder !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...

keen thunder
#
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.
....```
#

in order to use proximity you need to enable the trigger first

sudden bear
#

Aha

#

I read the docs but somehow missed that ig

#

Thanks