Announcement

Collapse
No announcement yet.

Player Relations from Python

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

  • Player Relations from Python

    Is there a python function to alter the relation between players?

    My intention is when an event is executed to reduce or improve relations between all other players with the active player.

    Is there another solution I haven't considered?

  • #2
    Solution

    I figured out my issue. I'll post a complete python function when I get home, but the basics are this:

    Use the event arguments to get the active player

    Loop through each of the players in the game

    if the player isAlive()

    call the player.AI_changeAttitudeExtra with the current player's id and the change desired as arguments

    http://civilization4.net/files/modding/PythonAPI/

    Edit: And here's the code

    def doReduceAttitude(argsList):
    kTriggeredData = argsList[1]
    player = gc.getPlayer(kTriggeredData.ePlayer)

    for iLoopPlayer in range(gc.getMAX_CIV_PLAYERS()):
    loopPlayer = gc.getPlayer(iLoopPlayer)
    if loopPlayer.isAlive():
    loopPlayer.AI_changeAttitudeExtra(kTriggeredData.e Player, -3)
    player.AI_changeAttitudeExtra(iLoopPlayer, -3)
    Last edited by Chronovore; September 30, 2009, 19:05. Reason: Added Code

    Comment

    Working...
    X