With this function you can override (replace) all instances of an object used in a sequence with another one. You supply the sequence instance struct ID (as returned when the sequence instance was created in the room or by using one of the room layer functions - see here), as well as the object index (as defined in the asset browser) for the object that you want to override. Finally you give an object index or an instance ID to use as the object that is going to override the sequence (supplying an instance ID will simply use the object that the instance was created from as the override). Note that this can only be done on sequence instances (not sequence objects) and must be done before the sequence starts to play, otherwise it won't work.
sequence_instance_override_object(sequence_instance_struct, object_id, instance_or_object_id);
| Argument | Description |
|---|---|
| sequence_instance_struct | The sequence instance struct to modify. |
| object_id | The object index of the object within the sequence to override. |
| instance_or_object_id | The object index or instance ID to use to override the sequence objects. |
N/A
var _seq = layer_sequence_create("Background", 0, 0, seq_AnimatedBackground);
var _seq_inst = layer_sequence_get_instance(_seq); sequence_instance_override_object(_seq_inst, obj_Trees_Winter, obj_Trees_Summer);
The above code creates a new sequence instance on the given layer and then modifies it so that all instances of the object "obj_Trees_Winter" are replaced by instances of the object "obj_Trees_Summer".