Cancel a cease-fire offer?

A place for discussion of making game modifications.
Post Reply
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Cancel a cease-fire offer?

Post 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.
User avatar
sven
Site Admin
Posts: 1621
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Cancel a cease-fire offer?

Post 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?
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Cancel a cease-fire offer?

Post 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.
User avatar
harpy eagle
Posts: 296
Joined: Sat Mar 10, 2018 3:25 am

Re: Cancel a cease-fire offer?

Post 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.
User avatar
sven
Site Admin
Posts: 1621
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Cancel a cease-fire offer?

Post 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.
Post Reply