Osiris/API/ActivatePersistentLevelTemplate
From Divinity Engine Wiki
Full Definition(s)
- call ActivatePersistentLevelTemplate((LEVELTEMPLATEGUID)_LevelTemplate)
Description
Makes the persistent level template instance _LevelTemplate in the current level/region active. If previously another persistent instance of that level template was active (in this level/region or in another one), by default all interactive objects present in that previous instance (within the LevelTemplateBoundTrigger specified in the Level -> Edit Level Data... of the template level) will be teleported to the newly activated one. This not only holds for objects defined inside the level template, but also for characters that entered the level template instance or items that were dropped there.
Notes
- Characters that get teleported as a result of this activation and that were in combat, will leave this combat. They may immediately enter it again in case the alignments of nearby characters cause combat to start though. Items will remain in the combats they were involved in, if any. If you wish combats to remain active, use ActivatePersistentLevelTemplateWithCombat instead.
- To turn part of a level into a level template, select the objects, right-click and select Export to a level template...
- Level templates are grouped under the root templates and can be inserted like any other object into a level.
- In order to make a level template instance persistent, select it after inserting it, and mark its Persistent property.
- If a level/region contains one or more persistent instances of a level template, you can define which one should be activated when the level first gets loaded by marking its IsStartingActive property. If no instance is marked like this, a random one will be activated upon level load.
- Objects (characters, items, triggers) from a persistent level template can be directly referred (using their GUID inside the template level) both from Osisiris and behaviour scripts running in the level that contains the persistent level template instance. This is possible even if these objects are local, and these references will always refer to those object in whichever persistent level template instance is currently active.
- If you want certain objects not to be transferred to the next activated instance of a persistent level template, you can tag them with NO_LEVELTEMPLATE_TRANSFER