Page 1 of 1

Specified building location based on unit type/name

Posted: 11 Apr 2013, 21:56
by zalpha
Is this possible?

I have a builder, and I would like to be able to specify with Lua where (in terms of piece) specific units are built.

I am using a planet as a basic builder, and want it to be able to build specific orbital items (including a builder for other units). I have empty pieces where these "buildings" will go, and I am trying to figure out how to specify a build location for specific buildings rather than the generic "If a unit it is being built, put it here" such as
function script.QueryBuildInfo() return platform end
Any hints?

Re: Specified building location based on unit type/name

Posted: 11 Apr 2013, 22:15
by knorke

Re: Specified building location based on unit type/name

Posted: 11 Apr 2013, 22:22
by zalpha

May you succeed at everything you attempt.

Re: Specified building location based on unit type/name

Posted: 12 Apr 2013, 17:49
by zalpha
Been working with the code, but it seems to have a catch 22 of reporting nil until the build has started. By that time, build is where the build is.

Re: Specified building location based on unit type/name

Posted: 12 Apr 2013, 18:05
by zalpha
Got it halfway there. First unit works, then it locks up.

I think it's an ID issue.

EDIT: It is. The build location gets stuck at the location that the building was moved to. Trying to figure out how to reset it, maybe by checking if the location is blocked.

Side note: Is there a way to disable a build option once it has been built?

Re: Specified building location based on unit type/name

Posted: 12 Apr 2013, 18:53
by FLOZi
EditUnitCmdDesc(unitID, FindUnitCmdDesc(unitID, cmdID), {disabled = true})

Re: Specified building location based on unit type/name

Posted: 12 Apr 2013, 23:35
by knorke
can you post your script (or even better dl link to whole mod)

is there error message? gets logged here http://springrts.com/wiki/Infolog.txt

Re: Specified building location based on unit type/name

Posted: 22 Apr 2013, 22:20
by zalpha
It all works now. Thanks!