How to strengthen the enemies?

Place to get help with not working mods / modding interface.
ExRunner
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed Apr 30, 2014 6:18 pm
Contact:

How to strengthen the enemies?

Post by ExRunner »

hi,guys.
Well,im working on a dynamics system to increase the difficulty.I want to strengthen biters based on time or pollution,just like how they evolve.
Technology is a dead end.(maybe it will work in the future)
Do you have any ideas?
slay_mithos
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Feb 25, 2014 7:22 am
Contact:

Re: How to strengthen the enemies?

Post by slay_mithos »

Why not try to integrate into dytech's system?

While it might not be a perfect solution, but it seems like a good place to start.


Or was it that you don't know how to force bitters to grow in strength?
In which case, I'd either go for an increase of damage, health and resistances during runtime via script, or making certain your mod loads after any that add bitters, and iterate on the list during the entity declaration, changing the fields into functions, with the "old" value as the base one.
Those are just ideas though, but I think it could help, if you were stuck on this.
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: How to strengthen the enemies?

Post by FreeER »

um....off the top of my head I can only really suggest creating new biter (and spawner) prototypes that have more health/damage/etc. and then over time or based on the evolution factor swap out the old spawners so that the stronger ones spawn (since the list of biters that a spawner can create is specified in the prototype, as far as I know it can not be modified in-game, also AFAIK you can not modify biter stats directly through lua or tech, which you mentioned as a dead end)

as for swapping the spawners you'd either need to keep a table from the beginning of the game of the spawners as chunks were loaded or keep track of the size of the map, again in onchunksloaded, for a findentitiesfiltered command, so you can swap all of them. Make sure to check if they still exist of course. With the first option you'd still miss a few due to base expansions but the findentities command might freeze the game for a few seconds (unless you manage do it in small sections) so take your pick :)

hmmm, yeah I think that's about all I have. Sorry. A nice interface request for this would be modifying biter stats in-game and/or modifying the list of of biters that can be spawned through lua (rather than having multiple spawner prototypes). Both of those are likely fairly time consuming for the devs to implement though.

seems slay_mithos posted before me...hm
slay_mithos wrote:during runtime via script
do you remember something that I've forgotten?
<I'm really not active any more so these may not be up to date>
~FreeER=Factorio Modding
- Factorio Wiki
- My Factorio Modding Guide
- Wiki Modding Guide
Feel free to pm me :)
Or drop into #factorio on irc.esper.net
ExRunner
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed Apr 30, 2014 6:18 pm
Contact:

Re: How to strengthen the enemies?

Post by ExRunner »

slay_mithos wrote:Why not try to integrate into dytech's system?

While it might not be a perfect solution, but it seems like a good place to start.


Or was it that you don't know how to force bitters to grow in strength?
In which case, I'd either go for an increase of damage, health and resistances during runtime via script, or making certain your mod loads after any that add bitters, and iterate on the list during the entity declaration, changing the fields into functions, with the "old" value as the base one.
Those are just ideas though, but I think it could help, if you were stuck on this.
umm...maybe you just misunderstanding me :)
I already had some formulas about how to increase their health,damage,speed and so on.
but i dont know how to do it when gaming.
However,thanks for responding me :)
ExRunner
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed Apr 30, 2014 6:18 pm
Contact:

Re: How to strengthen the enemies?

Post by ExRunner »

FreeER wrote:um....off the top of my head I can only really suggest creating new biter (and spawner) prototypes that have more health/damage/etc. and then over time or based on the evolution factor swap out the old spawners so that the stronger ones spawn (since the list of biters that a spawner can create is specified in the prototype, as far as I know it can not be modified in-game, also AFAIK you can not modify biter stats directly through lua or tech, which you mentioned as a dead end)

as for swapping the spawners you'd either need to keep a table from the beginning of the game of the spawners as chunks were loaded or keep track of the size of the map, again in onchunksloaded, for a findentitiesfiltered command, so you can swap all of them. Make sure to check if they still exist of course. With the first option you'd still miss a few due to base expansions but the findentities command might freeze the game for a few seconds (unless you manage do it in small sections) so take your pick :)

hmmm, yeah I think that's about all I have. Sorry. A nice interface request for this would be modifying biter stats in-game and/or modifying the list of of biters that can be spawned through lua (rather than having multiple spawner prototypes). Both of those are likely fairly time consuming for the devs to implement though.

seems slay_mithos posted before me...hm
slay_mithos wrote:during runtime via script
do you remember something that I've forgotten?
thanks these suggestions.
tech and data.raw table edit are both dead end.
findentities command worked,but it freeze the game just as you said.
I think the only thing i can do is just waiting for developer giving us more technologies or interfaces :)
slay_mithos
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Feb 25, 2014 7:22 am
Contact:

Re: How to strengthen the enemies?

Post by slay_mithos »

The second part of my post was something I didn't try, so it might not work like I expect it to, but here is how I saw it:

Code: Select all

local biter_list = {}
local biters = {} -- you will want this into your mod's GLOB, or something similar

function biterHealth(biter){
	return biters[biter].max_health --do your math things here
}

for k, e in data.raw["unit-spawner"]["biter-spawner"].result_units do
	table.insert(biter_list, e[0]) --should give you the biter entity name
end

for i=0, i< table.getn(biter_list) do
	local biter_name = biter_list[i]
	local biter = data.raw["unit"][biter_name]
	biters[biter_name] = {}
	biters[biter_name]["max_health"] = biter.max_health
	
	biter.max_health = biterHealth(biter_name)
end
In hopes that someone better than me at lua can do something with this^^
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: How to strengthen the enemies?

Post by FreeER »

slay_mithos wrote: The second part of my post was something I didn't try, so it might not work like I expect it to, but here is how I saw it:
data.raw is only accessible while the game is loading (it is created through data:extend calls and is used primarily to change base/other mod prototypes, just a quick explanation for anyone reading who doesn't know/remember) so it can not be used to increase biter difficulty over time/evolution once the game has started. It could be opened after you've started your game and then you could change the biterHealth function to increase the health for the next restart of Factorio, but that's not the smooth increase that I believe ExRunner (and most others) would like.
ExRunner wrote: I think the only thing i can do is just waiting for developer giving us more technologies or interfaces :)
Unfortunately I think that's about the sum of it...make sure to create an interface request once you've thought out what you think the best way might be, (and then hope that the devs see it as important and/or quick to implement) :)
ExRunner
Burner Inserter
Burner Inserter
Posts: 5
Joined: Wed Apr 30, 2014 6:18 pm
Contact:

Re: How to strengthen the enemies?

Post by ExRunner »

ExRunner wrote: I think the only thing i can do is just waiting for developer giving us more technologies or interfaces :)
Unfortunately I think that's about the sum of it...make sure to create an interface request once you've thought out what you think the best way might be, (and then hope that the devs see it as important and/or quick to implement) :)[/quote]

One of a chinese mod-maker show me a creative way :) :) and i believe it could work:
do you remember how developers make about 17(or more) technologies to support more combat-robot?
they use a function to do it.so he think i could make a list biters in the same way.
and replace nearby "normal biters" with stronger biters based on the upgrade level.
It use findentities command too,but i think it will be faster than change biters one by one.
however,im still working on it :) :)
slay_mithos
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Feb 25, 2014 7:22 am
Contact:

Re: How to strengthen the enemies?

Post by slay_mithos »

FreeER wrote:
slay_mithos wrote: The second part of my post was something I didn't try, so it might not work like I expect it to, but here is how I saw it:
data.raw is only accessible while the game is loading (it is created through data:extend calls and is used primarily to change base/other mod prototypes, just a quick explanation for anyone reading who doesn't know/remember) so it can not be used to increase biter difficulty over time/evolution once the game has started. It could be opened after you've started your game and then you could change the biterHealth function to increase the health for the next restart of Factorio, but that's not the smooth increase that I believe ExRunner (and most others) would like.
Aw, I thought that with a function instead of a value, we could manage to go around that limitation, by having the function being called every time the game tried to access the value.

Too bad then, let's hope the devs make a way to do something like that in the future.
Post Reply

Return to “Modding help”