Author Topic: Scripthooks for burning and smoke damage.  (Read 980 times)

Offline Nord

  • Commander
  • *****
  • Posts: 1644
  • The Gate is open.
    • View Profile
Scripthooks for burning and smoke damage.
« on: September 14, 2023, 08:37:11 pm »
Hi. I have a pair of questions:
1. Which ScriptHook is used when fire damage ignites a unit? (So we can influence this process?)
2. Which ScriptHook is used for stun damage from standing in smoke?

Because "HitUnit", as i see, does not work.
Thanks.

Offline Yankes

  • Commander
  • *****
  • Posts: 3210
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #1 on: September 14, 2023, 11:59:18 pm »
`damageUnit` is thing you look for.

Offline Nord

  • Commander
  • *****
  • Posts: 1644
  • The Gate is open.
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #2 on: September 15, 2023, 06:47:15 am »
`damageUnit` is thing you look for.
Are you sure? Because when fire bullet hits energy shield, and shield reduces bullet power to 0 (shield script uses hitUnit), a unit still become burning.

Offline Yankes

  • Commander
  • *****
  • Posts: 3210
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #3 on: September 15, 2023, 11:39:03 am »
Ok, I do not read carefully, my aswer was for fire and smoke environment damage (env fire catching is not scripted yet).
For handing fire during hit, there is special hook `damageSpecialUnit`that is repressible for this and other "post processing" of unit hit.

Offline Nord

  • Commander
  • *****
  • Posts: 1644
  • The Gate is open.
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #4 on: September 15, 2023, 07:59:05 pm »
Ok, I do not read carefully, my aswer was for fire and smoke environment damage (env fire catching is not scripted yet).
For handing fire during hit, there is special hook `damageSpecialUnit`that is repressible for this and other "post processing" of unit hit.
Aha, seems that my saved "verbose log" is outdated. Thanks, going to make new one.
« Last Edit: September 16, 2023, 11:16:08 am by Nord »

Offline Nord

  • Commander
  • *****
  • Posts: 1644
  • The Gate is open.
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #5 on: September 16, 2023, 11:16:32 am »
Well...
How do i can forbid unit to burn?
"unit.setFire 0;" does nothing.
Sorry for doubleposting.

Offline Yankes

  • Commander
  • *****
  • Posts: 3210
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #6 on: September 16, 2023, 12:12:15 pm »
Setting this you set fire that was "before" this hook call, as right after this hook engine code call `unit.setFire X` and override that you set there.
Whole point of this hook is expose `fire` variable that allow you to alter it for engine and it will be set on unit.

Offline Nord

  • Commander
  • *****
  • Posts: 1644
  • The Gate is open.
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #7 on: September 16, 2023, 01:41:23 pm »
Setting this you set fire that was "before" this hook call, as right after this hook engine code call `unit.setFire X` and override that you set there.
Whole point of this hook is expose `fire` variable that allow you to alter it for engine and it will be set on unit.
Ok, thanks.

So, if i want to prevent my unit from start burning, this script hook will not help me?
Then as i understand, ignition of units standing in fire is hardcoded?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8663
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #8 on: September 16, 2023, 02:13:46 pm »
So, if i want to prevent my unit from start burning, this script hook will not help me?

This script can help you.

But instead of using setFire yourself, you should just set the value of the output parameter(s) that will then call setFire for you.

What you're doing now:
1. game calculates duration of fire to be for example X = 7
2. you call setFire 0
3. game calls setFire X (7)

What you should be doing instead:
1. game calculates duration of fire to be for example X = 7
2. you change X from 7 to 0
3. game calls setFire X (0)

Then as i understand, ignition of units standing in fire is hardcoded?

yes, Yankes said above that the catching on fire from environment is not scripted yet

only hits by projectiles and explosions are scripted

you can still make the armor fire-proof, and the unit will not catch on fire then
« Last Edit: September 16, 2023, 02:30:37 pm by Meridian »

Offline Nord

  • Commander
  • *****
  • Posts: 1644
  • The Gate is open.
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #9 on: September 16, 2023, 05:15:49 pm »
...
What you're doing now:
1. game calculates duration of fire to be for example X = 7
2. you call setFire 0
3. game calls setFire X (7)
...
Ok, i dont understand that. One thing missing: what is "X" from this example in the terms of script?  Maybe you mean "BattleUnit.setFire" in the "newTurnUnit" script hook?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8663
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #10 on: September 16, 2023, 05:30:46 pm »
In terms of script, it is the 6th input/output parameter of the "damageSpecialUnit" hook, called "fire".

The one highlighted in the screenshot.

Offline Nord

  • Commander
  • *****
  • Posts: 1644
  • The Gate is open.
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #11 on: September 16, 2023, 06:30:16 pm »
So, command will be
Code: [Select]
set fire 0;Have tried. Did not work.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8663
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #12 on: September 16, 2023, 06:41:21 pm »
Can you paste the whole script?

And also describe in which scenario did you test it?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8663
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #13 on: September 16, 2023, 07:02:20 pm »
I just tried this and it works without problems:

Code: [Select]
extended:
  scripts:
    damageSpecialUnit:
      - offset: 88    # Script to disable setting units on fire by projectiles and explosions
        code: |
          set fire 0;
          return;

I sprayed my rookies with Autocannon Incendiary rounds and none of them caught on fire.

Offline Nord

  • Commander
  • *****
  • Posts: 1644
  • The Gate is open.
    • View Profile
Re: Scripthooks for burning and smoke damage.
« Reply #14 on: September 16, 2023, 08:16:56 pm »
Thanks, maybe i did something wrong. Will try again.