Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Running Rat on July 12, 2020, 12:41:11 AM

Title: Sniper one hit killing CRPL unit
Post by: Running Rat 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. 

once
Self CONST_NULLIFIERDAMAGES 0 SetUnitAttribute
Self CONST_SNIPERTARGET 1 SetUnitAttribute
Self CONST_HEALTH 20000 SetUnitAttribute
endonce

Title: Re: Sniper one hit killing CRPL unit
Post by: Builder17 on July 12, 2020, 03:00:21 AM
Quote from: Running Rat 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?

You need CONST_MAXHEALTH as well, before CONST_HEALTH.


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?
Title: Re: Sniper one hit killing CRPL unit
Post by: Running Rat on July 12, 2020, 05:21:29 AM
Quote from: Builder17 on July 12, 2020, 03:00:21 AM
Quote from: Running Rat 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?

You need CONST_MAXHEALTH as well, before CONST_HEALTH.


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.