- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleUntitled Paste
TypeDenizen Script
Date2014/06/18 08:05:34 UTC-07:00
ByGuest
Other
Paste
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
3000
'PathfindWalkPath':
#
# Does sanety checks and then chooses a target and walks to it.
# Sets <npc.flag[Pathfind.Status]> when thinking and walking.
# Use on npc flag change event as needed.
#
# Sets <npc.flag[Pathfind.Status]> to Lost when there is no destination.
# Sets <npc.flag[Pathfind.Status]> to Arriving when walking to destination.
# Sets <npc.flag[Pathfind.Status]> to Walking after s@PathfindChooseTarget
#   successfully completes.
# Use on npc flag change event as needed.
#
  type: task
  script:
    - ^if !<npc.is_spawned> queue clear
    - flag npc Pathfind.Status:Thinking
    - inject s@PathfindLoadData instantly
    - ^if <def[destination].is[==].to[null]> {
      - flag npc Pathfind.Status:Lost
      - queue <npc.name>_PathfindWalkPath_Queue clear
      }
    - ^if <def[destinationDistance].as_int.is[OR_LESS].than[%maxPathFindRadius%]> {
      - flag npc Pathfind.Status:Arriving
      - walkto <def[destination]> speed:<def[pathWalkSpeed]>
      - queue clear
      }
    - inject s@PathfindChooseTarget instantly
    - flag npc Pathfind.Status:Walking
    - walkto <def[pathTarget]> speed:<def[pathWalkSpeed]> radius:<def[pathWalkRadius]>



RawRaw



Pastes made: 67067