Molang NPC Functions
Can also use entity functions. Type is ObjectValue<NPCEntity>
.
Name | Description | Usage |
---|---|---|
class(): String
|
Returns the id of the NPC as a String. | q.npc.class()
|
name(): String
|
Returns the name of the NPC. | q.npc.name()
|
level(): Double
|
Returns the level of the NPC. | q.npc.level()
|
has_aspect(aspect: String): Double
|
Returns 1.0 if the NPC contains the aspect , otherwise returns 0.0>/code>.
|
q.npc.has_aspect('champion')
|
face(isLeftSide: Boolean?): ObjectValue<ReferenceDialogueFaceProvider>
|
Returns a ObjectValue of [ReferenceDialogueFaceProvider] . isLeftSide is true by default.
|
q.npc.face()
|
in_battle(): Double
|
Returns 1.0 NPC is in battle, otherwise returns 0.0 .
|
q.npc.in_battle()
|
battles(): ArrayStruct<CHECK TYPE>
|
Returns all battles currently ongoing for this NPC. | q.npc.battles()
|
stop_battles()
|
Stops all ongoing battles for this NPC. | q.npc.stop_battles()
|
is_doing_activity(identifiers: String...): Double
|
Returns 1.0 if the NPC is doing any of the activities listed in the parameters, otherwise returns 0.0 .
|
q.npc.is_doing_activity('rest', 'idle')
|
run_script_on_client(script: String)
|
If run by a server a packet will be sent to all players in the same world as the NPC that tells the clients to run the script .
|
q.npc.run_script_on_client('cobblemon:npc_battle_cooling_down')
|
run_script(identifier: String): MoValue
|
Runs a script from an identifier . Returns the result of the script or 0.0 if it fails.
|
q.npc.run_script('cobblemon:npc_battle_cooling_down')
|
run_action_effect(actionIdentifier: String): Double
|
Runs an action effect. Returns 1.0 if effect is found, otherwise returns 0.0 .
|
q.npc.run_action_effect("cobblemon:generic_damage")
|
put_pokemon_in_healer(position: ArrayStruct<Int>): Double
|
The NPC attempts to put pokemon in a healing machine at position . Returns 1.0 if it succeeded, otherwise returns 0.0 .
|
q.npc.put_pokemon_in_healer(t.pos)
|
look_at_position(x: Double, y: Double, z: Double)
|
Makes the NPC look at the position of x , y , and z .
|
q.npc.look_at_position(0, 0, 0)
|
environment(): MoLangEnvironment
|
Returns the NPC's environment. | q.npc.environment()
|
party(): MoValue
|
Returns an ObjectValue<PartyStore> if the NPC has a party, otherwise returns 0.0 .
|
q.npc.party()
|
has_party(): Double
|
Returns 1.0 if NPC has a party, otherwise returns 0.0
|
q.npc.has_party()
|
is_npc(): Double
|
Returns 1.0 .
|
q.npc.is_npc()
|
can_battle(): Double
|
Returns 1.0 if NPC has a party and that party has health or if the party has isStatic set to false. Otherwise returns 0.0
|
q.npc.can_battle()
|