After the administrator changes a setting, how to make it effective for everyone immediately?

Place to get help with not working mods / modding interface.
Post Reply
sdgmlj
Fast Inserter
Fast Inserter
Posts: 127
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

After the administrator changes a setting, how to make it effective for everyone immediately?

Post by sdgmlj »

My script is written like this:
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
local player = game.players[event.player_index]
layer.character_running_speed_modifier = settings.global["running_speed_modifier"].value
end)
But I found that after the modification in the game, only the administrator has the effect, and others are invalid. How can I modify it to make it effective for everyone?

It's better to be more detailed, because I don't know anything about multiplayer games: (thank you

By the way, the second question: is there an instruction that can detect whether the current game is a "stand-alone game" or a "multiplayer game"?

sdgmlj
Fast Inserter
Fast Inserter
Posts: 127
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: After the administrator changes a setting, how to make it effective for everyone immediately?

Post by sdgmlj »

No one to help? This is very important to me. I have solved the first problem. I want to test whether the current game is a "stand-alone game" or a "multiplayer game". Who can tell me? Thank you

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: After the administrator changes a setting, how to make it effective for everyone immediately?

Post by DaveMcW »

Code: Select all

script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
  if event.setting ~= "running_speed_modifier" then return end
  for _, player in pairs(game.players) do
    player.character_running_speed_modifier = settings.global["running_speed_modifier"].value
  end
end)

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2631
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: After the administrator changes a setting, how to make it effective for everyone immediately?

Post by steinio »

sdgmlj wrote:
Sun Mar 20, 2022 8:08 am
No one to help? This is very important to me. I have solved the first problem. I want to test whether the current game is a "stand-alone game" or a "multiplayer game". Who can tell me? Thank you
https://lua-api.factorio.com/next/LuaGa ... ultiplayer shows if it's a multiplayergame.
Image

Transport Belt Repair Man

View unread Posts

sdgmlj
Fast Inserter
Fast Inserter
Posts: 127
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: After the administrator changes a setting, how to make it effective for everyone immediately?

Post by sdgmlj »

DaveMcW wrote:
Sun Mar 20, 2022 8:40 am

Code: Select all

script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
  if event.setting ~= "running_speed_modifier" then return end
  for _, player in pairs(game.players) do
    player.character_running_speed_modifier = settings.global["running_speed_modifier"].value
  end
end)
Thank you. The problem has been solved

sdgmlj
Fast Inserter
Fast Inserter
Posts: 127
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: After the administrator changes a setting, how to make it effective for everyone immediately?

Post by sdgmlj »

steinio wrote:
Sun Mar 20, 2022 8:48 am
sdgmlj wrote:
Sun Mar 20, 2022 8:08 am
No one to help? This is very important to me. I have solved the first problem. I want to test whether the current game is a "stand-alone game" or a "multiplayer game". Who can tell me? Thank you
https://lua-api.factorio.com/next/LuaGa ... ultiplayer shows if it's a multiplayergame.
Thank you. The problem has been solved

Post Reply

Return to “Modding help”