Date: 2014/12/08 15:54:41 UTC-08:00
Type: Denizen Script
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# +-------------------
# | N P C
# | S M A R T L O O K
# |
# | NPCs that look around realistically!
#
# @author mcmonkey
# @date 2014 / 12 / 8
# @build 1546
# @version 1.0
#
# Installation:
# Copy into your scripts folder and /denizen reload scripts
#
# Usage:
# /npc select # Select an NPC
# /ex flag npc smartlook # Enable smartlook functionality
npcsmartlook_world_handler:
type: world
debug: false
events:
on server start:
- inject locally "events.on reload scripts"
on reload scripts:
- define queues <queue.list.filter[starts_with[npcsmartlook_task_run]]>
- foreach %queues% {
- queue %value% stop
}
- wait 5s
- run npcsmartlook_task_run delay:10t
npcsmartlook_task_run:
type: task
debug: false
script:
- while true {
- foreach <server.get_npcs_flagged[smartlook]> {
- if !<def[value].has_flag[smartlookcooldown]> && <util.random.int[1].to[4]> == 1 && <def[value].is_spawned> {
- define x <util.random.int[-5].to[5]>
- define z <util.random.int[-5].to[5]>
- define y <util.random.int[-2].to[2]>
- look %value% <def[value].location.add[%x%,%y%,%z%]>
- flag %value% smartlookcooldown duration:3s
}
}
- wait 1s
}