Sniper one hit killing CRPL unit

Running Rat · 342

Running Rat

  • Jr. Member
  • **
    • Posts: 16
on: July 12, 2020, 12:41:11 am
I am trying to make a CRPL unit that can withstand some sniper attacks. I make it vulnerable to sniper attacks, but I also give it a ton of health. However, snipers just one shot it despite its health. How do I fix this? Here is the code. 
Code: [Select]
once
Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute
Self CONST_SNIPERTARGET 1 SetUnitAttribute
Self CONST_HEALTH 20000 SetUnitAttribute
endonce



Builder17

  • Community Guild
  • *****
    • Posts: 1143
  • My account picture is from Nitrome Mutiny.
Reply #1 on: July 12, 2020, 03:00:21 am
I am trying to make a CRPL unit that can withstand some sniper attacks. I make it vulnerable to sniper attacks, but I also give it a ton of health. However, snipers just one shot it despite its health. How do I fix this?

You need CONST_MAXHEALTH as well, before CONST_HEALTH.

Code: [Select]
once
Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute
Self CONST_SNIPERTARGET 1 SetUnitAttribute
Self CONST_MAXHEALTH 80 SetUnitAttribute
Self CONST_HEALTH 80 SetUnitAttribute
endonce

Sniper damage per shot is 20, so maybe 80 or 100 health?

Also, should it regenerate health?
« Last Edit: July 12, 2020, 03:03:20 am by Builder17 »



Running Rat

  • Jr. Member
  • **
    • Posts: 16
Reply #2 on: July 12, 2020, 05:21:29 am
I am trying to make a CRPL unit that can withstand some sniper attacks. I make it vulnerable to sniper attacks, but I also give it a ton of health. However, snipers just one shot it despite its health. How do I fix this?

You need CONST_MAXHEALTH as well, before CONST_HEALTH.

Code: [Select]
once
Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute
Self CONST_SNIPERTARGET 1 SetUnitAttribute
Self CONST_MAXHEALTH 80 SetUnitAttribute
Self CONST_HEALTH 80 SetUnitAttribute
endonce

Sniper damage per shot is 20, so maybe 80 or 100 health?

Also, should it regenerate health?

Thanks Builder17. I realize that this a lot of health, but this enemy is going to be a boss. It will be the only enemy you fight on the entire map. For comparison, sleeper nodes have 10,000 health, but they have lots of minions and they’re usually backed up by emitters and they limit you to 10 snipers (although they’re also vulnerable to other weapons.) Of course I still might decide that this is too much health and tone it down a bit. As for regenerating health, I know things regenerate health super slowly by default (like it takes more than 10 minutes to recover from a single sniper shot,) but I don’t want to speed its health regeneration up. I want the player to be able to wear down its health over the course of the game.