aliens

Author Topic: way to get is unconscious?  (Read 4481 times)

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
way to get is unconscious?
« on: November 06, 2023, 12:23:14 am »
title says it,for soldiers

edit : i did search the verbose dump

edit 2: fixed typo's
« Last Edit: November 06, 2023, 08:12:43 am by Nirran »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9089
    • View Profile
Re: way to get is unconscious?
« Reply #1 on: November 06, 2023, 11:32:34 am »
the title is not even a proper English sentence

I don't understand what you're asking

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #2 on: November 06, 2023, 06:47:03 pm »
when soldiers are damaged,sometimes it makes them unconscous,how do i detect it with scripting?

sorry for ambiguous post

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9089
    • View Profile
Re: way to get is unconscious?
« Reply #3 on: November 06, 2023, 07:15:20 pm »
They are unconscious if they have bigger stun level than health.

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #4 on: November 06, 2023, 07:43:10 pm »
They are unconscious if they have bigger stun level than health.

thnx Meridian,once again

edit: assuming thats current health not max?
« Last Edit: November 06, 2023, 09:21:04 pm by Nirran »

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #5 on: November 08, 2023, 05:07:29 am »
ok then this should cover it?

Code: [Select]
          unit.getHealth temp;
          unit.getStun stunLevel;
          debug_log "Unit Health:" temp;
          debug_log "Unit Stun Level:" stunLevel;  
          if gt stunLevel temp;

Offline Nord

  • Commander
  • *****
  • Posts: 1746
  • The Gate is open.
    • View Profile
Re: way to get is unconscious?
« Reply #6 on: November 09, 2023, 11:05:43 am »
Code: [Select]
...
          unit.isCollapsing temp;
          if gt temp 0;
          ...

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #7 on: November 09, 2023, 09:45:50 pm »
Code: [Select]
...
          unit.isCollapsing temp;
          if gt temp 0;
          ...

thnx dude,any special var declare needed?

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: way to get is unconscious?
« Reply #8 on: November 09, 2023, 11:53:50 pm »
thnx dude,any special var declare needed?
Yes any new identifier like `temp` in this case, need be defined before use, and `var` is used to define this variable that use that identifier.

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #9 on: November 10, 2023, 01:10:26 am »
Yes any new identifier like `temp` in this case, need be defined before use, and `var` is used to define this variable that use that identifier.

place in

Code: [Select]
  scripts:
    damageUnit:
      - offset: 99
        code: |
          var int temp;
          var int stunLevel;
          var ptr GeoscapeSoldier soldier;

correct?

and whats wrong with this?

Code: [Select]
          unit.isCollapsing temp;
          if gt temp 0; 
            battle_game.flashMessage "STR_UNCONSCIOUS_STRING"; # NumericVariable; #Display text string and numeric variable
            unit.getHealthMax temp;
            unit.setHealth temp;
            mul temp 4;
            unit.setStun temp;
            set to_health 0;
            set to_stun 0;
            set to_wound -50;
            unit.disableIndicators;
            unit.setTag Tag.LRF_IS_DEAD 1;
            return;
          end;

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: way to get is unconscious?
« Reply #10 on: November 10, 2023, 11:11:16 am »
place in

Code: [Select]
  scripts:
    damageUnit:
      - offset: 99
        code: |
          var int temp;
          var int stunLevel;
          var ptr GeoscapeSoldier soldier;

correct?
yes

and whats wrong with this?

Code: [Select]
          unit.isCollapsing temp;
          if gt temp 0; 
            battle_game.flashMessage "STR_UNCONSCIOUS_STRING"; # NumericVariable; #Display text string and numeric variable
            unit.getHealthMax temp;
            unit.setHealth temp;
            mul temp 4;
            unit.setStun temp;
            set to_health 0;
            set to_stun 0;
            set to_wound -50;
            unit.disableIndicators;
            unit.setTag Tag.LRF_IS_DEAD 1;
            return;
          end;
look in logs, all errors have all details described in logs

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #11 on: November 10, 2023, 10:11:32 pm »
log has no error,and shows my var checking if collapsing is always 0

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: way to get is unconscious?
« Reply #12 on: November 10, 2023, 11:11:02 pm »
because your unit is collapsED not collapsING. This function is used to detecting state where unit get stunned or killed and now falling down on ground.
Meridian said correct solution because this is definition when unit enter stunned state.

Overall, I check functions exposed to script and I see that I simply not added one used for killed units and stunned ones.
Probaby in some next version there will be new two functions `unit.isStunned temp;` and `unit.isKilled temp;`.

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #13 on: November 10, 2023, 11:31:37 pm »
because your unit is collapsED not collapsING. This function is used to detecting state where unit get stunned or killed and now falling down on ground.
Meridian said correct solution because this is definition when unit enter stunned state.

Overall, I check functions exposed to script and I see that I simply not added one used for killed units and stunned ones.
Probaby in some next version there will be new two functions `unit.isStunned temp;` and `unit.isKilled temp;`.

ok thanks dude

edit : i think im annoying ppl,sorry if i am,lemme know what i am doing to cause it
« Last Edit: November 11, 2023, 12:08:53 am by Nirran »

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #14 on: November 13, 2023, 08:05:04 pm »
what is the correct way to get these ?

Code: [Select]
          to_Health temp;
          to_Stun stunLevel;