wanderer bob

Share scripts you wrote for Denizen-Bukkit here!
Post Reply
calico-kid
Regular
Regular
Posts: 4
Joined: August 28th, 2017, 9:39 pm

wanderer bob

Post by calico-kid » June 23rd, 2020, 7:04 pm

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: Select all

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

User avatar
mcmonkey
Site Admin
Site Admin
Posts: 282
Joined: August 5th, 2016, 7:27 pm
Location: Los Angeles, California, USA
Contact:

Re: wanderer bob

Post by mcmonkey » June 24th, 2020, 5:15 am

- 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?
Denizen lead developer. On Discord as mcmonkey#6666.

Post Reply

Who is online

Users browsing this forum: mcmonkey and 1 guest