Announcement

Collapse
No announcement yet.

Getting AI to do what I want

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

  • Getting AI to do what I want

    In my mod I have a sort of "holy city" that every civilization wants. Controlling it is worth many points.

    Is there a way using AI_ calls in GameUtils python scripts to convince the AI that it's utmost and important goal is to go after this city?

    I've tried the following but after simulating a whole game, the AI never builds ships, an army, sails to the city, and tries to take it. Maybe someone out there can suggest something?

    Code:
                    #HolyCity is the city all AI are after
    		if not pPlayer.isHuman() and pGroup.getActivityType() == -1:
    			# set activity
    			pGroup.setActivityType(6) #ActivityType.ACTIVITY_MISSION)
    
    			# push mission
    			#MissionType.MISSION_MOVE_TO=0
    		        #MissionType.MISSION_BEGIN_COMBAT=29
    			#MissionAIType.MISSIONAI_ASSAULT=18
    			pGroup.pushMission(0, 
                                   HolyCity.getX(), HolyCity.getY(), 0,
                                   False, False, 18, 
                                   CyMap().sPlot(HolyCity.getX(),HolyCity.getY()),
                                   pUnit)
    			pGroup.pushMission(29, 
    			                   -1, -1, 0,
                                   True, False, 18, 
                                   CyMap().sPlot(HolyCity.getX(),HolyCity.getY()),
                                   pUnit)
Working...
X