python callback canBuild question

Joined
Jul 5, 2004
Messages
23,562
Location
Canberra, Australia
I have units that need to be able to place resources on the map. To do this I need to use the canBuild python callback. One unit, the Great Farmer, can under some circumstances place an ivory resource. Another unit, a captured elephant, should be always able to place an ivory resource. (Neither can place on an existing resource).

However, as far as I can see, there is no way to tell which unit is trying to do the build. Am I wrong?
 
:yup: right.
But why should you want to check it in this way? You can do the separation in the XML files.

Indeed the XML does but a captured elephant can always place the elephant resource but the GF has some restrictions on it when it can or not. Which means you need to know the unit inside the canBuild function which you don't.

While waiting in a queue I think I have come up with a better solution anyway. Just build mission buttons like in the tutorial.
 
Top Bottom