[0.3.0] Unlock your items from the default technologies

Place to get help with not working mods / modding interface.
I_IBlackI_I
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Wed Feb 20, 2013 6:57 pm
Contact:

[0.3.0] Unlock your items from the default technologies

Post by I_IBlackI_I »

Hello, :?:

Is there a way to unlock my crafting recipies after the person researched "automation".
Or do i need to make my own technologies,

thanks,

I_IBlackI_I

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: [0.3.0] Unlock your items from the default technologies

Post by ficolas »

You can modify the technologies, read the post slpwnd posted

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: [0.3.0] Unlock your items from the default technologies

Post by slpwnd »

You can modify the existing technologies. Try something like this in the data.lua of your mod:

Code: Select all

local automationeffects = data.raw.technology.automation.effects
automationeffects[#automationeffects + 1] = {type="unlock-recipe", recipe="your-recipe-name-here"}

I_IBlackI_I
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Wed Feb 20, 2013 6:57 pm
Contact:

Re: [0.3.0] Unlock your items from the default technologies

Post by I_IBlackI_I »

after an hour of trying different things it still cant load the graphics here is my mod:

http://www.mediafire.com/download.php?4l3fi2rbj5g7jqq

If some things are wrong it might also be because of me changing everything around to try to get it working :?

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [0.3.0] Unlock your items from the default technologies

Post by FreeER »

I_IBlackI_I wrote:after an hour of trying different things it still cant load the graphics here is my mod:
http://www.mediafire.com/download.php?4l3fi2rbj5g7jqq
If some things are wrong it might also be because of me changing everything around to try to get it working :?
Two problems are causing this, both are spelling errors. The first inside of prototypes\entity\inserters.lua you miss-spelled inserters when you told the game where the graphics were so it was looking in inseters.
Second in graphic/entity/inserters the inverted-longhanded-inserter-platform has two .pngs so it is inverted-longhanded-inserter-platform.png.png. the game is looking for a picture named inverted-longhanded-inserter-platform.png so remove one .png from the filename
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [0.3.0] Unlock your items from the default technologies

Post by FreeER »

slpwnd wrote:You can modify the existing technologies. Try something like this in the data.lua of your mod:

Code: Select all

local automationeffects = data.raw.technology.automation.effects
automationeffects[#automationeffects + 1] = {type="unlock-recipe", recipe="your-recipe-name-here"}
I figured I'd try this out using ficolas's mod (since he forgot to add the creeper loot lol) and was wondering why I had to directly modify data.raw.creeper.loot
Initially I had

Code: Select all

creeperloot=data.raw.unit.creeper.loot
creeperloot = {
      {
        count_max = 10,
        count_min = 2,
        item = "small-alien-artifact",
        probability = 1
      }
             }
I was expecting it to work, or error on loot being nil, since the creepers do not typically have any loot. Instead it looked like it worked but nothing dropped...was just wondering why I get no error and no loot using the local variable, and yet it works if i modify it directly.

Code: Select all

data.raw.unit.creeper.loot = {
      {
        count_max = 10,
        count_min = 2,
        item = "small-alien-artifact",
        probability = 1
      }
             }
edit: if someone wants to test this code without having ficolas's f-mod installed all you need to do is change small-alien-artifact to alien-artifact
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: [0.3.0] Unlock your items from the default technologies

Post by slpwnd »

FreeER wrote: Initially I had

Code: Select all

creeperloot=data.raw.unit.creeper.loot
creeperloot = {
      {
        count_max = 10,
        count_min = 2,
        item = "small-alien-artifact",
        probability = 1
      }
             }
I was expecting it to work, or error on loot being nil, since the creepers do not typically have any loot. Instead it looked like it worked but nothing dropped...was just wondering why I get no error and no loot using the local variable, and yet it works if i modify it directly.
This won't work because of the way Lua works. After

Code: Select all

 creeperloot=data.raw.unit.creeper.loot
creeperloot variable either contains a copy of the variable in loot or "points" to it (depending whether this is mutable or immutable structure). However either way if you "rebind" the variable by

Code: Select all

creeperloot = {
...
}
You don't change the original loot object. In the original loot there is whatever has been there before and the creeperloot will eventually go out of scope.
FreeEr wrote:

Code: Select all

data.raw.unit.creeper.loot = {
      {
        count_max = 10,
        count_min = 2,
        item = "small-alien-artifact",
        probability = 1
      }
             }
This works because you are assigning directly into the loot.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: [0.3.0] Unlock your items from the default technologies

Post by FreeER »

Ah, thanks for clarifying that for me :) I started thinking it was something along those lines before I posted but wasn't sure since I knew I'd read in one of the lua tutorials I've found that variables can 'point' to the data, but I hadn't realized (that logically) by reassigning the variable it changes the variable and not what it is pointing to :D
At least I did find the proper way :)
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net

Post Reply

Return to “Modding help”