---
description: >-
  This page goes through the newly added GSQs and Triggers/Actions as part of
  this mod for content patcher mods to take advantage of.
---

# New Game State Queries

Here are two examples! (1.2.8)

```
         {
/// This trigger action makes a SmallGrassYellowButterfly spawn when
/// a natural common butterfly spawns in the forest.
            "Action": "EditData",
            "Target": "Data/TriggerActions",
            "Entries": {
               "NaNITVTEST_Trigger_0": {
                  "Id": "NiTV_Test_TriggerAction_0",
                  "Trigger": "NAT_NIV_Spawned",
                  "Condition": "LOCATION_Name Target Forest, NAT_NIV_TriggerNameCheck Target CommonButterfly, NAT_NIV_TriggerNaturalCheck Target",
                  "Action": "NAT_NIV_InstantiateSpecificNearTriggered SmallGrassYellowButterfly 2",
                  "MarkActionApplied": false
               }
            }
         },
         {
/// This trigger action makes a SmallGrassYellowButterfly replace a
/// a MonarchButterfly 50% of the time.
            "Action": "EditData",
            "Target": "Data/TriggerActions",
            "Entries": {
               "NaNITVTEST_Trigger_1": {
                  "Id": "NiTV_Test_TriggerAction_1",
                  "Trigger": "NAT_NIV_Spawned",
                  "Condition": "NAT_NIV_TriggerNameCheck Target MonarchButterfly, Random 0.5",
                  "Actions": [
                     "NAT_NIV_InstantiateSpecificNearTriggered SmallGrassYellowButterfly 0",
                     "NAT_NIV_RemoveSpecific MonarchButterfly 1"
                  ],
                  "MarkActionApplied": false
               }
            }
         }
```

\
This mod adds in 4 additional GSQs ([See Game State Query Documentation Here](https://stardewvalleywiki.com/Modding:Game_state_queries))

* NAT\_NIV\_DonatedTotalPercent \<float> - returns true if atleast \<float> percent of creatures have been donated.
* NAT\_NIV\_DonatedSpecific \<string> - returns true if a creature with name \<string> has been donated.
* NAT\_NIV\_CaughtSpecific \<string>  -returns true if a creature with name \<string> has been caught.
* NAT\_NIV\_SpawnedSpecific \<string> - returns true if a creature with name \<string> is currently spawned somewhere.
* (1.2.7) NAT\_NIV\_Exists \<string> - returns true if a creature with name \<string> exists in creature data / is loaded
* (1.2.8) NAT\_NIV\_TriggerNameCheck \<string> - must be given the Target item as given from the NAT\_NIV\_Spawned or NAT\_NIV\_Caught trigger, and a creature name. Compares the spawned/caught creature's name with the given name.
* (1.2.8) NAT\_NIV\_TriggerTileCheck \<float> \<float> - must be given the Target item as given from the NAT\_NIV\_Spawned trigger, and two arguments (Tile X, Tile Y). Compares the spawned creature's tile with the given tile.
* (1.2.8) NAT\_NIV\_TriggerNaturalCheck - must be given the Target item as given from the NAT\_NIV\_Spawned trigger. Returns true if the creature was spawned naturally (Not through trigger action).
* (1.2.8) NAT\_NIV\_TriggerArbitraryCheck \<int> \<whatever> - must be given the Target item as given from the NAT\_NIV\_Spawned trigger. Returns true if the data in creature model position \<int> is the same as \<whatever> with commas replaced by ' marks.

This mod adds in two trigger action actions ([See Trigger Action Documentation Here](https://stardewvalleywiki.com/Modding:Trigger_actions))

* NAT\_NIV\_ClearCreatures - clears the list of spawned creatures.
* NAT\_NIV\_InstantiateSpecificCreature \<string> \<x tile> \<y tile> - spawns creature with name \<string> at tile \<x tile> \<y tile>.
* (1.2.7) NAT\_NIV\_TryCatch \<x position> \<y position> - tries to catch a creature at a given position (NOT TILE, POSITION)
* (1.2.8) NAT\_NIV\_RemoveSpecific \<string> \<count>- clears spawned creature(s) with name \<string>. \<count> is an optional argument to clear only a specific number of creatures with name \<string>. Clears from newest to oldest.
* (1.2.8) NAT\_NIV\_InstantiateSpecificNearTriggered \<string> \<int> - must be called from the NAT\_NIV\_Spawned trigger, spawns an additional creature with name \<string> at a random tile in range \<int> from that creature. set \<int> to 0 to spawn it on top.

This mod adds in one trigger action trigger ([See Trigger Action Documentation Here](https://stardewvalleywiki.com/Modding:Trigger_actions))

* NAT\_NIV\_Spawned - is called when a creature is spawned, and contains as an argument the name of the creature spawned. (1.2.8 - adds two additional arguments for the tile it spawned on, Includes a target item with moddata "NAT\_NIV\_NAME" for the creature's name, and moddata "NAT\_NIV\_TILEX"/"NAT\_NIV\_TILEY" for the tile it spawned on.)
* (1.2.7) NAT\_NIV\_Caught - is called when a creature is caught, and contains the name of the creature caught as an argument. (1.2.8 - Includes a target item with moddata "NAT\_NIV\_NAME" for the creature's name)
