Page 1 of 1

New scripting function - pickDroidStructLocation

Posted: 16 Mar 2010, 21:31
by Per
In the next release, whatever that will be named, there will be a new script function pickDroidStructLocation(). I had to introduce this function because the pickStructLocation() and pickStructLocationB() function calls do not check that you can actually build on the position the function returns. See #1626 for a closer explanation of the issue. Future code should use the new pickDroidStructLocation() rather than the other two. Parameter wise it is the same as pickStructLocationB() except it has a new first parameter that is the droid to build the structure. If it returns true, the coordinates it sets are guaranteed to be reachable by that droid.

The default AI scripts will be updated to use this function as time permits.

Re: New scripting function - pickDroidStructLocation

Posted: 21 Mar 2010, 00:04
by DylanDog
pickDroidStructLocation(droid, defStructs[count], ref buildX, ref buildY, me, -1)

What is the meaning of the last parameter (-1) ?

Re: New scripting function - pickDroidStructLocation

Posted: 21 Mar 2010, 11:35
by Per
IIRC, the last parameter is, like for pickStructLocationB, the maximum number of blocking tiles adjacent to the building. -1 means any number is allowed (useful for defenses).

Re: New scripting function - pickDroidStructLocation

Posted: 09 Apr 2010, 14:55
by DylanDog
This new function has a bug: #1755 opened