So the code changes should be:
Did I get it right? I'm new to the MS so it's quite a hard task for me
(ti_on_init_scene_prop,
[
(store_trigger_param_1, ":instance_id"),
(prop_instance_get_variation_id, ":door_link_number", ":instance_id"),
(scene_prop_get_num_instances, ":door_count", "spr_teleport_1side_5"),
(try_for_range, "ther_instance_no", 0, ":door_count"),
(scene_prop_get_instance, "ther_instance_id", "spr_teleport_1side_5_destination", "ther_instance_no"),
(neq, "ther_instance_id", ":instance_id"),
(prop_instance_get_variation_id, "ther_door_link_number", "ther_instance_id"),
(eq, "ther_door_link_number", ":door_link_number"),
(prop_instance_get_position, pos1, "ther_instance_id"),
(prop_instance_get_position, pos2, ":instance_id"),
(position_move_y, pos1, 50),
(try_for_agents, ":agent", [pos2], [5]), #gets added
(ge,":agent",0),
(agent_is_active,":agent"),
(agent_is_alive, ":agent"),
#gets removed
(agent_get_position, pos0, ":agent"),
(get_distance_between_positions_in_meters, ":distance_to_target_pos", pos0, pos2),
(lt, ":distance_to_target_pos", 5),
(agent_set_position, ":agent", pos1),
(assign, ":door_count", -1),
(try_end),
(try_end),
]),
[
(store_trigger_param_1, ":instance_id"),
(prop_instance_get_variation_id, ":door_link_number", ":instance_id"),
(scene_prop_get_num_instances, ":door_count", "spr_teleport_1side_5"),
(try_for_range, "ther_instance_no", 0, ":door_count"),
(scene_prop_get_instance, "ther_instance_id", "spr_teleport_1side_5_destination", "ther_instance_no"),
(neq, "ther_instance_id", ":instance_id"),
(prop_instance_get_variation_id, "ther_door_link_number", "ther_instance_id"),
(eq, "ther_door_link_number", ":door_link_number"),
(prop_instance_get_position, pos1, "ther_instance_id"),
(prop_instance_get_position, pos2, ":instance_id"),
(position_move_y, pos1, 50),
(try_for_agents, ":agent", [pos2], [5]), #gets added
(ge,":agent",0),
(agent_is_active,":agent"),
(agent_is_alive, ":agent"),
#gets removed
(agent_get_position, pos0, ":agent"),
(get_distance_between_positions_in_meters, ":distance_to_target_pos", pos0, pos2),
(lt, ":distance_to_target_pos", 5),
(agent_set_position, ":agent", pos1),
(assign, ":door_count", -1),
(try_end),
(try_end),
]),