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

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: way to get is unconscious?
« Reply #15 on: November 13, 2023, 09:06:12 pm »
You have them allready. You can modify them, though.

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #16 on: November 14, 2023, 12:00:24 am »
You have them allready. You can modify them, though.

my code is it correct?

edit : tried it again,it breaks the script
« Last Edit: November 14, 2023, 12:08:51 am by Nirran »

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: way to get is unconscious?
« Reply #17 on: November 14, 2023, 07:02:41 am »
If you want to modify these, you need:
Code: [Select]
set to_Health temp;

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #18 on: November 14, 2023, 07:34:04 pm »
If you want to modify these, you need:
Code: [Select]
set to_Health temp;

What Is the exact sythax to get to_stun to_health?

this breaks the script

Code: [Select]
          to_Health temp;
          to_Stun stunLevel;

Offline Nord

  • Commander
  • *****
  • Posts: 1747
  • The Gate is open.
    • View Profile
Re: way to get is unconscious?
« Reply #19 on: November 14, 2023, 08:35:14 pm »
Code: [Select]
set temp to_health;

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #20 on: November 14, 2023, 08:46:42 pm »

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #21 on: November 15, 2023, 12:08:20 am »
what stun lvl knocks out the soldier?

cause this is what i just got when a soldier was knocked unconscious

Code: [Select]
[14-11-2023_14-06-22] [DEBUG] Script debug log: Unit Health: 27
[14-11-2023_14-06-22] [DEBUG] Script debug log: Unit Stun Level: 13

and this is the code

Code: [Select]
          debug_log "Unit Health:" to_health;
          debug_log "Unit Stun Level:" to_stun;  
          if gt to_stun to_health;

edit: typo
« Last Edit: November 15, 2023, 12:11:55 am by Nirran »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: way to get is unconscious?
« Reply #22 on: November 15, 2023, 12:39:04 am »
`to_health` is not health, same with stun. this is change of given stat or be precise "damage to X".

And what Meridian said still hold, unit is stunned when stun excess health. You have current health, stun and change to both.
You need calculate future version to know it.
Some thing like this:
Code: [Select]
var int status 0;
var int temp 0;
unit.getHealth temp;
add status temp;
unit.getStun  temp;
sub status temp;
sub status to_health;
sub status to_stun;
if gt status 0;
#code
end;
not tested, could be some typos here.

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #23 on: November 15, 2023, 04:49:49 am »
`to_health` is not health, same with stun. this is change of given stat or be precise "damage to X".

And what Meridian said still hold, unit is stunned when stun excess health. You have current health, stun and change to both.
You need calculate future version to know it.
Some thing like this:
Code: [Select]
var int status 0;
var int temp 0;
unit.getHealth temp;
add status temp;
unit.getStun  temp;
sub status temp;
sub status to_health;
sub status to_stun;
if gt status 0;
#code
end;
not tested, could be some typos here.


Thnx Dude you've been a great help,does this math look correct?seems to be working

Code: [Select]
          unit.getHealth Health;                 # get current health
          sub Health to_health;                  # sub projected hp loss from current hp
          #debug_log "Unit Health:" Health;     
         
          unit.getStun stunLevel;                # set var to unit stun level
          add stunLevel to_stun;                 # add projected stun level to current stun level
          #debug_log "Unit Stun:" stunLevel;       
         
          if gt stunLevel Health;
« Last Edit: November 15, 2023, 04:57:04 am by Nirran »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: way to get is unconscious?
« Reply #24 on: November 15, 2023, 12:08:31 pm »
Yes, it should work

Offline Nirran

  • Captain
  • ***
  • Posts: 94
    • View Profile
Re: way to get is unconscious?
« Reply #25 on: November 15, 2023, 11:43:07 pm »
Yes, it should work
thought it would be fine,wanted to double check,thnx for help and reply