Cancel a cease-fire offer?

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

Cancel a cease-fire offer?

Postby harpy eagle » Sat Apr 07, 2018 7:03 am

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: 1390
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Cancel a cease-fire offer?

Postby sven » Sun Apr 08, 2018 9:23 pm

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: 276
Joined: Sat Mar 10, 2018 3:25 am

Re: Cancel a cease-fire offer?

Postby harpy eagle » Sun Apr 08, 2018 11:20 pm

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: 276
Joined: Sat Mar 10, 2018 3:25 am

Re: Cancel a cease-fire offer?

Postby harpy eagle » Mon Apr 09, 2018 3:42 am

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: 1390
Joined: Sat Jan 31, 2015 10:24 pm
Location: British Columbia, Canada
Contact:

Re: Cancel a cease-fire offer?

Postby sven » Mon Apr 09, 2018 4:47 am

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.


Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest