New scripting function - pickDroidStructLocation

For AI and campaign script related discussions and questions

New scripting function - pickDroidStructLocation

Postby Per » 16 Mar 2010, 21:31

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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3625
Joined: 03 Aug 2006, 19:39

Re: New scripting function - pickDroidStructLocation

Postby DylanDog » 21 Mar 2010, 00:04

pickDroidStructLocation(droid, defStructs[count], ref buildX, ref buildY, me, -1)

What is the meaning of the last parameter (-1) ?
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
User avatar
DylanDog
Code contributor
Code contributor
 
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany

Re: New scripting function - pickDroidStructLocation

Postby Per » 21 Mar 2010, 11:35

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).
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3625
Joined: 03 Aug 2006, 19:39

Re: New scripting function - pickDroidStructLocation

Postby DylanDog » 09 Apr 2010, 14:55

This new function has a bug: #1755 opened
My Warzone 2100 mods:
Download DyDo-AI for Warzone skirmish/multiplayer games.
Download A2C-HM (Alpha 2 Campaign - Hard Mode).
Download A3C-HM (Alpha 3 Campaign - Hard Mode).
User avatar
DylanDog
Code contributor
Code contributor
 
Posts: 347
Joined: 08 Apr 2009, 15:15
Location: Germany


Return to Scripting