Is there a way to remove temporarly the fog of war? (need to do a test on several loading and don’t want to lose time sending hearthlings everywhere to remove it the “normal” way…)
If I’m not mistaken the FOW is handled by the ‘gamemaster’ and is embedded in .lua, so you’d have to override it. The microworld doesn’t use the gamemaster and so there’s no fog, but that’s prob no help to you…
Tx Capotzalco for the hint!
Unfortunatly I’m not enough skilled to put my hands into lua files just like this, so I have to ask: anybody has more details on the topic?
you can make a call to stonehearth.terrain:set_fow_enabled('player_1', false)
to disable the fog of war, but the call must happen after you’ve chosen a location for the banner or else nothing will happen.
Though, I’m not sure what you want to test, but I doubt this will help (it might even cause confusion). I’m thinking of ores specifically since, I think, they will appear only when a hearthling gets close enough; irregardless if the fog of war is there or not.
I’m gonna stress though and say that it’s only a suspicion from my part as I’ve not really looked that closely into it, but if you notice that nothing’s happening then that would be why.
@Drotten, by “make a call” (sorry, non coder noob question) you mean via console?
And ore is not a problem, my test has nothing to do with it, so no worry at this level.
Ah sorry. No, I’m afraid that the console won’t help with that. You’d have to set up some server init script (from your mod) which does this, and, again, you’d have to make sure that the call occurs after the banner has been placed. It’s not an easy task, or at least one that I’ve found no easy solution to.
EDIT:
Alright @Beatrice, I wrote a script here that will disable the fow a short time after a game is started:
local MY_MOD = class()
function MY_MOD:_init()
self._listener = stonehearth.calendar:set_interval("MY_MOD disable_fow", '2h', function()
self:_disable_fow()
end)
end
function MY_MOD:_disable_fow()
stonehearth.terrain:set_fow_enabled('player_1', false)
self._listener:destroy()
self._listener = nil
end
radiant.events.listen_once(radiant, 'radiant:required_loaded', MY_MOD, MY_MOD._init)
return MY_MOD()
Just create a file (“server_init.lua”), and copy the code into it. Make sure it’s in the same folder as the manifest (it’s not really necessary but it makes sense for it to be there).
One last thing to do is to edit the manifest with this:
"server_init_script" : "file(server_init)"
I hope it helps, and also I could confirm my previous suspicion that the ores only appear when a hearthling gets close, but that may have nothing to do with what you want if for.
Tx a bunch for your time!
Now seems there is a lil’ problem, seems it don’t work as wanted.
First I recap the steps to be sure:
- create a file called “server_init.lua”
- copy paste your code inside the previous new file
- place the file in the “stonehearth” dir next to the manifest
- edit the manifest to add the line “server_init_script” : “file(server_init)”
Question, is it supposed to work by itself or do we need a command or something once in game?
Also, there is already a "server_init_script" : "file(stonehearth_server)",
in the manisfest; is that compatible?
And, is there a specific order to load the instructions? (could your line need to go before or after the existing command?
Now, I see you use a reference for the newly created file with file(server_init)
, could it be we need to add the .lua at the end?
It’s supposed to work by itself.
You’re looking in the manifest for the stonehearth mod, right? You’re supposed to add this to your mod’s manifest, and yes it’s compatible since they don’t affect each other. If you already have one such in your manifest, then maybe you should remove the old one (if you’re not using it of course).
I’m not sure what you mean by this. What instructions are you talking about? Do you mean the "server_init_script?"
If so, technically it doesn’t matter because json accept key names that already exists, though only one of those will be used, and it’s going to be the one written (or added from mixinto) last. In any case, you should only have one entry of each key per file, to avoid confusion.
For some reason the lua file will not be loaded if .lua is included, so you need to not add the .lua.
EDIT:
It’s much better to have a separate mod which does this instead, give me a second and I’ll upload one that does this.
EDIT 2:
Ok @Beatrice. Here’s a zip of the mod (just make sure to rename the extension to smod):
fow_disabler.zip (24.2 KB)
Alternatively you can go to the GitHub repository and download it from there.
Note that it’s set to wait 2 hours of in-game time so that you’ll have plenty of time to start a new game and set down that banner. If you’re fast you’ll have to wait some time before it kicks in, but just hit that fast-forward button.
Ok, marvelous! For some idiotic reason I was editing not the mod but the game itself! I’ll test this in a few hours (cannot do that right now) and report if all is ok. Tx again!
Quick report to say it is all good my friend!
Tx a bunch, will help saving time in my testing efforts!
Good to know!
If you feel that it’s taking a bit too long time before the fow to disappear, then you can go into the server init file and change "2h"
to "1h"
though that might be too little time; I didn’t test it.