Making certain units buildable underwater in your map

Interesting mapping tools and mapping help.

Moderator: Morax

Making certain units buildable underwater in your map

Postby johnie102 » 07 Apr 2013, 15:38

Hey,

I would like my map to have t1 powergens buildable underwater. Now I found a mod that makes every building buildable under water:
Code: Select all
do
local OldModBlueprints = ModBlueprints
function ModBlueprints(all_bps)
   OldModBlueprints(all_bps)
   for id,bp in all_bps.Unit do
      if table.find(bp.Categories, "INDIRECTFIRE") then
      elseif table.find(bp.Categories, "DIRECTFIRE") then
      elseif table.find(bp.Categories, "FACTORY") then   
      elseif table.find(bp.Categories, "ANTIAIR") then   
      elseif table.find(bp.Categories, "ANTINAVY") then
      elseif table.find(bp.Categories, "INTELLIGENCE") then
      elseif table.find(bp.Categories, "ANTIMISSILE") then
         if table.find(bp.Categories, "SILO") then
            bp.Physics.BuildOnLayerCaps.LAYER_Seabed = true
            if bp.Wreckage then
               bp.Wreckage.WreckageLayers.Seabed = true
            end
         end
      elseif table.find(bp.Categories, "ANTIMISSILE") then
      elseif table.find(bp.Categories, "AIRSTAGINGPLATFORM") then
      elseif table.find(bp.Categories, "STRUCTURE") then
         bp.Physics.BuildOnLayerCaps.LAYER_Seabed = true
         if bp.Wreckage then
            bp.Wreckage.WreckageLayers.Seabed = true
         end
      end
   end
end
end

This would then be in mods/<modname>/hook/lua/system/Blueprints.lua
My question is, how could I do something similar, but integrated in the map, so no mod needs to be activated. I guess I would have to import something to my map_name_script.lua, but I don't have a clue what. Is it even possible to change unit blueprints at map start?
johnie102
Avatar-of-War
 
Posts: 128
Joined: 27 Dec 2012, 22:26
Has liked: 0 time
Been liked: 2 times
FAF User Name: johnie102

Re: Making certain units buildable underwater in your map

Postby Prince__ » 07 Apr 2013, 19:12

You are right,the MAPNAME_scipt.lua needs to be changed but every map I fixed (which had the craziest issues) had edited scripts , so I don't recommend to edit the script.

I would recommend to use the mod.With more I can't help you.
User avatar
Prince__
Priest
 
Posts: 302
Joined: 29 Aug 2011, 11:39
Has liked: 0 time
Been liked: 4 times
FAF User Name: UES_Prince

Re: Making certain units buildable underwater in your map

Postby johnie102 » 07 Apr 2013, 21:41

I really don't want to do it with a mod, because I would like the map to be playable as is.
I've been looking all over the place for a way to do this, but I can't find the precise thing I want to do that I think is possible, but I really can't find how. What I want to do is force the game to hook a lua file, so that I could just supply the map with the mod and it would automatically hook that mod.

Now, if no one knows a way to do that, the second best thing would be to dynamically adjust the blueprints on mapstart. I have found a function in the LUADOC called Sim:GetBlueprint(entity), but I'm not sure what I have to import to have acces to that function, how I need to supply the argument and what it returns and if I modify what it returns if that is automatically reflected in the game, because there doesn't seem to be a SetBlueprint function.

This has to be doable, I just have no idea where to look.
johnie102
Avatar-of-War
 
Posts: 128
Joined: 27 Dec 2012, 22:26
Has liked: 0 time
Been liked: 2 times
FAF User Name: johnie102


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest