Saving Data

Place to get help with not working mods / modding interface.
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Saving Data

Post by Karutoh »

So right now I'm making a mod called "Factions". Right now I'm unable to save who is the owner of a force. Is there a way to do this, or no? If so, please let me know how! :)
Rseding91
Factorio Staff
Factorio Staff
Posts: 14830
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Saving Data

Post by Rseding91 »

There is no "owner" of a force: just players on a given force. Actually the force doesn't even need to have a player in it. Forces can exist without any players (such as the enemy force and neutral force).
If you want to get ahold of me I'm almost always on Discord.
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Re: Saving Data

Post by Karutoh »

Rseding91 wrote:There is no "owner" of a force: just players on a given force. Actually the force doesn't even need to have a player in it. Forces can exist without any players (such as the enemy force and neutral force).
Sorry, I guess I miss worded it, I'm not the best with introductory posts. I meant how would I be able to save any type of data, like for example a player role in the type of a string such as "owner", "creator", "admin", "moderator", etc... Or maybe an array of players names, or a boolean?
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3731
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Saving Data

Post by DaveMcW »

Code: Select all

global.roles[force][player_index] = "owner"
Everything you care about saving when an event ends should be in the global table.
User avatar
Karutoh
Burner Inserter
Burner Inserter
Posts: 9
Joined: Thu Mar 02, 2017 7:58 am
Contact:

Re: Saving Data

Post by Karutoh »

DaveMcW wrote:

Code: Select all

global.roles[force][player_index] = "owner"
Everything you care about saving when an event ends should be in the global table.
Everything that's not local is automaticly put in the global table, correct? Nevermind, I just re-read this. Thank you all for the help, I really appreciate it! :D
Post Reply

Return to “Modding help”