Tutorial:Modding FAQ: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
m (→‎Modding FAQ: Edited how to fix when recipies and technologies are changed to make it compatible with multiplayer games.)
(Add irc info and fix a display issue)
Line 16: Line 16:
  number.  So if your mod is tittled "myMod" version 0.0.1, in order
  number.  So if your mod is tittled "myMod" version 0.0.1, in order
  for Factorio to read it, the folder must be titled "myMod_0.0.1".
  for Factorio to read it, the folder must be titled "myMod_0.0.1".
|}


{| style="width: 99%;"
|style="width:34%;background: #F9F9F9; border: 1px solid #AAAAAA; vertical-align: top; -moz-border-radius: 5px; -webkit-border-radius: 5px; padding: 7px;"|
<div style="background: #E4F0F7; padding: 5px; margin: 3px; font-weight: bold; text-align: center; color: #033251; font-size: 120%;">
'''Questions / Fix'''</div><div style="padding-left: 1em;">
* Q : my item / entity wont load the sprite I made.
* Q : my item / entity wont load the sprite I made.
* Fix :  
* Fix :  
Line 54: Line 49:
* Fix : You need to run <pre style="display:inline-block">for i, player in ipairs(game.players) do player.force.resetrecipes() end</pre> and/or <pre style="display:inline-block">for i, player in ipairs(game.players) do player.force.resettechnologies() end</pre>  
* Fix : You need to run <pre style="display:inline-block">for i, player in ipairs(game.players) do player.force.resetrecipes() end</pre> and/or <pre style="display:inline-block">for i, player in ipairs(game.players) do player.force.resettechnologies() end</pre>  
To make Factorio reload the prototypes, this can be done using the console (~) or via the game.oninit event in control.lua (which will run when the mod is first added to a game), or through [[Migration_scripts|migration]] files (if you've made a mod release and need to 'migrate' user's saves to a new version automatically). The first is the easiest while testing, the second when you're releasing a mod for the first time, and the third for when you've already made a mod release. The prototypes are saved in the save file so as to (eventually) allow making changes to them during runtime (control.lua), which is why they need to be 'reset' for saves.
To make Factorio reload the prototypes, this can be done using the console (~) or via the game.oninit event in control.lua (which will run when the mod is first added to a game), or through [[Migration_scripts|migration]] files (if you've made a mod release and need to 'migrate' user's saves to a new version automatically). The first is the easiest while testing, the second when you're releasing a mod for the first time, and the third for when you've already made a mod release. The prototypes are saved in the save file so as to (eventually) allow making changes to them during runtime (control.lua), which is why they need to be 'reset' for saves.
* If you have anymore questions or just want to come socialize, we have an official and un-official irc channel:
<pre style="display:inline-block">Official Factorio Channel
IRC Server: irc.esper.net
Channel Name: #factorio
Un-Offical Modding Channel
IRC Server: irc.esper.net
Channel Name: #factorio-modding</pre>


|}
|}

Revision as of 04:33, 2 January 2016

Modding FAQ

< Main Page

Welcome to the modding FAQ. (work in progress) Here we have a list of questions that are common to get while writing a mod. And the fix for the problem (if someone managed to find a fix) feel free to edit this page and add more Q and A's.

Questions / Fix
  • Q : Why do I get the error "C:\Factorio\mod doesn't match the expected mod_version# (case sensitive!)" error?
  • Fix :
For some reason, the folder name of your mod must include the version
number.  So if your mod is tittled "myMod" version 0.0.1, in order
for Factorio to read it, the folder must be titled "myMod_0.0.1".
  • Q : my item / entity wont load the sprite I made.
  • Fix :
Make sure your path is right : __mod-name__/map-name/2nd-map-name/sprite.png
Pay attention to case, the following file is not the same as previous:__Mod-name__/Map-name/2nd-map-name/sprite.PNG
  • Q : The name of my item is displayed as "Unknown key: item-name.yourname"
  • Fix :
Make sure you have valid locale mappings. Create a "locale" directory with an "en" subdirectory and create a "item-name.cfg" file.
It should contains something like:
 [item-name]
 itemx=Item X
 itemy=Item Y
 
 Do the same for your entities, but put them in an "entity-name" section/file.
  • Q : What does ('=' character not found in line) mean?
  • Fix :
If you get the error message '=' character not found in line , chances are you 
created a new document as something other than a .txt file, adding in format text
to  the document that is causing this error.  Copy the contents of your .cfg file
and make a new .txt file, rename it to .cfg, and paste your configuration into it.
  • Q : Error while loading prototype "entity-name": No such node (pictures).
  • Fix :
Make sure your entity contains the right amount of lines for that type of entity, 
for example a chest needs 1 picture for the entity to work but a wall needs 20. 
Look in the factorio base/prototypes/entity/entity.lua.
And you can see that different entities need different amounts of pictures.


  • Q : I've modified the recipe and/or technology prototypes and when I load my save game the changes aren't there even though it works in a new game.
  • Fix : You need to run
    for i, player in ipairs(game.players) do player.force.resetrecipes() end
    and/or
    for i, player in ipairs(game.players) do player.force.resettechnologies() end

To make Factorio reload the prototypes, this can be done using the console (~) or via the game.oninit event in control.lua (which will run when the mod is first added to a game), or through migration files (if you've made a mod release and need to 'migrate' user's saves to a new version automatically). The first is the easiest while testing, the second when you're releasing a mod for the first time, and the third for when you've already made a mod release. The prototypes are saved in the save file so as to (eventually) allow making changes to them during runtime (control.lua), which is why they need to be 'reset' for saves.


  • If you have anymore questions or just want to come socialize, we have an official and un-official irc channel:
Official Factorio Channel
IRC Server: irc.esper.net
Channel Name: #factorio

Un-Offical Modding Channel
IRC Server: irc.esper.net
Channel Name: #factorio-modding