Resetting technology

Place to get help with not working mods / modding interface.
Nirahiel
Filter Inserter
Filter Inserter
Posts: 351
Joined: Mon Sep 23, 2013 2:18 pm
Contact:

Resetting technology

Post by Nirahiel »

Hi.
I modified my mod to create a new technology.
But now one of my custom technologies needs to require this one first.
Will it work directly in old saves or do I have to reset the tech somehow so that players will have to research the previous tech first before having access to this one ?
Thanks :)
ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Resetting technology

Post by ficolas »

game.player.force.technologies["name"].reset()
Where name is the name of your tech.
Add this to the migration script.
Nirahiel
Filter Inserter
Filter Inserter
Posts: 351
Joined: Mon Sep 23, 2013 2:18 pm
Contact:

Re: Resetting technology

Post by Nirahiel »

I don't know wht a migration file is :D

Edit : found out how to make a migration file.
Now the problem is, i want the previous tech to be already researched if the other one is, how do I do this ?
the field "researched" is read only.
enable() will only allow players to research it ..
SilverWarior
Filter Inserter
Filter Inserter
Posts: 559
Joined: Mon Mar 04, 2013 9:23 am
Contact:

Re: Resetting technology

Post by SilverWarior »

Nirahiel wrote:Now the problem is, i want the previous tech to be already researched if the other one is, how do I do this ?
the field "researched" is read only.
enable() will only allow players to research it ..
In migration script first check to see if the other techonology is already researched by the player.
If it is you do nothing if it is not then you call "game.player.force.technologies["name"].reset()"
Nirahiel
Filter Inserter
Filter Inserter
Posts: 351
Joined: Mon Sep 23, 2013 2:18 pm
Contact:

Re: Resetting technology

Post by Nirahiel »

You don't get it, so i'll explain :
Before I had technology A.
Now I added technology B that's REQUIRED to even be able to research A.
I want to make it so everyone with already A don't have to research B. using reset() won't enable B is they already have A. That's what I want to do.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Resetting technology

Post by FreeER »

to set whether it is enabled or not you can use game.player.force.technologies["name"].setresearched(true) or false if you needed to do that later.
<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
Nirahiel
Filter Inserter
Filter Inserter
Posts: 351
Joined: Mon Sep 23, 2013 2:18 pm
Contact:

Re: Resetting technology

Post by Nirahiel »

FreeER wrote:to set whether it is enabled or not you can use game.player.force.technologies["name"].setresearched(true) or false if you needed to do that later.
That's what I wanted ! Thanks :D
Post Reply

Return to “Modding help”