wanderer bob

calico-kid

Helper
Staff member
Helper
Aug 28, 2017
4
0
0
instructions: 1:assign the script to your npc.
2:say [anchor] to him to get the anchor tool.
3:once you have the tool click to set the anchor.
4:go up to the npc and type radius.
5:type in a number for the radius.
now your npc should start wandering. enjoy

Code:
wander:
  type: assignment
  debug: false
  actions:
    on chat:
    - if <player.is_op> && <context.message> == anchor:
      - determine passively cancelled
      - give anchortool
      - flag <player> anchornpc:<npc>
    - if <player.is_op> && <context.message> == radius:
      - determine passively cancelled
      - flag <player> radius
      - narrate "<green> please select a number for a radius"
    - if <player.is_op> && <context.message.is_integer> && <player.has_flag[radius]>:
      - determine passively cancelled
      - flag <npc> radius:<context.message>
      - flag <player> radius:!
      - narrate "<green>Npc radius is now set to <npc.flag[radius]>"
      - despawn <npc>
      - spawn <npc>
    on spawn:
    - wait 2s
    - while <npc.is_spawned>:
      - ~walk <npc> <npc.anchor[wander].add[<util.random.int[-<npc.flag[radius]>].to[<npc.flag[radius]>]>,0,<util.random.int[-<npc.flag[radius]>].to[<npc.flag[radius]>]>]> auto_range
      - wait 1s
    on despawn:
    - walk <npc> stop
anchortoolworld:
  type: world
  debug: false
  events:
    on player right clicks with anchortool:
    - anchor npc:<player.flag[anchornpc].as_npc> id:wander add <context.location>
    - narrate "<green>Location added as an anchor"
    - take anchortool
    - flag <player> anchortool:!
anchortool:
  type: item
  debug: false
  material: stick
  display name: anchor_tool
 

mcmonkey

Administrator
Staff member
Helper
- Please use https://one.denizenscript.com/haste to post scripts
- ... why are you not using an interact script?
- What reason is there to use this script instead of the built-in Citizens wander pathfinder?