View topic - Multiple build pads possible?



All times are UTC + 1 hour


Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: 07 Feb 2012, 05:00 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
Is it possible for a single factory to have two separate build "pads"? Like certain units have, say, a particular custom parameter which dictates if they use build pad A or B.

What I'm wanting to do: Flagship Base has two separate build pads, one used to build engineers and miners (normal ground units), and another one used to build the cruisers (which descend from the sky).

I feel like if this was possible it'd be common knowledge, but I figure it is worth a shot.


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 05:07 
User avatar

Joined: 30 Nov 2008, 04:31
Location: the flow
On quick thought:

On unit created (includes the build being started) move the nanoframe (if you use these) to target position. If you want a cruiser that descends, hide the unit until completed and descend from the iron sky once complete. If land unit, display on target pad and draw whatever construction effects you want.

Possibly more efficient solutions possible.


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 05:20 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
That sounds like what I'm wanting to attempt with how cruisers are brought into the game. But I'm wanting two different pads, both for the factory model and for the function of not having land units descend from the sky.

The problem I see with your suggestion is that the footprint and hitsphere are still there, just the visible model isn't. Then again, it is being built so it can't move anyways.

I'd still like some other input :)


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 05:43 
User avatar

Joined: 07 Dec 2008, 02:35
Check out the tactical missile launcher in ZeroK, it has multiple launch pads that each get a missile built on them (one after the other).


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 06:16 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
Isn't that for a weapon? I'm looking for doing this with a factory.

I looked at the Tactical Nuclear Missile Launcher and it isn't a builder. A search of Zero K didn't yield any other units that could be what you described :(


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 06:17 
Moderator

Joined: 12 Oct 2007, 08:24
Yes, Lua it.

You can move the construction piece around in the unit script so if you were a masochist you could also Cob it.

Tactical Nuclear Missile Launcher is a factory. It has no weapons.


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 06:42 
User avatar

Joined: 30 Nov 2008, 04:31
Location: the flow
Quote:
Tactical Nuclear Missile Launcher is a factory. It has no weapons.

Moreover, tacnukes are (at least until launch) units as well. So to fire them, you need to select them and order to attack, which confuses many a noob.

On topic: you can lua-disable the hitsphere!


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 07:02 
MC: Legacy & Spring 1944 Developer
User avatar

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
Look at S44 barracks for a (somewhat clunky) way to do this - barracks build infantry inside and trucks outside. Would be easier with LUS.


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 07:43 
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
what unit/script name and which units should be build at what pieces?


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 07:44 
Journeywar Developer & Mapper
User avatar

Joined: 24 Jan 2006, 21:12
Location: "drop table kitchens; comit;"
I do something similar in the condepot, the units build starts on the standardpad (you cant get a unitDefID before the building starts, if you dont want to parse the buildqueue on start).. once the build units id is determinated i return the buildspot i desire.

You even can go disco, having the unit flicker from on buildspot to the next, dont know if that is any good (looks like four units beeing build near simultanously for our slow eyes).

Long Story short, yes.


Top
 Online Profile  
 
PostPosted: 07 Feb 2012, 15:30 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
So comforting to not get a ton of resounding "no"'s for once :-)

knorke wrote:
what unit/script name and which units should be build at what pieces?


This is for a unit I haven't even modeled, I was more of checking the water before I go all willy nilly with plans that can't be realized.

I could slap another point onto the bflagshipbase and try it out to make sure it is what I want.


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 15:52 
Journeywar Developer & Mapper
User avatar

Joined: 24 Jan 2006, 21:12
Location: "drop table kitchens; comit;"
Do it..


Top
 Online Profile  
 
PostPosted: 07 Feb 2012, 20:52 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
I tracked down the gadget in S44 to game_hqBuildSpot and I've started playing with it. I think I understand it, but there is one hangup.

Code:
function gadget:GetInfo()
   return {
      name      = "HQ unit ID informer",
      desc      = "Tells HQ scripts which build platter to use",
      author    = "Nemo/B.Tyler",
      date      = "14th April, 2009",
      license   = "PD",
      layer     = -5,
      enabled   = true  --  loaded by default?
   }
end
if (gadgetHandler:IsSyncedCode()) then
   function gadget:UnitCreated(unitID, unitDefID, unitTeam, builderID)
      local ud = UnitDefs[unitDefID]
      if builderID then
         local builderDefID = Spring.GetUnitDefID(builderID)
         local bud = UnitDefs[builderDefID]
         local buildPlace
         if (bud.customParams.separatebuildspot) then
            if (ud.customParams.buildoutside) then
               buildPlace = 1
            else
               buildPlace = 0
            end
      -->   Spring.CallCOBScript(builderID, "pickPlace", 0, buildPlace)
         end
      else
         return
      end
   end   
else
end


The "Spring.CallCOBSript blah blah blah" (with the arrow above) is giving me errors, because I'm using a Lua script and not Cob. This is where my knowledge runs out, as I don't know how to make it read a lua script.

Also, this is what I put into my factory's script:

Code:
   function script.pickPlace(buildPlace)
      if (buildPlace == 1) then
         Move(pad, z_axis, -20)
      else
         Move(pad, z_axis, 20)
      end
   end


I'm not sure if that is how it is supposed to look, but I can't get the actual gadget to work so I haven't gotten that far.

Help?


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 21:00 
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
http://answers.springlobby.info/questions/5/lua-unit-script-gadget-communication

But I think with lua unit scripts you can merge the gadget into the unit script.


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 21:26 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
I followed the page best I can but it keeps giving me errors.

Code:
function gadget:GetInfo()
   return {
      name      = "HQ unit ID informer",
      desc      = "Tells HQ scripts which build platter to use",
      author    = "Nemo/B.Tyler",
      date      = "14th April, 2009",
      license   = "PD",
      layer     = -5,
      enabled   = true  --  loaded by default?
   }
end
if (gadgetHandler:IsSyncedCode()) then
   function gadget:UnitCreated(unitID, unitDefID, unitTeam, builderID)
      local ud = UnitDefs[unitDefID]
      if builderID then
         local env = Spring.Unitscript.GetScriptEnv(unitID)
         local builderDefID = Spring.GetUnitDefID(builderID)
         local bud = UnitDefs[builderDefID]
         local buildPlace
         if (bud.customParams.separatebuildspot) then
            if (ud.customParams.buildoutside) then
               buildPlace = 1
            else
               buildPlace = 0
            end
         Spring.UnitScript.CallAsUnit(builderID, env.pickPlace,

'buildPlace')
         end
      else
         return
      end
   end   
else
end


Code:
[f=0000133] Error: LuaRules::RunCallIn: error = 2, UnitCreated, [string "LuaRules/Gadgets/game_hqbuildspot.lua"]:16: attempt to index field 'Unitscript' (a nil value)
stack traceback:
   [string "LuaRules/Gadgets/game_hqbuildspot.lua"]:16: in function 'UnitCreated'
   [string "LuaGadgets/gadgets.lua"]:1264: in function <[string "LuaGadgets/gadgets.lua"]:1262>
   (tail call): ?


Frustrating.


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 21:28 
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
Spring.UnitScript...


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 22:21 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
Code:
[f=0000219] Error: LuaRules::RunCallIn: error = 2, UnitCreated, [string "LuaRules/Gadgets/game_hqbuildspot.lua"]:28: attempt to index global 'env' (a nil value)
stack traceback:
   [string "LuaRules/Gadgets/game_hqbuildspot.lua"]:28: in function 'UnitCreated'
   [string "LuaGadgets/gadgets.lua"]:1264: in function <[string "LuaGadgets/gadgets.lua"]:1262>
   (tail call): ?


fixed what knorke pointed out, does this.

I'm done with this for today. I'll come back to this another time.


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 22:35 
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
local env = Spring.Unitscript.GetScriptEnv(unitID)
vs
Spring.UnitScript.CallAsUnit(builderID, env.pickPlace,'buildPlace')

among other things


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 22:57 
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
as unit script:
Code:
--special buildspots for some units
local buildSpots = {
  [UnitDefNames["supertank"].id] = piece "tankbuildspot",
  [UnitDefNames["horse"].id] = piece "horsebuildspot",
}
local pad = piece "pad" --used for all other units
bdefID = -1 --unitDefID that the factory is currently building
function script.QueryBuildInfo()
   Spring.Echo (bdefID)
   return buildSpots [bdefID] or pad
end

function script.StartBuilding()   
   Sleep (10) --otherwise GetUnitIsBuilding returns nil
   local bums = Spring.GetUnitIsBuilding (unitID)
   bdefID = Spring.GetUnitDefID (bums)
end

Not really clean with the Sleep() but w/e


Top
 Offline Profile  
 
PostPosted: 07 Feb 2012, 23:16 
Conflict Terra Developer
User avatar

Joined: 21 Jan 2010, 06:21
Location: Tucson
That is what I'm talking about. Again, Knorke saves the day.

Why is that sleep needed in StartBuilding? Does it just need something to do (aka, could some animation commands take its place?)


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.