Page 1 of 1

Console: change running speed of all biters?

Posted: Sun Sep 20, 2020 9:10 am
by Plawerth
Okay so, I'm playing a game that is running like mud, and the only way to make it playable is to lower the game speed or everyone jumps and can't move.

/c game.speed = 0.75

Except this makes all the players move slowly which is annoying. However I have discovered there is a way to compensate for the slow game.speed so all players run normally again.

/c game.player.force.character_running_speed_modifier = (1 / game.speed)-1

Though there is concern that this introduces an imbalance into the game because the biters still move slowly. Is there a way to also increase their run speed too?

I was poking around, and this value exists:

/c game.player.print (game.forces["enemy"].character_running_speed_modifier)
0

However it does not seem to have any effect on the biters...

/c game.forces["enemy"].character_running_speed_modifier = 1

Nothing seems to change.


Is there a known way to boost biter run speed at slow game.speed in a vanilla game?

Re: Console: change running speed of all biters?

Posted: Sun Sep 20, 2020 11:02 am
by darkfrei
Plawerth wrote: Sun Sep 20, 2020 9:10 am Is there a known way to boost biter run speed at slow game.speed in a vanilla game?
You are need the mod with this code in the data.lua file:

Code: Select all

data.raw.unit["small-biter"].movement_speed = 0.2
data.raw.unit["medium-biter"].movement_speed = 0.24
data.raw.unit["big-biter"].movement_speed = 0.23
data.raw.unit["behemoth-biter"].movement_speed = 0.3

data.raw.unit["small-spitter"].movement_speed = 0.185
data.raw.unit["medium-spitter"].movement_speed = 0.165
data.raw.unit["big-spitter"].movement_speed = 0.15
data.raw.unit["behemoth-spitter"].movement_speed = 0.15


data.raw.unit.compilatron.movement_speed = 0.2
Here are the default values, but you can write what you want, for example like:

Code: Select all

data.raw.unit["small-biter"].movement_speed = 0.2 / 2 -- twice slower than default

Re: Console: change running speed of all biters?

Posted: Sun Sep 20, 2020 1:01 pm
by Klonan
You can loop through all biters and increase their speed:

Code: Select all

for k, biter in pairs(game.player.surface.find_entities_filtered{type = "unit"}) do
  biter.speed = biter.speed * 2
end
But that will only affect currently living biters.

Re: Console: change running speed of all biters?

Posted: Tue Sep 22, 2020 12:55 pm
by Plawerth
Okay, so apparently there is no global runspeed adjustment available for the enemy force like there is for all players. What does it take to get something like that added to the game base code?

The other option I guess is to add a control.lua event that for every biter/spitter spawn, modifies their runspeed to be multiplied by 1/game.speed.

I don't know LUA or the game API to write that, though it would probably only be about three lines long.