Can't find any way to create or get existing hidden zone instance. Is there a way to do that in scripts?
Can't find any way to create or get existing hidden zone instance. Is there a way to do that in scripts?
Hi Joker,
You can go through the save file and get the GUID of an existing Hiddenzone if you need. Search for fogcolor
Regards
Abarden
In the getAllObjects() table look for stuff with a 'Fog' tag.
Code:function onLoad() for _,obj in ipairs(getAllObjects()) do if obj.tag == 'Fog' then -- obj is a hidden zone, do stuff with it end end end
As far as I know you can not create or destroy hidden zones. Though you can use scripts to place them in bags which is super strange.. and I think a bug.
I use manipulated hidden zones in some of my mods. Like for example in a card game that has a sidebaord between rounds.. what I do is have a same 0.5,0.5,0.5 cube for the hidden zone hidden inside / under the table. The script can use the hidden zone GUID to move and scale it.. allowing you to place it anywhere and any size. Then shrink it back down. This gives the player the illusion of the zone being created and destroyed. You can also do the same thing for scripting zones.
So at the same time I move the hiddenzone I also move a scripting zone to encompas the volume of that hidden zone. Now, I can use the scripting zone and all the functions associated with scripting zones but as it is the same volume as the hidden zone, it is kinda turning a hidden zone into a scripting zone.
oh, thank you! forgot that save file is simple json, and thanks for pointing, that one cant't add remove zones at will - will use placing under table (same as i done with set of dies when i was scripting "war zone" for enhanced edition of DLC tiny epic kingdoms)
I found that you actually can create and destroy hidden zones in script - following example creates two zones and removes one of them
Code:fowWhite = { name = 'White', position = {8.77, 5.83, -15.86}, rotation = {0, 0, 0}, scale = {17.5, 11.5, 11.5}} fowRed = { name = 'Red', position = {-12.0, 5.83, -15.86}, rotation = {0, 0, 0}, scale = {17.5, 11.5, 11.5}} fowObjects = {} function onload() fowObjects[fowWhite.name] = spawnFow(fowWhite) fowObjects[fowRed.name] = spawnFow(fowRed) fowObjects[fowWhite.name].destruct() end function spawnFow(fowParams) return spawnObject({ type = 'FogOfWarTrigger', position = fowParams.position, rotation = fowParams.rotation, scale = fowParams.scale, callback = 'setFowOwner', params = {player = fowParams.name} }) end function setFowOwner(object, params) object.setValue(params.player) end