aliens

Author Topic: [Documentation] Flash messages in BattleScape for scripts  (Read 4879 times)

Offline memmaker

  • Captain
  • ***
  • Posts: 96
    • View Profile
[Documentation] Flash messages in BattleScape for scripts
« on: January 26, 2020, 08:02:49 pm »
Enables scripts to communicate strings with integer values back to the user using the battlescape warning text feature.

Example usage, display hit information:

Code: [Select]
extended:
  scripts:
    damageUnit:
      - offset: 99
        code: |
          if gt to_health 0;
            battle_game.flashMessage "STR_DAMAGE_DEALT" to_health to_armor;
          end;
          return;

extraStrings:
  - type: en-US
    strings:
      STR_DAMAGE_DEALT: "HP: {0} / Armor: {1}"

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #1 on: January 26, 2020, 09:02:34 pm »
This and the other additions to scripting you've been documenting look like useful extensions. Makes me wish I had more time to write some mod features that use them, keep it up!

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #2 on: January 28, 2020, 08:39:08 am »
This can be used to indicate shield strength.

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11731
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #3 on: January 28, 2020, 01:27:12 pm »
This can be used to indicate shield strength.

Good point. Well, I would only display something like "Their shields are holding!", but it's still an important indicator.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #4 on: January 28, 2020, 07:37:46 pm »
Quote
Headshot!
Only correct usage of this new feature :)

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #5 on: January 28, 2020, 08:10:42 pm »
Only correct usage of this new feature :)

Not true, there's one more:



Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #6 on: March 14, 2020, 10:21:08 pm »
Not true, there's one more:




if that would be possible I would be SO happy!

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #7 on: March 14, 2020, 11:04:58 pm »
Those aren't edited clips, that's a mod I made using scripts: https://openxcom.mod.io/death-splash-messages

The flash messages would make it a lot easier to do this and lets you do longer messages.

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #8 on: March 15, 2020, 10:18:59 am »
So for anyone who tired of unknown shields strength:
Code: [Select]
#YANKES SCRIPT
          # Make the unit flash a color to denote shield was hit
          if and gt temp 0 eq power 0; # But only if shield is left over
           
            battle_game.flashMessage "STR_SHIELD" temp; #THIS IS NEW

            battle_game.getAnimFrame temp;
            unit.setTag Tag.UNIT_RECOLOR_START_FRAME temp;
            unit.setTag Tag.UNIT_RECOLOR_FRAME_LENGTH 3;

            armorRuleset.getTag temp Tag.ARMOR_ENERGY_SHIELD_FLASH_COLOR;
            if eq temp 0;
              set temp COLOR_X1_BLUE1; # Default color is bright blue
            end;
            unit.setTag Tag.UNIT_RECOLOR_COLOR temp;
          else; #AND THIS IS NEW
            battle_game.flashMessage "STR_SHIELD_DOWN"; #Display that shield breached #AND THIS
          end;

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #9 on: March 16, 2020, 12:25:48 pm »
OK, I looked at replacing a unit sprite with a message and i think i would like to see something else for my XCF flashbangs - more like vanilla bleeding icon. Replacing unit sprite looks too brutal to me...

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11731
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #10 on: March 16, 2020, 08:09:25 pm »
Next step: whenever an agent dies, this song plays :)


Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #11 on: March 17, 2020, 12:51:00 am »
Next step: whenever an agent dies, this song plays :)

you can always change death sound)))

Online Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11731
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: [Documentation] Flash messages in BattleScape for scripts
« Reply #12 on: March 17, 2020, 02:53:20 pm »
you can always change death sound)))

Sure, but no proper scream kinda kils the mood...  ;D