Page 1 of 1

Cancel a cease-fire offer?

Posted: Sat Apr 07, 2018 7:03 am
by harpy eagle
So in the code there is a function for offering cease-fires in combat: Battle.set_cease_fire_offer(e1,e2,true)

Is there a way to rescind the cease fire offer at a later time? I've tried calling Battle.set_cease_fire_offer(e1,e2,false) but it didn't work the way I expected.

Re: Cancel a cease-fire offer?

Posted: Sun Apr 08, 2018 9:23 pm
by sven
harpy eagle wrote:Is there a way to rescind the cease fire offer at a later time? I've tried calling Battle.set_cease_fire_offer(e1,e2,false) but it didn't work the way I expected.


Hrm. From what I can see on the C++ side, that should have worked. I take it the offer wasn't actually rescinded?

Re: Cancel a cease-fire offer?

Posted: Sun Apr 08, 2018 11:20 pm
by harpy eagle
I should have saved the game where it was occurring, unfortunately I can't reproduce the issue anymore.

But basically I have code that looks like this:

Code: Select all

  if <CONDITIONS>
    local empire = current_side()
    local attack = all_attacks[get_attack_id()]

    for other_empire in pairs(attack.sides)
      if Battle.enemy(empire,other_empire) and not Battle.get_cease_fire_offer(empire,other_empire)
        console("offering a cease fire to ",other_empire,empire)
        action.offer_cease_fire(empire,other_empire)
      end
    -- ...
    end
  else
    --cancel any cease fire offers
    local empire = current_side()
    local attack = all_attacks[get_attack_id()]

    for other_empire in pairs(attack.sides)
      if Battle.get_cease_fire_offer(empire,other_empire)
        console("rescinding cease fire to ",other_empire,empire)
        Battle.set_cease_fire_offer(empire,other_empire,false)
      end
    end
  end

And in the console I could see the message that the offer was rescinded, but the battle ended in a draw anyways.

I'll have to post back here when/if I can reproduce it.

Re: Cancel a cease-fire offer?

Posted: Mon Apr 09, 2018 3:42 am
by harpy eagle
Actually, there's no way for the player to send a cease-fire, is there?

Because if not, then I don't need to be able to cancel the cease-fire offer after all.

Re: Cancel a cease-fire offer?

Posted: Mon Apr 09, 2018 4:47 am
by sven
harpy eagle wrote:Actually, there's no way for the player to send a cease-fire, is there?


Yeah, cease-fires are an AI vs. AI only feature. And given the way the AI's are using the feature in practice, I think it's very unlikely that a human player would ever *want* to offer a cease fire.