Tíquete #44842

Lua: Missing Civ2 scripting API

: 2022-06-15 21:38 Última Atualização: 2022-06-28 03:00

5 - Medium
5 - Medium


Parts of Civ2 scripting language as described here not yet having any equivalent in Freeciv:

  • NEGOTIATION - an event of starting talks with an ability to cancel the meeting.
  • NOSCHISM - prevents a civil war (may be some switch to put in "city_destroyed" or "city_transferred" callback, though may just set cw probability to 0 and trigger it by scripts when needed)
  • MAKEAGGRESSION - a method to cancel peace treaty (in general, something to manipulate diplomatic relations, Civ2 Great Wall effect maybe works like this.

Ticket History (2/2 Histories)

2022-06-15 21:38 Updated by: ihnatus
  • New Ticket "Lua: Missing Civ2 scripting API" created
2022-06-28 03:00 Updated by: ihnatus

Some ideas, doubt I'll code them in near time: as it was said, NOSCHISM is already doable, just maybe the AI sometimes needs a modifier of a desire to take other prayer's capital (we even have a apecial strategy mode for focusing on a capital used in the space race handling that though seems to work poorly). We can relatively easily make a method (Player):set_dipl_rel(string what, Player to_whom); again, a wonder triggering it needs some evaluation that shall depend on the player's current desire for the given pacts.

The diplomatic blocker is a more interesting task. Maybe we can just make "NoDiplomacy" a targeted effect, but that would need more requirement types to test other_player factor properties. About the Lua solution, we can have an event "players_try_meet", but how it would decide if the meeting is blocked? I once made a patch that allowed to pass lua_Objects to events, so that some of them get tables from the caller and can modify them. Maybe a simpler way would be just reading second return value of the callback. It would be nice if AI and the human players could know before can they meet; so, the other option is making a script-controlled field in the struct player_diplstate that would tell it, and we can switch it off within the callback or before.

We can, furtherly, control adding and removing clauses in a pact. AI should get some idea in can, say, an individual city be added to the treaty, and if it can't, what other clause can be modified to make it possible. But this is beyound this ticket and probably needs a fullscale Lua AI module.

Attachment File List

No attachments


You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login