Specifically, I am trying to find where the code is for "https://forums.factorio.com/wiki/inde ... inprogress" so I can modify it in my mod.
I want to make a New Game Plus mod where the player can load up a "cargo plane" and have that plane spawn in a new map (or at least the contents of the plane). The problem is, I am new to C++ and coding in general, so I need to see an example in order to modify it -- hence why I need to find the getshiplandinginprogress code.
Where are the Lua/Force files located?
Re: Where are the Lua/Force files located?
At the current time (and i don't think this will change in future) you can not mod the c++ part. The only available language for modding is lua.
But i dont think this code would help you as getshiplandinginprogress should only be a simple getter function for an internal gamestate. This is because shiplanding at its current form is only a count down, that gets startet when you place a rocket defense.
If you haven't heart yet: what you're trying to mod is very similar to the plans for the next releases (proper endgame content). See the Friday Facts of the last weeks for more details.
When you have played the campaigns you might have noticed, that you often have to gather resources for the next level. But in the next level, at a nother spot you always start with the same resources ans sience researched independent what you researched/gathered in the former level. What im trying to say: Your plan won't work, as it is not supported.
But i dont think this code would help you as getshiplandinginprogress should only be a simple getter function for an internal gamestate. This is because shiplanding at its current form is only a count down, that gets startet when you place a rocket defense.
If you haven't heart yet: what you're trying to mod is very similar to the plans for the next releases (proper endgame content). See the Friday Facts of the last weeks for more details.
When you have played the campaigns you might have noticed, that you often have to gather resources for the next level. But in the next level, at a nother spot you always start with the same resources ans sience researched independent what you researched/gathered in the former level. What im trying to say: Your plan won't work, as it is not supported.
Re: Where are the Lua/Force files located?
Thank you for your reply Kevin94. I know they are working on end-game content, but I don't want to wait 2 months for it. Since I clearly have the time, I don't see why I shouldn't make a mod for myself (and others) in the mean time to add to the life of the end-game.
The plan I had was to make a mod that added a small C++ variable to store the values of the items in an array, and to use that array to change the lua starting equipment.
So, you load up your "chest" with the 5 items you want to take with you. Those items get stored in an external array. A separate "FreeMode+" will exist, that will have lua code to allow for the player to start with the 5 items they wanted to carry over in their inventory.
So... it would look like this in the control.lua for the "FreeMode+"
Since I think you're right that I cannot do that, I'm instead working on making it so there's a "FreeMode+" with a modified starting inventory. The problem is, I am still new to lua code and don't know how to prevent it from being available until certain conditions are met (such as filling that "cargo plain" chest with the required items). I'm mimicking the code from chapter 2 of the beta missions.
The plan I had was to make a mod that added a small C++ variable to store the values of the items in an array, and to use that array to change the lua starting equipment.
So, you load up your "chest" with the 5 items you want to take with you. Those items get stored in an external array. A separate "FreeMode+" will exist, that will have lua code to allow for the player to start with the 5 items they wanted to carry over in their inventory.
So... it would look like this in the control.lua for the "FreeMode+"
Code: Select all
game.oninit(function()
local character = game.player.character
character.insert{name="iron-plate", count=8}
character.insert{name="pistol", count=1}
character.insert{name="basic-bullet-magazine", count=10}
character.insert{name="burner-mining-drill", count = 1}
character.insert{name="stone-furnace", count = 1}
character.insert{name="carry-over-item[0]", count = carry-over-amount[0]}
character.insert{name="carry-over-item[1]", count = carry-over-amount[1]}
character.insert{name="carry-over-item[2]", count = carry-over-amount[2]}
character.insert{name="carry-over-item[3]", count = carry-over-amount[3]}
character.insert{name="carry-over-item[4]", count = carry-over-amount[4]}
initattackdata()
game.showmessagedialog(gt("msg-intro"))
end)
Re: Where are the Lua/Force files located?
You can give items any time of the day with lua commands in your own custom control.lua
something like this
Then set up some event, say, when the plane is full... just add 'give_items()' in the script and it will give them what you'd like.
something like this
Code: Select all
function give_items()
game.player.insert({name = "coin" , count = 100})
game.player.insert({name = "iron-plate" , count = 100})
game.player.insert({name = "copper-plate" , count = 100})
game.player.insert({name = "rocket-defense" , count = 100})
end
Re: Where are the Lua/Force files located?
Yepp, that's what I was thinking of doing. Thank you for the consistent and speedy replies by the way!
The problem I'm encountering presently has to do with getting my mod to load sprites (I ensured it was spelled exactly the same as the file path, as stated on the Modding FAQ, so I'm not sure why it isn't working. Maybe it has to do with needing to put the version number in the folder name, but at this point I've kind of just given up on custom graphics of any kind).
On the note of my original idea, it seems you can save text to a file using LUA code, the problem seems to be reading that information from the file after saving it. MakeFile. Any thoughts on how to retrieve that data from the file once it's outputted?
If I can do that, then it's a simple (if tedious) list of "if, than, else" or whatever the equivalent of C++ "case" is for lua to make the new game carry over whatever the player puts in that plane, and since MAKEFILE saves the data to an external file, I could let a person start the custom "New Game Plus" freemode map with whatever they previously had in their original "freeplay" game!
The problem I'm encountering presently has to do with getting my mod to load sprites (I ensured it was spelled exactly the same as the file path, as stated on the Modding FAQ, so I'm not sure why it isn't working. Maybe it has to do with needing to put the version number in the folder name, but at this point I've kind of just given up on custom graphics of any kind).
On the note of my original idea, it seems you can save text to a file using LUA code, the problem seems to be reading that information from the file after saving it. MakeFile. Any thoughts on how to retrieve that data from the file once it's outputted?
If I can do that, then it's a simple (if tedious) list of "if, than, else" or whatever the equivalent of C++ "case" is for lua to make the new game carry over whatever the player puts in that plane, and since MAKEFILE saves the data to an external file, I could let a person start the custom "New Game Plus" freemode map with whatever they previously had in their original "freeplay" game!
Re: Where are the Lua/Force files located?
I also thought about using makefile. But at the current time there is no read counterpart (afair they removed it because of some security issues). You can write the data and then prompt the user to manually copy it in a text field like blueprint mod/Foreman do it.
Addressing your graphics Problem, You have to specify the path like so: __ModNameWithoutVersion__/PathWithinModFolder/file.png
Addressing your graphics Problem, You have to specify the path like so: __ModNameWithoutVersion__/PathWithinModFolder/file.png