Specified building location based on unit type/name

Specified building location based on unit type/name

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
zalpha
Posts: 23
Joined: 19 Mar 2013, 18:39

Specified building location based on unit type/name

Post 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?
zalpha
Posts: 23
Joined: 19 Mar 2013, 18:39

Re: Specified building location based on unit type/name

Post by zalpha »


May you succeed at everything you attempt.
zalpha
Posts: 23
Joined: 19 Mar 2013, 18:39

Re: Specified building location based on unit type/name

Post 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.
zalpha
Posts: 23
Joined: 19 Mar 2013, 18:39

Re: Specified building location based on unit type/name

Post 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?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Specified building location based on unit type/name

Post by FLOZi »

EditUnitCmdDesc(unitID, FindUnitCmdDesc(unitID, cmdID), {disabled = true})
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Specified building location based on unit type/name

Post 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
zalpha
Posts: 23
Joined: 19 Mar 2013, 18:39

Re: Specified building location based on unit type/name

Post by zalpha »

It all works now. Thanks!
Post Reply

Return to “Game Development”