Announcement

Collapse
No announcement yet.

how to: set city to build..

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to: set city to build..

    How do I set a city to build a certain unit? The only function that seems able to set what the city build is chooseProduction(). But as far as I can tell, it does nothing. This is the code I have.

    city = iPlayer.getCapitalCity()
    city.chooseProduction(17,-1,-1,true)
    city.hurry(1)

    The capital city acutally hurry everything it builds, so I know line #1 and #3 works. But I can't force it to choose to build a certian unit.
    Last edited by BlueO; December 25, 2005, 14:50.

  • #2
    Apparently the city.chooseProduction function is what calls the popup that asks you what you want to build. So it is probably not what you want to use.

    To add things to the build queue, you would probably need to use city.pushOrder. I haven't gotten pushOrder to work though. It keeps saying does not match C++ signature.

    If you just want to create a unit in the capital city,

    city = iPlayer.getCapitalCity()
    player = gc.getPlayer(iPlayer)
    unit = player.initUnit(17, city.getX(), city.getY(), UnitAITypes.NO_UNITAI)

    This will create a warrior in your capital city If you want you can set the experience for the new warrior. Do this with:

    unit.changeExperience(INT iChange, INT iMax)

    or

    unit.setExperience(INT iNewValue, INT iMax)

    Comment

    Working...
    X