Date: 2014/04/12 21:52:00 UTC-07: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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
'AIAttackEvent':
type: world
events:
on npc damaged by entity:
- define statusAvailable 'Wandering|Walking'
- define statusUnavailable 'Following|Fleeing|Arriving|Thinking|Lost'
- define statusFighting 'Fighting'
- define status <npc.flag[Pathfind.Status]>
- define attackerType <context.damager.prefix>
- define attacker <context.damager>
- if <def[statusAvailable].contains[<def[status]>]> {
- if <def[attackerType].is[==].to[player]> {
- flag npc WorkingSet:<def[attacker]>|Fighting|<def[status]>
- flag npc Pathfind.Status:Fighting
- run s@AIAttackResponses
}
else if <def[attackerType].is[==].to[entity]> {
- chat "Do something"
}
- queue clear
}
else if <def[statusUnavailable].contains[<def[status]>]> {
- if <def[attackerType].is[==].to[player]> {
- define player <def[attacker]>
- inject s@AIAttackResponses p:Cry
- determine CANCELLED
}
else if <def[attackerType].is[==].to[entity]> {
- determine CANCELLED
}
- queue clear
}
else if <def[statusFighting].contains[<def[status]>]> {
- if <def[attackerType].is[==].to[player]> {
- ^define workingSet <npc.flag[WorkingSet].as_list>
- ^define playersList <def[workingSet].get[1]>
- if !<def[playersList].contains[/]> {
- if <def[playersList].is[==].to[<def[attacker>]> {
- queue clear
}
else {
- chat "A new attacker" no_target
}
}
else {
- if <def[playersList].split[/].contains[<def[attacker]>]> {
- chat "An existing attacker" no_target
- queue clear
}
else {
- chat "A new attacker" no_target
- flag npc WorkingSet:<def[playersList]>/<def[attacker]>|<def[workingSet].get[2]>|<def[workingSet].get[3]>
- run s@AIAttackResponses
}
}
}
else if <def[attackerType].is[==].to[entity]> {
- chat "Do something"
}
- queue clear
}
'AIAttackResponses':
type: task
script:
- ^define workingSet <npc.flag[WorkingSet].as_list>
- ^define player <def[workingSet].get[1]>
- ^define task <def[workingSet].get[2]>
- ^define previousStatus <def[workingSet].get[3]>
- ^flag npc WeightedRandomChoice:59/Cry|40/RunAway|1/Lightning
- ^inject s@WeightedRandomChoice instantly
- flag npc WorkingSet:<def[player]>|<def[result]>|<def[previousStatus]>
- inject s@AIAttackResponses p:<def[result]>
- flag npc WeightedRandomChoice:!
FightBackWeak:
- ^inject s@PathfindPauseActivity instantly
- ^attack target:<def[player]>
FightBackStrong:
- chat "" no_target
Lightning:
- ^flag npc Fighting.Status:Magic
- ^run s@ToggleVulnerable def:5
- ^inject s@PathfindPauseActivity instantly
- ^look <npc> <def[player].eye_location> duration:2s
- ^chat "You shouldn<&sq>t have done that..." no_target
- ^strike <def[player].location>
- ^chat "How does that feel <def[player].name>? HAHAHA!" no_target
- ^inject s@PathfindResumeActivity instantly
RunAway:
- ^inject s@PathfindPauseActivity instantly
- ^flag npc Fighting.Status:Fleeing
- ^chat "What are you doing!" no_target
- ^wait 1s
- ^chat "I<&sq>m outta here!" no_target
- ^define radius '35'
- ^define speed '1.0'
- ^define wait '1'
- ^run s@Fidget def:%radius%|%speed%|%wait% id:<npc.id>_RunAwayQueue
- ^wait 1s
- ^chat "HELP! <def[player].name> is trying to kill me!" no_target
- ^wait 4s
- ^chat "What the flip def[player].name>! Stay away from me!" no_target
- ^wait 6s
- ^chat "AHHHHHHH!!" no_target
- ^wait 4s
- ^queue <npc.id>_RunAwayQueue stop
- ^wait 1s
- ^inject s@PathfindResumeActivity instantly
- ^chat "<def[player].name> is tots cray cray!" no_target
- ^wait 1s
- ^chat "Stay away from that guy!" no_target
Cry:
- ^wait 15t
- ^random {
- chat "Hey <def[player].name>!" no_target
- chat "I don<&sq>t like that!" no_target
- chat "No means NO!" no_target
- chat "Could you not..." no_target
- chat "Get away from me <def[player].name>!" no_target
- chat "I<&sq>m gonna tell your mom <def[player].name>!" no_target
- chat "Call the cops! <def[player].name> is trying to kill me!" no_target
- chat "What did I do to you!?!" no_target
- chat "STOP!" no_target
- chat "You<&sq>d better stop <def[player].name>..." no_target
- chat "I<&sq>m telling!" no_target
- chat "Hey! I<&sq>m unarmed <def[player].name>!" no_target
- chat "Can ya not!?!" no_target
- chat "Don<&sq>t do that!" no_target
- chat "You won<&sq>t like me when I<&sq>m angry!" no_target
}