Page 1 of 1
Resetting technology
Posted: Tue Oct 01, 2013 10:57 am
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
Re: Resetting technology
Posted: Tue Oct 01, 2013 1:38 pm
by ficolas
game.player.force.technologies["name"].reset()
Where name is the name of your tech.
Add this to the migration script.
Re: Resetting technology
Posted: Tue Oct 01, 2013 1:52 pm
by Nirahiel
I don't know wht a migration file is
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 ..
Re: Resetting technology
Posted: Tue Oct 01, 2013 5:23 pm
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()"
Re: Resetting technology
Posted: Tue Oct 01, 2013 5:27 pm
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.
Re: Resetting technology
Posted: Tue Oct 01, 2013 5:32 pm
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.
Re: Resetting technology
Posted: Tue Oct 01, 2013 5:44 pm
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