The "vngen_char_replace" Function

Syntax

vngen_char_replace(name, spr_body, spr_face_idle, spr_face_talk, face_x, face_y, flip, duration, [ease]);
ArgumentTypeDescription
namestringThe ID of the character to replace
spr_bodyspriteThe new sprite to draw as a character body
spr_face_idlespriteThe new sprite to draw as an idle face (or keyword none for none)
spr_face_talkspriteThe new sprite to draw as a talking face (or keyword none for none)
face_xrealThe horizontal position to display the face, relative to the body sprite top-left corner (or keyword previous for no change)
face_yrealThe vertical position to display the face, relative to the body sprite top-left corner (or keyword previous for no change)
flipbooleanEnables or disables horizontally flipping the character
durationrealSets the duration of the fade transition, in seconds
[ease]integer/macroOptional: Sets the ease mode to perform the transition in

Description

Replaces the input entity ID with a new set of sprites and fades the old character to the new one over the input duration.

Note that using separate face sprites is optional. If only a body sprite is desired, spr_face_idle and spr_face_talk can be set to -1 or the keyword none to disable them.

As with other types of modifications, replacements made with this script are permanent and will persist until another replacement is performed. This script cannot be performed simultaneously with other replacement actions operating on the same entity ID.

See Macros & Keywords for a list of available ease modes.

Example

if (vngen_event()) {
vngen_char_replace("John Doe", spr_new_body, spr_new_idle, spr_new_talk, 256, 384, true, 1);
}