A list of questions I'm unsure about for my mod.

Place to get help with not working mods / modding interface.
Post Reply
User avatar
StormyStrife
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon May 11, 2020 12:38 am
Contact:

A list of questions I'm unsure about for my mod.

Post by StormyStrife »

I have a ton of questions, so I figured I'd ask here.

I'm working on a mod, probly ambitious for my current abilities, I dunno, but basically, I don't know much lua, I get the syntax of it all, more or less, and I'm learning just how versatile all the properties are and how they work, but for actual deep-dive programming, I'm still pretty much a noob.

Here's the context: My second mod, I'm working on a mod that adds an alternate faction to Factorio. Completely different technologies, recipes, items, entities, are basically how it is, with a different take on Factorio's general game flow and progression. I'm planning to maybe add multiple different factions, and so I wanna ask...

1. Is there a shortcut to disabling all base game technologies and recipes for a specific force, or do I have to disable each technology/recipe one at a time?

2. I know this is more complex, but how do I make it so that a Player, upon starting a normal singleplayer game, let alone a multiplayer one, can choose a force, and thus be given different starting items based on said force? I ask because each Force will be it's own Faction, which sometimes may have no use for things like drills or furnaces. I was personally thinkig it'd be like a "join/start the game, game asks the new player which force to join via a menu that pops up, not unlike Bob's Character Classes mod, except with a Force instead of something fully original, and they can click one of the premade forces I've already programmed in.

3. Can I create custom tech modifiers? I want to say... increase wall HP with technology, instead of going the traditional route of having different tiers of walls that earlier ones upgrade to as ingredients, or increase Drill mining speed, reduce consumption of assembling machines, or even modifying recipes slightly using tech bonuses. Also I don't know of many that do this, but can you add productivity or speed bonuses to assembling machines via technologies?
Or even maybe adding module slots to specific buildings or increasing the power production of structures, or improve the neighbor bonus between Reactors.
I know some mods add productivity to labs, hp to players, and increases crafting speed of players, but i just wanted to ask anyways, you never know if the answer will be different.

4. Can modules add more than just speed, productivity, consumption, or pollution modifiers? I have one idea that Wall hp could be improved via modules, since the faction features modularity in the original writing of it for a more complicated project (an RTS, and as world lore), also could I make it so that equipping a module, could give the building an energy shield? I know shields exist in the form of the Turret Shield mod, tho I'm unsure if it can be made into a Module effect, or if Module effects are a limited thing.
Other ideas would include modules that could allow a building ot generate power if it previously couldn't, or to increase the generation/neighbor bonus of Reactors.

5. Can I disable out-of-combat regeneration for only specific forces and maybe even add a slowly ticking de-generation, to make some sort of hunger system?

6. Can different forces have different character animations/graphics? Like to have the "Player" force have the normal, but to then have say... the "militaris" force to have a totally different animation?.

7. Is it possible to make it so that a building can generate a sort of fog that can damage buildings can immune to it, generated just like pollution, but it's also corrosive, so it damages units and buildings?

8. Can you add a charging state to a building? I ask because I'd like to make something like Red Alert 1's Tesla Tower in that you can hear it audibly charge up before shooting (like C&C Red Alert 1's Tesla Coil), or to add a wind-up time to a gun turret where the attack would start, but slowly, or weakly, but could grow stronger over time (sorta like a Starcraft 2 Void Ray)?

9. Also finally, and I'm sure this is a no, but would it be theoretically be possible to create a logsitics system based solely on teleportation of items to buildings that need it, within specific ranges? This isn't too needed, already planning around it, but if it could be done, that would definitely be a plan of mine.
My idea would essentially be that there'd be some kind of central storage that each section of a base would have, depending purely on power grid connections. Essentially drills would, instead of producing an item into the world, it would instantly just put them in this global storage, which furnaces could pull from based on what they're requesting and assembling machines would pull from it based on the recipe they're set to craft. Specific things would add slots to this storage system, such as the player themselves, adding one slot, a starting building I have already implemented into my mod, the Survival pod, would add another, with later buildings adding much more, like 10 or 20 slots each, adding said slot so long as they're within the powered range of an electric pole-type entity, not that they require power.
And the logistics system would be constrained within this power grid, a drill outside of it, even with a different power source, wouldn't be able to add anything to that storage system, as each separate power grid would have a different instance of this storage system.

Pretty sure that isn't possible in Factorio, and if it was, the coding required for it would be probably so ridiculous in scope that it'd require a developer's skill, so here's the next question...

10. Is it possible to have a lab and an assembling machine in one entity? I have a very strong feeling the answer is "No" since those are likely two different entity types. There might be hacky ways of doing it, like apparently an entity can spawn additional entities with different aspects, but that's both beyond me, and I'm unsure how it'd even work anyways.
I mostly ask because the Survival Pod was originally designed to be not just an assembling machine, but a very weak lab, and also a furnace of sorts that could convert resources into a single, centralized resource that the faction uses to create all of it's other stuff. Basically an entity that would be the single-most important part of your base until you can get the more specialized, and more powerful/spammable buildings later, able to basically do a tiny bit of everything, just not very well.

That question is also really more just a "It'd be cool if" that I've planned around, it's instead just an assembling machine with the previously implied furnace resource recipes instead just being ones that are usable only by specific assembling machines, ie. the Survival Pod, and a Furnace that's only a furnace by name and appearance, it's the simplest solution tbh.

11. My mod is designed around being played on Deathworlds, how's Deathtorio for a name? It's essentially going to play like Factorio, except it's kinda also a different thing all it's own too. Doesn't mean the stuff will be so powerful that it makes Deathworlds easy, but more like each faction will become self-sufficient at differing times, so running out of say... Iron doesn't mean they're doomed.

Personally, I know how ridiculously daunting this idea is, but I'm chipping away at it (which is really all anyone can ever do with any large project), so any and all help is appreciated, welcome, and honestly, I'd be extremely grateful. I'm still new at programming and all that.

I also haven't tested the mod yet, it doesn't have enough graphics to make that possible yet (I only have 2 rough graphics for things probly at the wrong angles, kinda only started a week and a half ago). I'm also unsure what protocol is when it comes to this kinda thing around here, also.
I normally draw, so modding is out of my depth quite a bit. I'm super dense at learning programming and that's frustrating.

I made the dumbest factorio mod ever made: Memebots.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: A list of questions I'm unsure about for my mod.

Post by darkfrei »

StormyStrife wrote:
Mon May 11, 2020 2:09 am
1. Is there a shortcut to disabling all base game technologies and recipes for a specific force, or do I have to disable each technology/recipe one at a time?
Examples from Wiki:Console and lua api:

Unresearch all technologies:

Code: Select all

/c local force = game.player.force
for _, tech in pairs(force.technologies) do 
	tech.researched=false
	force.set_saved_technology_progress(tech, 0)
end
Disabling all recipes:

Code: Select all

/c local force = game.player.force
force.reset_recipes()
or

Code: Select all

/c local force = game.player.force
for name, recipe in pairs(force.recipes) do 
	recipe.enabled = false 
end

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: A list of questions I'm unsure about for my mod.

Post by darkfrei »

StormyStrife wrote:
Mon May 11, 2020 2:09 am
2. I know this is more complex, but how do I make it so that a Player, upon starting a normal singleplayer game, let alone a multiplayer one, can choose a force, and thus be given different starting items based on said force? I ask because each Force will be it's own Faction, which sometimes may have no use for things like drills or furnaces. I was personally thinkig it'd be like a "join/start the game, game asks the new player which force to join via a menu that pops up, not unlike Bob's Character Classes mod, except with a Force instead of something fully original, and they can click one of the premade forces I've already programmed in.
See same solution in the
Factorio\data\base\scenarios\freeplay\freeplay.lua
and
Factorio\data\base\scenarios\sandbox\sandbox.lua

It the sandbox you can find the preset diealog with the player and the game makes some changings on it.

PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: A list of questions I'm unsure about for my mod.

Post by PyroFire »

1. Shortcut? No, but easily do-able. See darkfrei's post.

2. It's actually rather simple, you make it with lua. Just make the forces and the menu, make it popup at the right time, and there you go!

3. Increase wall hp with technology - Nope, this is hard-coded with the prototype. And for the effects like mining productivity bonus or energy consumption, you can maybe set force bonuses (which is a thing).
But if you can't do that, and for everything else, such as the wall hp thing, no you need to use the "traditional route" with multiple tiers.
But you can set it up so only certain forces have certain tiers, and you can do some lua shenanigans to disable/enable the prototypes (and seamlessly swap out the entities for the higher tier ones) to create the illusion that the wall is the same but with better stats.

4. No. Modules are limited to production machines only such as assemblers and furnaces. See anything with the "module_specification" property on the prototype.
Also for "walls with more hp" thing see point 3 about seamlessly swapping prototypes and enabling/disabling recipes at the right time.
Also there is no such thing as an energy shield in factorio.
That's just more lua shenanigans to create the illusion of there being additional health / shield regen / graphics / whathaveyou.

5. "de-generation": Yes that's easy, because it's just damage over time. you can do that on_tick and deal damage to the player.
As for the natural health regeneration, that's a little less simple because that is defined on the prototype: https://wiki.factorio.com/Prototype/Ent ... g_per_tick
You can do a mix of applying damage at the right times to cancel it, or create several different copies of the character prototype with different regens, and seamlessly swap them out with the character creating the illusion of changing amounts of health regen, and noting there is a timer for "out-of-combat" before the health regen starts happening, though i'm not sure where this particular option is found.

6. Yes... just create more character prototypes and use that.

7. What? uh... Yes, i suppose? Seems like an on_tick thing, or mass-modifying prototypes to make them vulnerable to a particular aoe damage over time weapon and repeatedly create that projectile over the "fog-generator".
Basically no issue and there's several ways to do it.

8. Delay before firing - Pretty sure that's a yes with specific use of a weapons attack_parameters. The void ray charge-up thing is a different story, and again.. seamlessly swapping prototypes. But otherwise that's fairly tough.

9. What's wrong with logistics robots? also yes, use on_tick.

10. Yes and no. No - in that, how do you expect the player to physically interact with such an entity? Does all of this popup in the same menu? That is impossible (unless you create your own menu for it)
But yes in that, you can create a composite entity that, when the base entity is placed, will lua-create all the other entities like the assembling machine and lab next to each other, and lua it in such a way that each entity acts together (e.g. mine the assembler, and the whole composite entity is mined).

11. Uh... your name choice is fine?

(12). Why do you need custom graphics to test something? Just re-use existing graphics, maybe re-color them and use as placeholders for when you're ready to work on the graphics for reals.


Anything else?

User avatar
StormyStrife
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon May 11, 2020 12:38 am
Contact:

Re: A list of questions I'm unsure about for my mod.

Post by StormyStrife »

Yeah, a couple more questions about different stuff, thanks for the responses by the way, definitely has helped me learn more about modding this game.

1. Is it possible to make separate enemy factions to the Biters, and to have them spawn in the same map, expand in the same map as well, but maybe

2. Could someone make it so that enemies will only spawn more frequently and not also upgrade/spawn larger types of enemies as evolution scale increases? Could also the number of units per spawn interval also be increased similarly?
I normally draw, so modding is out of my depth quite a bit. I'm super dense at learning programming and that's frustrating.

I made the dumbest factorio mod ever made: Memebots.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: A list of questions I'm unsure about for my mod.

Post by darkfrei »

StormyStrife wrote:
Fri May 15, 2020 12:26 pm
1. Is it possible to make separate enemy factions to the Biters, and to have them spawn in the same map, expand in the same map as well, but maybe
https://mods.factorio.com/mod/biter_factions
https://mods.factorio.com/mod/galindell-world

StormyStrife wrote:
Fri May 15, 2020 12:26 pm
2. Could someone make it so that enemies will only spawn more frequently and not also upgrade/spawn larger types of enemies as evolution scale increases? Could also the number of units per spawn interval also be increased similarly?
You can change this parameters:

Code: Select all

data.raw["unit-spawner"]["biter-spawner"].result_units[1][1] = "small-biter"
data.raw["unit-spawner"]["biter-spawner"].result_units[1][2][1] = {0, 0.3}
data.raw["unit-spawner"]["biter-spawner"].result_units[1][2][2] = {0.6, 0}
data.raw["unit-spawner"]["biter-spawner"].result_units[2][1] = "medium-biter"
data.raw["unit-spawner"]["biter-spawner"].result_units[2][2][1] = {0.2, 0}
data.raw["unit-spawner"]["biter-spawner"].result_units[2][2][2] = {0.6, 0.3}
data.raw["unit-spawner"]["biter-spawner"].result_units[2][2][3] = {0.7, 0.1}
data.raw["unit-spawner"]["biter-spawner"].result_units[3][1] = "big-biter"
data.raw["unit-spawner"]["biter-spawner"].result_units[3][2][1] = {0.5, 0}
data.raw["unit-spawner"]["biter-spawner"].result_units[3][2][2] = {1, 0.4}
data.raw["unit-spawner"]["biter-spawner"].result_units[4][1] = "behemoth-biter"
data.raw["unit-spawner"]["biter-spawner"].result_units[4][2][1] = {0.9, 0}
data.raw["unit-spawner"]["biter-spawner"].result_units[4][2][2] = {1, 0.3}
data.raw["unit-spawner"]["biter-spawner"].spawning_cooldown = {360, 150}
data.raw["unit-spawner"]["biter-spawner"].spawning_radius = 10
data.raw["unit-spawner"]["biter-spawner"].spawning_spacing = 3
data.raw["unit-spawner"]["biter-spawner"].max_spawn_shift = 0
data.raw["unit-spawner"]["biter-spawner"].max_richness_for_spawn_shift = 100
2020-05-15T17_36_24-D__Factorio_0.18_factorio-current.log - Notepad++.png
2020-05-15T17_36_24-D__Factorio_0.18_factorio-current.log - Notepad++.png (24.64 KiB) Viewed 1890 times
The same as table:

Code: Select all

data.raw["unit-spawner"]["biter-spawner"].result_units = 
{
	{"small-biter", {{0, 0.3}, {0.6, 0}}},
	{"medium-biter", {{0.2, 0}, {0.6, 0.3}, {0.7, 0.1}}},
	{"big-biter", {{0, 0.5}, {1, 0.4}}},
	{"behemoth-biter", {{0.9, 0}, {1, 0.3}}}
}
data.raw["unit-spawner"]["biter-spawner"].spawning_cooldown = {360, 150}
data.raw["unit-spawner"]["biter-spawner"].spawning_radius = 10
data.raw["unit-spawner"]["biter-spawner"].spawning_spacing = 3
data.raw["unit-spawner"]["biter-spawner"].max_spawn_shift = 0
data.raw["unit-spawner"]["biter-spawner"].max_richness_for_spawn_shift = 100
2020-05-15T17_42_32-_D__Factorio_0.18_factorio-current.log - Notepad++.png
2020-05-15T17_42_32-_D__Factorio_0.18_factorio-current.log - Notepad++.png (11.94 KiB) Viewed 1890 times

PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: A list of questions I'm unsure about for my mod.

Post by PyroFire »

StormyStrife wrote:
Fri May 15, 2020 12:26 pm
2. Could someone make it so that enemies will only spawn more frequently and not also upgrade/spawn larger types of enemies as evolution scale increases? Could also the number of units per spawn interval also be increased similarly?
game.map_settings.* has more options to change biter behavior during runtime.
e.g. game.map_settings.unit_group

Also more lua shenanigans about the evolution factors.

Post Reply

Return to “Modding help”