Eliminate Shrunk Enemies Attacking Bug - EDukeWiki

# Eliminate Shrunk Enemies Attacking Bug

From EDukeWiki
A screenshot of the "Shrunk Enemies Attacking" bug.

You probably have seen this bug before.

If you shoot an shrunken enemy, and it activates the hitting animation, it will start processing the normal enemy code, but still remain small and not go back to the original size.

To fix that bug, you need to find the main ifhitweapon statement in the enemy code, which is in GAME.con by default. You will find that code many times, but probably all them will be already in the if condition from the main ifhitweapon or you have confused ifhitweapon with ifwasweapon.

All you have to do to fix this bug is add an ifai AI<enemyname><SHRUNK\SHRINK> break statement before the main ifhitweapon. Remember to search at the beginning of the enemy code for name of their shrunk artificial intellegence, as the Assault Trooper's (actor LIZTROOP) is AITROOPSHRUNK while the Pig Cop's (actor PIGCOP) is AIPIGSHRINK.

Sample:
In the Assault Trooper's (actor LIZTROOP) code, there will be the state state checktroophit where there are many ifhitweapon primitives, but they are all before ifhitweapon state checktroophit, so all them are already under that main tag.

Here is the actual code described above:

      ifhitweapon
        state checktroophit
      else
        state checksquished

Change it to this:

      state checksquished

      ifai AITROOPSHRUNK break
      ifhitweapon
        state checktroophit

It is necessary to rearrange the code to prevent more bugs, as shown here.

In v1.5, the LIZTROOP is the only enemy that requires this fix, as all of the others already have a ifai AI<enemyname><SHRUNK\SHRINK> break statement before the hit state is called, or at the very top of the hit state.

Do you remember what happens when you shoot an Assault Captain before he teleports? Only when he comes back will he fall dead / explode / et cetera. With this code this is exactly what will happen with the shrunken enemy; only when he grows back will he be able to take hits and get shot once more. Also, fixing this bug prevents another from happening: Normally, on the Damn I'm Good skill level or if you're playing respawning multiplayer, if you exploit this bug and kill him, when he respawns he will stay shrunken.

Retrieved from "http://wiki.eduke32.com/w/index.php?title=Eliminate_Shrunk_Enemies_Attacking_Bug&oldid=11023"
Category:

- Tutorials