Error when attempting to change loot of biter spawners

Place to get help with not working mods / modding interface.
Post Reply
ATMunn
Inserter
Inserter
Posts: 37
Joined: Thu Jan 12, 2017 2:22 am
Contact:

Error when attempting to change loot of biter spawners

Post by ATMunn »

I'm trying to change the loot of the biter and spitter spawners to a new item in my mod. However, I'm getting an error saying "data.lua:3: syntax error near '-'"

Here's my data.lua:

Code: Select all

require("prototypes.item")

data.raw.demo-enemies["biter-spawner"].loot = 
{
    {
		{
			count_max = 3,
			count_min = 0,
			item = "alien-egg",
			probability = 0.5
		}
    }
}

data.raw.enemies["spitter-spawner"].loot = 
{
    {
		{
			count_max = 5,
			count_min = 1,
			item = "alien-egg",
			probability = 1
		}
    }
}
When I get rid of the - in demo-enemies it doesn't give me that specific error, but it still won't work, because as far as I know, there's no other way to refer to the __base__/prototypes/entity/demo-enemies without the dash. Any way around this? (or am I missing something?)

keyboardhack
Filter Inserter
Filter Inserter
Posts: 478
Joined: Sat Aug 23, 2014 11:43 pm
Contact:

Re: Error when attempting to change loot of biter spawners

Post by keyboardhack »

You can't refer to a variable with a - in it like that. You have to refer to it the same way you did to the biter-spawner variable. Replace line 3 with:

Code: Select all


data.raw["demo-enemies"]["biter-spawner"].loot = 
Waste of bytes : P

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Error when attempting to change loot of biter spawners

Post by Nexela »

Also they type is not demo-enimies it is unit-spawner, and you have one too many tables

Code: Select all

data.raw["unit-spawner"]["biter-spawner"].loot = 
  {
    {
      count_max = 3,
      count_min = 0,
      item = "alien-egg",
      probability = 0.5
    }
  }

ATMunn
Inserter
Inserter
Posts: 37
Joined: Thu Jan 12, 2017 2:22 am
Contact:

Re: Error when attempting to change loot of biter spawners

Post by ATMunn »

Ah, I get it now. I was going off a previous example for changing recipes, and assuming that the thing after data.raw was the file in the base game it was in. That makes sense, thanks.

Post Reply

Return to “Modding help”