1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to Move a Nav Point

Discussion in 'Guides and Tutorials' started by Quantum, Sep 27, 2015.

  1. Quantum

    Quantum Administrator Staff Member

    This tutorial explains how to move a nav point in Saints Row The Third.

    What is a Nav Point?

    Nav points are named x, y, z positions on the world map which are used by game Lua scripts in a number of different ways, most commonly in Mission scripts. The coordinates of these named nav points are defined in zone files. Most Lua functions don't accept x, y, z position coordinates, but accept a nav point name instead. Nav points can be used to trigger actions when the player reaches them, including calling additional Lua functions. They can also be used to move the player to a specific position on the world map. There are probably other uses I haven't discovered yet.

    The particular type of nav point we will be moving in this tutorial is called a "breadcrumb". Breadcrumbs are those visible blue markers that you have to reach at various points during a mission. We will move the first one in Mission 1 slightly, so you can see how it's done. This is the nav point you see in Stilwater Bank when the game tells you to "GO UPSTAIRS".

    This procedure has been tested, and it works!

    PREREQUISITES

    This procedure is not simple, and it's recommended for advanced modders only. Before you try this procedure, here are some things you need to know:
    1. You need to be comfortable using the Windows Command Prompt.
    2. You need to be able to read and edit Lua code.
    3. You need to be able to read and edit XML files.
    4. You need to have a good understanding of how to use Minimaul's tools to unpack and pack game files.
    In addition, you will need to install the following software. For the command-line tools, they should be installed somewhere in your Windows PATH so you can simply run them from the command line:
    1. Saints Row The Third, Steam PC version
    2. IdolNinja's Sandbox+ (to display coordinates)
    3. Minimaul's Gibbed tools (to unpack and pack files)
    4. My Zone File Tools to edit zone files
    STEP BY STEP PROCEDURE

    Step 1: Set up your working directories


    We're going to create some directories (folders) to work in first. Create a new empty directory somewhere on your hard drive which we'll call your "mod project directory". Then create a subdirectory in your mod project directory named "originals". The "originals" subdirectory will contain the original files that you extract from the game using Minimaul's tools. The "mod project directory" will contain the converted XML files we will edit.

    Step 2: Find and Extract Zone File

    In order to move a nav point, you will need to find the zone file it's defined in.

    Mission scripts are in "sr3_city_0.vpp_pc" -> "m##_modal.str2_pc".
    Mission zone files are in "sr3_city_0.vpp_pc" -> "m##.str2_pc".
    where, ## is the two digit mission number, starting at 01.

    Extract the following five files from the game into the "originals" subdirectory:
    1. m01.lua
    2. m01.str2_pc
    3. stream_grid.asm_pc
    4. sr3_city~fm01`.czh_pc
    5. sr3_city~fm01`.czn_pc
    Use Minimaul's tools to extract these files.

    Step 3: Find the nav point you're looking for in the Lua script

    So first, we will play the first mission and walk to the nav point. Once we are near it, we'll use Sandbox+ to display the coordinates of the nav point. Then we can use the coordinates to help find the nav point in the zone file.

    Run the game, and start a new game. Once mission 1 starts, wait until the game tells you to "GO UPSTAIRS". Walk near the nav point. Then press 8 + Insert to display the coordinates with Sandbox+.

    You'll see coordinates displayed similar to these:
    X=2257.5, Y=2691, Z=180.2

    Now swap the Y and Z coordinates, because Sandbox+ displays those coordinates swapped from what the game uses internally:
    X=2257.5, Y=180.2, Z=2691

    Now we will look in the Lua script for some code that looks like the nav point we're looking for. I found the following code that looks like what I want:
    Code (Text):
    -- Set the vault as the next objective.  There's a lot of guards, but not required kills
    function m01_go_to_vault()
        -- Add the bread crumb to lead to the vault
        M01_trigger.pre_vault.hit = false
        if not M01_trigger.freerun.hit then
            -- tell player where to go
            objective_text( 0, "M01_GO_UPSTAIRS", "", "", SYNC_ALL, OI_ASSET_LOCATION )
            m01_set_trigger(M01_trigger.pre_vault.name, "m01_reached_vault_breadcrumb")
            marker_add_trigger(M01_trigger.pre_vault.name, MINIMAP_ICON_LOCATION, INGAME_EFFECT_CHECKPOINT, OI_ASSET_LOCATION, OI_FLAGS_LOCATION, SYNC_ALL)
        end
    and the variable "M01_trigger.pre_vault.name" contains the actual nav point name:
    Code (Text):
    -- Triggers --
    M01_trigger = {
        ...
        pre_vault = {
            name = "vault_trigger 000",
            hit = false
        },
        ...
    From this, it looks like the nav point for "GO UPSTAIRS" is named "vault_trigger 000".

    Step 4: Extract the zone file

    Okay, so now we need to find the nav point "vault_trigger 000" in the mission zone file, but first we need to convert the zone file into something we can edit. To do that, use my SRZoneTool program to convert it.

    Open a Windows Command Prompt in the "mod project directory" which we created above, and run my converter by typing the following command:
    Code (Text):
    SRZoneTool "originals\sr3_city~fm01`.czn_pc" -o "sr3_city~fm01`.xml"
    This will create the file "sr3_city~fm01`.xml" in your mod project directory. This is an XML version of the zone file.

    Step 5: Find nav point "vault_trigger 000"

    Now we need to find the "vault_trigger 000" nav point in the zone file, so open the XML file in your favorite text editor and search for "vault_trigger 000" (without the quotes).

    Here's what I found:
    Code (Text):
    <object index="256">
      <!-- trigger_volume -->
      <name>vault_trigger 000</name>
      <handle>0x0124818A004E018B</handle>
      <parent_handle>0x0000000000000000</parent_handle>
      <object_type_hash>0xF300989F</object_type_hash>
      <padding>0</padding>
      <properties>
        <property index="1">
          <!-- compressed transform -->
          <type>2</type>
          <name_crc>0xC8BEEEC5</name_crc>
          <value>
            <position>
              <x>2257.9775390625</x>
              <y>181.27961730957</y>
              <z>2689.85180664063</z>
            </position>
          </value>
        </property>
        <property index="2">
          <!-- string -->
          <type>0</type>
          <name_crc>0x355EF946</name_crc>
          <value>
            <string>vault_trigger 000</string>
          </value>
          <padding>
            <rawdata format="hex">5E 35</rawdata>
          </padding>
        </property>
        <property index="3">
          <!-- string -->
          <type>0</type>
          <name_crc>0xD3BA8D98</name_crc>
          <value>
            <string>cylinder</string>
          </value>
          <padding>
            <rawdata format="hex">30 57 40</rawdata>
          </padding>
        </property>
        <property index="4">
          <!-- data -->
          <type>1</type>
          <name_crc>0xCD1DC7E7</name_crc>
          <value>
            <rawdata format="hex">00 00 80 3F</rawdata>
          </value>
        </property>
        <property index="5">
          <!-- data -->
          <type>1</type>
          <name_crc>0x5414965D</name_crc>
          <value>
            <rawdata format="hex">35 CA 01 40</rawdata>
          </value>
        </property>
        <property index="6">
          <!-- string -->
          <type>0</type>
          <name_crc>0x0D56D9D3</name_crc>
          <value>
            <string>execute lua script</string>
          </value>
          <padding>
            <rawdata format="hex">53</rawdata>
          </padding>
        </property>
      </properties>
    </object>
     
    That's the nav point object, and, just to be sure, I compare the coordinates to the coordinates I measured above with Sandbox+.

    Yep! These coordinates are very close to the ones I measured.

    Step 6: Move the Nav Point

    Let's try moving the marker just a little bit, to (2250, 180.2, 2696).

    Edit the XML as follows. Change ONLY the x, y, z numeric coordinates. DON'T change anything else in the file:
    Code (Text):
    <property index="1">
      <!-- compressed transform -->
      <type>2</type>
      <name_crc>0xC8BEEEC5</name_crc>
      <value>
        <position>
          <x>2250</x>
          <y>180.2</y>
          <z>2696</z>
        </position>
      </value>
    </property>
     
    Now we will convert the XML file with the changed nav point coordinates back to a zone file.

    Open a Windows Command Prompt in the "mod project directory" and run my converter by typing the following command:
    Code (Text):
    SRZoneTool "sr3_city~fm01`.xml" -o "sr3_city~fm01`.czn_pc"
    Now type the following commands:
    Code (Text):
    mkdir build
    chdir build
    copy ..\originals\m01.str2_pc .
    copy ..\originals\stream_grid.asm_pc .
    Gibbed.SaintsRow3.UnpackSTR2 -v m01.str2_pc
    copy "..\sr3_city~fm01`.czn_pc" m01            (answer yes to overwrite)
    Gibbed.SaintsRow3.PackSTR2 -v m01              (creates "m01_PACKED.str2_pc")
    del m01.str2_pc
    rename m01_PACKED.str2_pc m01.str2_pc
    Gibbed.SaintsRow3.UpdateASM -v stream_grid.asm_pc .
    Now copy "m01.str2_pc" and "stream_grid.asm_pc" from the "build" subdirectory to your Saints Row install directory.

    Run the game, and you will see the nav point is now moved away from the stairs!

    You're done! It's as simple as that! :D

    If you have any questions, let me know. You can use a similar procedure to move nav points in Saints Row IV too.
     
    Last edited: Dec 20, 2016
    [V] Knobby, flow754 and [V] IdolNinja like this.
  2. Quantum

    Quantum Administrator Staff Member

    Updated the XML in the tutorial above to reflect updates to the Zone File Tools version 2.3.
     
  3. I have one question, are nav points only avaible during the mission as part of str2 package or it's posible to use it during freeplay?
     
  4. Quantum

    Quantum Administrator Staff Member

    I haven't checked which zone files have nav points, but if a zone file has a nav point, you should be able to use it as long as it's loaded. But the mission zone files like the one in this tutorial are only available during that mission.