Subregions and Map Markers.

Larian uses Subregions to display map markers for important locations on the map. This works well because you can easily turn the marker on only after the player has visited the location.

Step 1 - Place a new trigger and name it.

A. The larian convention is SUBREGION_YOURTRIGGERNAME.
B. Right click your new trigger and copy the "name <GUID>" to clipboard.
[Linked Image]
C. Paste it somewhere for later, you'll need it.
D. It should look something like this "SUBREGION_Camp <4d391200-5791-40a2-a324-d91216463605>"

Note: The trigger should be a box, poly, or sphere trigger. Do not use a region trigger as the name implies.


Step 2 - Script you need:


Example:
[Linked Image]


INIT
DB_Subregion(TRIGGER_YOUR_TRIGGER,"SUBREGION_YOUR_TRIGGER",1);


KB

IF
DB_Subregion(_Trigger,_,_)
THEN
ProcTriggerRegisterForPlayers(_Trigger);

IF
CharacterEnteredTrigger(_Character,_Trigger)
AND
DB_Subregion(_Trigger,_Message,_ShowMarker)
THEN
CharacterEnteredSubRegion(_Character,_Message);
ProcCheckSetRegionMarker(_Message,_ShowMarker);

PROC
ProcCheckSetRegionMarker((STRING)_Message,1)
THEN
ProcShowMarker(_Message);


The script above will work if you already are using the Standalone Project Template.
If you do not wish to use the template, it will still work. But you must register every trigger for players manually in the INIT section as an additional step.

Also note that the last integer can be set to a 0 or 1.

If it's 0 the map marker will not show up on the map but the overhead banner will still be displayed.

If set to a 1 both the marker and the banner display will show.


Step 3: Create a "marker_prototypes.lsx" file.

A. This file is located in Data\Mods\(YOUR MOD HERE)\Story\Journal.
B. Make a blank text file in this location with the name "marker_prototypes.lsx" If you already have one just open it.
C. Add an entry as such:
[Linked Image]
Code
<?xml version="1.0" encoding="UTF-8" ?>
<save>
  <region  id="Markers">
      <node  id="root">
          <children>        
            <node id ="Marker">
                <attribute id="MarkerID" value="SUBREGION_Residential" type="22"/>
                <attribute id="MarkerLevel" value="test1" type="22"/>
                <attribute id="MarkerTargetObjectUUID" value="SUBREGION_Residential <2361590f-00ea-47c4-8590-bb7cf6cb7141>" type="22"/>
                <attribute id="MarkerTargetObjectType" value="Trigger" type="22"/>
                <attribute id="MarkerIcon" value="LocationMarker" type="22"/>
                <attribute id="DisplayText" value="Residential District" handle="" type="28"/>
            </node>
          </children>
      </node>
  </region>
</save>

For "MarkerTargetObjectUUID, paste in your trigger's "Name <GUID>" that we copied back in step 1.

Save the file.


Step 4 - Add a Translated String Key entry.

A. In the Translated String key, create a new key called "Subregions". If you already have one open it.

B. For the key name use the same one to match the "Marker_Prototypes" file.

[Linked Image]

C. Save your work.



You're Finished!

Now when your character enters the trigger an overhead banner should appear. Also a brown square map marker will be placed on your worldmap exactly where the trigger is placed.

[Linked Image]


There are other types of markers like those for secrets. You can see how to add these by unpacking main and finding the file "marker_prototypes.lsx" using LSTools. They are very similar to Subregions.

Last edited by SniperHF; 22/07/15 04:34 AM.