aliens

Author Topic: [Answered] Scripting a battle log  (Read 2081 times)

Offline Saedriss

  • Squaddie
  • *
  • Posts: 4
    • View Profile
[Answered] Scripting a battle log
« on: November 17, 2022, 03:13:22 pm »
Hello.
I would like to create a mod that allows the display of attack notification during gameplay, especially during Alien Turns.
The idea would be to have it displayed in a corner as follow :
ATTACKER -> TARGET (RESULT)

examples :
SECTOID -> JOHN DOE (HIT)
SECTOID -> JOHN DOE (MISS)
JOHN DOE -> SECTOID (REACT HIT)
UNKNOWN -> JOHN DOE (HIT) // Enemy out of sight here.

And I think it might be doable in a Ruleset using scripts hook such as "damageUnit", "hitUnit", etc. But I was not able to find documentation on how to use these.
« Last Edit: February 12, 2023, 03:23:12 pm by Meridian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: [QUESTION] Documentation regarding script hooks
« Reply #1 on: November 17, 2022, 03:18:05 pm »
First of all `(MISS)` is for now impossible to implement, as any script is called only when bullet hit its target.
For methods data that are available in scripts you can ask your OXCE exe adding verbose loggin in config.
For overall info about scripts read: https://www.ufopaedia.org/index.php/ModScript_(OpenXcom)

Offline Saedriss

  • Squaddie
  • *
  • Posts: 4
    • View Profile
Re: [QUESTION] Documentation regarding script hooks
« Reply #2 on: November 17, 2022, 09:23:56 pm »
Thanks, I might cut back on the initial ambition, indeed.

I got the script to log things as intended (mostly) now the only issue is to find a way to display it as text in game.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: [QUESTION] Documentation regarding script hooks
« Reply #3 on: November 17, 2022, 11:31:43 pm »
To display to player you have function `BattleGame.flashMessage` that show temporal text under buttons.

Offline Saedriss

  • Squaddie
  • *
  • Posts: 4
    • View Profile
Re: [QUESTION] Documentation regarding script hooks
« Reply #4 on: November 18, 2022, 03:49:26 am »
That it does.
But only one message at a time and for a very brief moment.

I guess my dream of a "battle log" on the side of the game's window are beyond my reach.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3349
    • View Profile
Re: [QUESTION] Documentation regarding script hooks
« Reply #5 on: November 18, 2022, 01:32:22 pm »
There is variant of thins function that show text around 4 time longer, it have similar name to one I post prevously