Page 1 of 1

Inserting a video in a factorio instance

Posted: Mon Jun 28, 2021 5:09 pm
by ever_Lord
I dont know anything about tech / coding in factorio.
I could use a video inside the game, with transparency (green background)

the idea is to add a countdown for starting scenario and a "Knock Out thing" when game ends.

Ideally, that has to be possible in scenario, without using mod.

Is this do-able, how would you do it ?

thanks !

Re: Inserting a video in a factorio instance

Posted: Mon Jun 28, 2021 7:56 pm
by DaveMcW
There is no support for video in mods, or even in the base game. All animations are just single images played one after the other.

You can load a transparent image directly from an unmodded scenario folder:

Code: Select all

/c 
for _, player in pairs(game.players) do
  player.gui.screen.add{name = "my-image", type = "sprite", sprite = "file/my-image.png"}
end
script.on_nth_tick(300, function()
  for _, player in pairs(game.players) do 
    if player.gui.screen["my-image"] then player.gui.screen["my-image"].destroy() end
  end
end)

Re: Inserting a video in a factorio instance

Posted: Tue Jun 29, 2021 3:10 am
by ever_Lord
That must be helpful, thanks !

So say i want to show 4 images after some button has been clicked :

image img1 appears in the middle of the screen, then 1 second later img2 replaces img1 and so on.


Would you help me do that please ? or do i have enough infos to do it myself (i've not tested anything yet) ?

Re: Inserting a video in a factorio instance

Posted: Sat Aug 28, 2021 5:42 pm
by ever_Lord
So if anyone comes here, here the trick
in player.gui.screen.add{name = "my-image", type = "sprite", sprite = "file/my-image.png"}
"file/" refers to the root of the scenario, the folder just beyond "/scenarios"

you can then add subfolders, which i did so i have "[...]\Factorio\scenarios\my_scenario\png\example.png"
so the command is in chat
/c game.player.gui.screen.center.add{name = "my-image", type = "sprite", sprite = "file/png/example.png"}

btw, i'm looking to resize my image in factorio, did anyone manage to do so ?

thanks !