NPC

┗> Character > Object > Class


NPCs are an extension of Character that provide the ability to use them in the Overworld similar to an Event.
Naming an object npc on an objects layer in a map creates an NPC.
The actor used for an NPC can be set by defining an actor property and setting it to the id of the desired actor.
See this object's Fields for other configurable properties on this object.


Constructor


NPC(actor: any, x: any, y: any, properties: any)

Arguments:

actor: any
x: any
y: any
properties: any




Methods


NPC:isActive()

Returns:

1: boolean


NPC:onInteract(player: any, dir: any)

Arguments:

player: any
dir: any

Returns:

1: boolean


NPC:onTextEnd()

Resets the NPCs sprite to it's idle if it was talking, and turns it to face its original position








Fields


NPC.cutscene: string

[Property cutscene] The name of a cutscene to start when interacting with this npc


NPC.idle_animation: string

[Property animation] The name of the animation this NPC should use when idle


NPC.idle_sprite: string

[Property sprite] The name of the sprite this NPC should use when idle



NPC.interact_count: number

The number of times this npc has been interacted with on this map load


NPC.path: string

[Property path] The name of a path shape in the current map that the npc will follow.


NPC.progress: number

[Property progress] The initial progress of the npc along their path, if defined, as a decimal value between 0 and 1.



NPC.script: string

[Property script] The name of a script file to execute when interacting with this npc


NPC.set_flag: string

[Property setflag] The name of a flag to set the value of when interacting with this object


NPC.set_value: any

[Property setvalue] The value to set the flag specified by set_flag to (Defaults to true)


NPC.solid: boolean

[Property solid] Whether the npc is solid (Defaults to true)


NPC.speed: number

[Property speed] The speed that the npc will move along the path specified in path, if defined.


NPC.start_facing: string

[Property facing] The direction the npc should be facing by default (Defaults to "down")


NPC.talk: boolean

[Property talk] Whether the npc should do a talking animation when interacted with and currently typing dialogue (Defaults to true)


NPC.talk_sprite: string

[Property talksprite] The name of a talk sprite to use for the NPC when talking


NPC.text: string[]

[Property text] A line of text to display when interacting with this npc
[Property list text] Several lines of text to display when interacting with this npc
[Property multi-list text] Several groups of lines of text to display on sequential interactions with this npc - all of text1_i forms the first interaction, all of text2_i forms the second interaction etc...


NPC.turn: boolean

[Property turn] Whether the NPC should turn to face the player when interacted with (Defaults to false)



Undocumented