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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
The monster table contains bindings specific to monsters which are available in addition to their common tables.
---
#### `String` monster.type()
Returns the monster's configured monster type.
---
#### `String` monster.seed()
Returns a string representation of the monster's random seed.
---
#### `Json` monster.uniqueParameters()
Returns a table of the monster's unique (override) parameters.
---
#### `unsigned` monster.familyIndex()
Returns the monster's family index.
---
#### `float` monster.level()
Returns the monster's level.
---
#### `void` monster.setDamageOnTouch(`bool` enabled)
Enables or disables the monster's touch damage.
---
#### `void` monster.setDamageSources([`List<DamageSource>` damageSources])
Sets the monster's active damage sources (or clears them if unspecified).
---
#### `void` monster.setDamageParts(`StringSet` damageParts)
Sets the monster's active damage parts. Damage parts must be defined in the monster's configuration parameters. A damage part specifies a damage source and an animation part to anchor the damage source to. The anchor part's transformation will be applied to the damage source's damage poly, and if a vector, the damage source's knockback.
```js
"animationDamageParts" : {
"beam" : {
"anchorPart" : "partName", // animation part to anchor the damage source to
"checkLineCollision" : false, // optional, if the damage source is a line, check for collision along the line
"bounces" : 0, // optional, if the damage source is a line and it checks for collision
"damageSource" : {
"line" : [ [0.0, 0.0], [5.0, 0.0] ],
"damage" : 10,
"damageSourceKind" : "default",
"teamType" : "enemy",
"teamNumber" : 2
}
}
}
```
```lua
monster.setDamageParts({"beam"}) -- sets the "beam" damage part active
```
---
#### `void` monster.setAggressive(`bool` aggressive)
Sets whether the monster is currently aggressive.
---
#### `void` monster.setDropPool(`Json` dropPool)
Sets the monster's drop pool, which determines the items that it will drop on death. This can be specified as the `String` name of a treasure pool, or as a `Map<String, String>` to specify different drop pools for different damage types. If specified as a map, the pool should contain a "default" entry for unhandled damage types.
---
#### `Vec2F` monster.toAbsolutePosition(`Vec2F` relativePosition)
Returns an absolute world position calculated from the given relative position.
---
#### `Vec2F` monster.mouthPosition()
Returns the world position of the monster's mouth.
---
#### `void` monster.flyTo(`Vec2F` position)
Causes the monster to controlFly toward the given world position.
---
#### `void` monster.setDeathParticleBurst([`String` particleEmitter)
Sets the name of the particle emitter (configured in the animation) to burst when the monster dies, or clears it if unspecified.
---
#### `void` monster.setDeathSound([`String` sound])
Sets the name of the sound (configured in the animation) to play when the monster dies, or clears it if unspecified.
---
#### `void` monster.setPhysicsForces(`List<PhysicsForceRegion>` forceRegions)
Sets a list of physics force regions that the monster will project, used for applying forces to other nearby entities. Set an empty list to clear the force regions.
---
#### `void` monster.setName(`String` name)
Sets the monster's name.
---
#### `void` monster.setDisplayNametag(`bool` enabled)
Sets whether the monster should display its nametag.
---
#### `bool` monster.say(`String` line, [`Map<String, String>` tags])
Causes the monster to say the line, optionally replacing any specified tags in the text. Returns `true` if anything is said (i.e. the line is not empty) and `false` otherwise.
---
#### `bool` monster.sayPortrait(`String` line, `String` portrait, [`Map<String, String>` tags])
Similar to monster.say, but uses a portrait chat bubble with the specified portrait image.
---
#### `void` monster.setDamageTeam(`DamageTeam` team)
Sets the monster's current damage team type and number.
---
#### `void` monster.setUniqueId([`String` uniqueId])
Sets the monster's unique entity id, or clears it if unspecified.
---
#### `void` monster.setDamageBar(`String` damageBarType)
Sets the type of damage bar that the monster should display. Valid options are "default", "none" and "special".
---
#### `void` monster.setInteractive(`bool` interactive)
Sets whether the monster is currently interactive.
---
#### `void` monster.setAnimationParameter(`String` key, `Json` value)
Sets a networked scripted animator parameter to be used in a client side rendering script using animationConfig.getParameter.
|