# Switching between sector states

{% hint style="info" %}
This page contains the theory of sector variants, for creating sectors with variants, head over to the [Creating Sector Variants](https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/world-editing/object-spawner/features-and-guides/creating-sector-variants) guide
{% endhint %}

## Summary

**Published:** Jan 07 2025 by [Sergey](https://app.gitbook.com/u/N691cVEMA0Nmecc6QHIAM73aI0z1 "mention")\
**Last documented edit:** Jan 08 2025 by [mana vortex](https://app.gitbook.com/u/NfZBoxGegfUqB33J9HXuCs6PVaC3 "mention")

This page will show you how to switch sector states.

### Wait, this is not what I want!

* To learn more about `.streamingsector` files, check [https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/blob/main/for-mod-creators-theory/files-and-what-they-do/file-formats/the-whole-world-.streamingsector](https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/blob/main/for-mod-creators-theory/files-and-what-they-do/file-formats/the-whole-world-.streamingsector "mention")
* To learn about `.streamingblocks`, check [.streamingblock-sector-definitions-and-variants](https://wiki.redmodding.org/cyberpunk-2077-modding/for-mod-creators-theory/files-and-what-they-do/file-formats/the-whole-world-.streamingsector/.streamingblock-sector-definitions-and-variants "mention")
* For a list of node types, check [reference-.streamingsector-node-types](https://wiki.redmodding.org/cyberpunk-2077-modding/for-mod-creators-theory/references-lists-and-overviews/reference-world-sectors/reference-.streamingsector-node-types "mention")
* check [..](https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/world-editing "mention") -> [adding-locations-and-structures-with-archivexl](https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/world-editing/archived-guides/adding-locations-and-structures-with-archivexl "mention") if that's what you'd rather do

### World state variants

Here is an overview of file relations between `.streamingsector` and -`block`:

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-bde3cacef33d350e41a55a2b27677575747de68a%2Fworld_streamingsector__resume.png?alt=media" alt=""><figcaption></figcaption></figure>

### Streamingblock

The game contains only 3 streamingblocks that gather more than 26300 sectors.\
We will focus on the main one and take a look at the first sector inside (`exterior_-18_3_-12_0`).

{% hint style="info" %}
When creating a mod with sectors, you will need to create your own block that will list your new sectors.
{% endhint %}

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-aa7b12265b7b70f58f5bb1b5fc2f018572434067%2Fworld_streamingsector__block.png?alt=media" alt=""><figcaption></figcaption></figure>

This sector has 10 variants, in this case, each one is related to a quest state.

`numNodeRanges` indicate the number of node ranges the sector contains; it always corresponds to the number of variant + sector's default range (so here 10 variants + 1 default).

When opening a variant definition, we can find the range index (to find the right range inside the sector file). `rangeIndex` cannot be 0, 0 is used as sector's default range.

Variant's name is only used to identify the variant within the streamingblock.

<figure><img src="https://1427525421-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4gzcGtLrr90pVjAWVdTc%2Fuploads%2Fgit-blob-0f7cb2fb36853a0c24c286fe2e763e88a31a8797%2Fworld_streamingsector__block_variant.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The link between quests and sectors' variants is not well-researched as of Jan 2024 - if you know anything more about this, please get in touch via [Discord](http://discord.gg/redmodding) or update the wiki!
{% endhint %}

### Defining a new variant

In the [.streamingsector file](https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/blob/main/for-mod-creators-theory/files-and-what-they-do/file-formats/the-whole-world-.streamingsector), add a new entry in each of these lists:

* [variantIndices](https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/blob/main/for-mod-creators-theory/files-and-what-they-do/file-formats/the-whole-world-.streamingsector#variantindices)
* [variantNodes](https://github.com/CDPR-Modding-Documentation/Cyberpunk-Modding-Docs/blob/main/for-mod-creators-theory/files-and-what-they-do/file-formats/the-whole-world-.streamingsector#variantnodes)

## How to trigger a switch

To trigger a switch between sector states, you can use

* .questphase files
* [Codeware](https://github.com/psiberx/cp2077-codeware/wiki#controlling-prefabs-and-variants) via redscript/CET


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.redmodding.org/cyberpunk-2077-modding/modding-guides/world-editing/archived-guides/switching-between-sector-states.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
