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.
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.
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.
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
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.
Joined: 24 Jan 2006, 21:12 Location: There is no god - and reality is his prophetess
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).
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.
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): ?
[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.
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
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