Enemies with multiple hit points

Status
Not open for further replies.
I am making a new enemy called the Jetty-Syn Commander and I'm trying to give it two hitpoints like the Crawla Commander. I've tried setting the thing's health to 2 but it didn't work, can anyone help me with this?
 
Take note of the Crawla Commander; it also has two HP, but it works fine. The reason why is that its painstate tells it to flinch and be temporarily be invulnerable. That's what your Jetty-Syn needs, or else it will continually take damage when the player is attacking it.

I'm a novice at soccing, so I can't help you beyond that.
 
Chances are, your Jetty-Syn commander does actually have 2 HP, however, SRB2 handles HP in sortof a weird way. What's happening, is you collide with the enemy for more than two tics. The game reads that you've hit the enemy each time for every tic, causing the enemy to take more damage. Hence, it ultimately appears to have only one HP.

The solution, is to grant the enemy invulnerability for about a second after each hit. This is accomplished using A_SetObjectFlags, to set the... object's flags to be intangible and unaffected by gravity. Have about a second of delay, then call A_SetObjectFlags again to return the enemy's flags to normal.
 
Draykon said:
The solution, is to grant the enemy invulnerability for about a second after each hit. This is accomplished using A_SetObjectFlags, to set the... object's flags to be intangible and unaffected by gravity. Have about a second of delay, then call A_SetObjectFlags again to return the enemy's flags to normal.
Okay, now how exactly am I going to do that? Yeah, I know this requires additional states and such...

EDIT: I think I might experiment with something...
 
The wiki explains how to use A_SetObjectFlags. You need to make the first call in the object's painstate, and the second call in the state that the painstate leads to.
 
I'll try that.

EDIT: Tried it, and it didn't work. All it does is that it made the damn thing invincible! Did I do anything wrong? D:
 
You have to make sure it makes it to the state where it recovers it's vulnerability. Perhaps posting the contents of the SOC would be a good idea?
 
Okay, here's the contents of what makes the Jetty-Syn Commander.
Code:
Thing 304
MAPTHINGNUM = 9501
SPAWNSTATE = 1723
SPAWNHEALTH = 2
SEESTATE = 1725
SEESOUND = 0
REACTIONTIME = 2
ATTACKSOUND = 115
PAINSTATE = 1729
PAINCHANCE = 200
PAINSOUND = 12
MELEESTATE = 0
MISSILESTATE = 1727
DEATHSTATE = 603
DEATHSOUND = 22
XDEATHSTATE = 0
SPEED = 263404
RADIUS = 1310720
HEIGHT = 2097152
MASS = 100
DAMAGE = 0
ACTIVESOUND = 117
RAISESTATE = 91
FLAGS = 16779781

FRAME 1723
SPRITENUMBER = 201
SPRITESUBNUMBER = 0
DURATION = 4
NEXT = 1724
ACTION A_Look
VAR1 = 0
VAR2 = 0

FRAME 1724
SPRITENUMBER = 201
SPRITESUBNUMBER = 1
DURATION = 4
NEXT = 1723
ACTION A_Look
VAR1 = 0
VAR2 = 0

FRAME 1725
SPRITENUMBER = 201
SPRITESUBNUMBER = 0
DURATION = 1
NEXT = 1726
ACTION A_JetgThink
VAR1 = 0
VAR2 = 0

FRAME 1726
SPRITENUMBER = 201
SPRITESUBNUMBER = 1
DURATION = 1
NEXT = 1725
ACTION A_JetgThink
VAR1 = 0
VAR2 = 0

FRAME 1727
SPRITENUMBER = 201
SPRITESUBNUMBER = 2
DURATION = 1
NEXT = 1728
ACTION A_TurretFire
VAR1 = 0
VAR2 = 0

FRAME 1728
SPRITENUMBER = 201
SPRITESUBNUMBER = 3
DURATION = 1
NEXT = 1725
ACTION A_TurretStop
VAR1 = 0
VAR2 = 0

FRAME 1729
SPRITENUMBER = 201
SPRITESUBNUMBER = 0
DURATION = 1
NEXT = 1730
ACTION A_SetObjectFlags
VAR1 = 4
VAR2 = 1

FRAME 1730
SPRITENUMBER = 201
SPRITESUBNUMBER = 1
DURATION = 1
NEXT = 1726
ACTION A_SetObjectFlags
VAR1 = 4
VAR2 = 2
And I've already made it to be vulnerable again but it still gets killed in one hit. :\
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top