Fields of Mistria — Vanilla GML Reference FoM v1.0.8

obj_caldarus_house_statue.gml

object_create(
    "obj_caldarus_house_statue",
    object_reserve("par_ledger"),
    {
        sprite_index: spr_caldarus_house_dragon_statue,
        create: function() {
            self.depth = get_instance_depth(self.y);
            event_inherit(ObjectEvent.Create);

            self.register_interaction(
                InputId.Interact,
                "misc_local/teleport",
                function() {
                    if ARI.get_essence() >= 10  {
                        play_conversation_from_path(NpcId.Caldarus, GAMEPLAY_CONVERSATIONS[GpTriggeredConversation.CaldarusTeleportFarm], function(driver) {
                            if driver.prompt_index_selected == 0 {
                                TANGO.play("SoundEffects/Inventory/SpendEssence");
                                ARI.modify_essence(-10);
                                var point = trellis_point("farm/teleport_target");
                                ari_teleport_to_room(LocationId.Farm, point.x, point.y);
                            }
                        });
                    } else {
                        play_conversation_from_path(NpcId.Caldarus, GAMEPLAY_CONVERSATIONS[GpTriggeredConversation.CaldarusTeleportFail]);
                    }
                },
                function() {
                    return npc_is_unlocked(NpcId.Caldarus) && !TAXI.is_traveling();
                }
            );

            self.setup_offsets("caldarus_house_statue");
            self.bubble_icon_big = spr_ui_bark_icon_essence;
            self.bubble_icon_small = spr_ui_bark_icon_essence_small;
        },
    }
);