Announcement

Collapse
No announcement yet.

Initial Python reference

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • The code above doesn't work. Any idea how to change it.
    And how i can name the unit by python?
    Last edited by Thror78; September 15, 2006, 22:35.

    Comment


    • I'm not aware of the existance of any function called addFreeUnit, but just 91 without the cast should work fine. gc.getDefineINT should work for the unit name as well if you're looking for that.
      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

      Comment


      • Originally posted by wotan321
        So... in a python related question..... what code could I add to my events file, so that at the beginning of the scenario, each unit is visited and set to "fortify"?
        Probably something along the lines of:

        Code:
        def onGameStart(self, argsList):
        	if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR")):
        		for iPlayer in range(gc.getMAX_PLAYERS()):
        			pPlayer = gc.getPlayer(iPlayer)
        			for iGroup in range(pPlayer.getNumSelectionGroups()):
        				gGroup = pPlayer.getSelectionGroup(iGroup)
        				gGroup.pushMission(gc.getDefineINT("MISSION_FORTIFY", 0, 0, 0, false, false, -1, gGroup.plot(), gGroup.getHeadUnit())
        Disclaimer: untested, can't guarantee it'll do anything (or even that it doesn't contain typos)
        Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

        Comment


        • My problem is the same. I don't know how execute it!

          ________________________________
          admiral@digitalhardcore.us

          Comment


          • Is there a version of the python api updated to patch 2.08?

            Comment


            • Will this API every be updated for BtS?
              Ceeforee v0.1 - The Unofficial Civ 4 Editor -= Something no Civ Modder should ever be without =- Last Updated: 27/03/2009
              "Just because I'm paranoid doesn't mean there's no conspiracy"

              Comment

              Working...
              X