Multiple build pads possible?
Moderator: Moderators
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Multiple build pads possible?
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.
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.
Re: Multiple build pads possible?
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.
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.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Multiple build pads possible?
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 :)
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 :)
Re: Multiple build pads possible?
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).
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Multiple build pads possible?
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
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
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Multiple build pads possible?
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.
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.
Re: Multiple build pads possible?
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.Tactical Nuclear Missile Launcher is a factory. It has no weapons.
On topic: you can lua-disable the hitsphere!
Re: Multiple build pads possible?
Look at S44 barracks for a (somewhat clunky) way to do this - barracks build infantry inside and trucks outside. Would be easier with LUS.
Re: Multiple build pads possible?
what unit/script name and which units should be build at what pieces?
Re: Multiple build pads possible?
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.
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.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Multiple build pads possible?
So comforting to not get a ton of resounding "no"'s for once
I could slap another point onto the bflagshipbase and try it out to make sure it is what I want.
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.knorke wrote:what unit/script name and which units should be build at what pieces?
I could slap another point onto the bflagshipbase and try it out to make sure it is what I want.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Multiple build pads possible?
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.
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:
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?
Code: Select all
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
Also, this is what I put into my factory's script:
Code: Select all
function script.pickPlace(buildPlace)
if (buildPlace == 1) then
Move(pad, z_axis, -20)
else
Move(pad, z_axis, 20)
end
end
Help?
Re: Multiple build pads possible?
http://answers.springlobby.info/questio ... munication
But I think with lua unit scripts you can merge the gadget into the unit script.
But I think with lua unit scripts you can merge the gadget into the unit script.
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Multiple build pads possible?
I followed the page best I can but it keeps giving me errors.
Frustrating.
Code: Select all
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: Select all
[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): ?
Re: Multiple build pads possible?
Spring.UnitScript...
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Multiple build pads possible?
Code: Select all
[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): ?
I'm done with this for today. I'll come back to this another time.
Re: Multiple build pads possible?
local env = Spring.Unitscript.GetScriptEnv(unitID)
vs
Spring.UnitScript.CallAsUnit(builderID, env.pickPlace,'buildPlace')
among other things
vs
Spring.UnitScript.CallAsUnit(builderID, env.pickPlace,'buildPlace')
among other things
Re: Multiple build pads possible?
as unit script:
Not really clean with the Sleep() but w/e
Code: Select all
--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
- SanadaUjiosan
- Conflict Terra Developer
- Posts: 907
- Joined: 21 Jan 2010, 06:21
Re: Multiple build pads possible?
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?)
Why is that sleep needed in StartBuilding? Does it just need something to do (aka, could some animation commands take its place?)