RE2/RE3N inspired Hunter Enemy aspects

Wed Dec 30, 2020 8:45 am



I'm trying to figure out how to make a proper Hunter (or Tyrant-styled) enemy for my project, there's just a couple of issues (beyond placeholder art) that I don't know how to resolve entirely (the more advanced Zscript is still new to me)

1) More or less, there would be two static consts damagetype lists for "CanStunHunter" and "CanKillHunter" used for bringing the Hunter to heal, and destroying the hunter entirely respectively.
1a) CanStunHunter can bring the Hunter down to half health, upon which the H-actor will detect that it's time to be brought down to knee. Any attempt to bring it's health down with non-CanKillHunter listed damagetypes will result in no effect if the Hunter is in it's cooldown state.
1b) CanKillHunter is pretty explanatory, if a weapon is listed in that const, it means that even if the Hunter is in cooldown, it will still take damage and be ultimately killed from the const-listed damagetypes.
1c) If a damagetype is not under either const lists, it simply does not do damage to the Hunter.
2) The cooldown pain state is probably the easier part, essentially I want it in a way where I can force the Hunter into the specific state through the override Tick() (rather than a delayed basic States method)

Rough ideas in this WIP code below:
https://pastebin.com/9TdQ2xFb

Re: RE2/RE3N inspired Hunter Enemy aspects

Wed Dec 30, 2020 9:49 am

You will probably want to override the DamageMobj virtual function, check the damage type (the mod parameter), and go from there (if it's not one of the two hurting types, set the damage to 0 for the Super function; compare current health if it is).

Code:
bool gotoCooldown;
override int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags, double angle)
{
   int modifiedDamage = damage;
   if(String.format("%s",mod) ~== "cankillhunter" || (String.format("%s",mod) ~== "canstunhunter" && health > SpawnHealth() / 2))
   {
      modifiedDamage = damage;//you might want to ensure that the canstunghunter damagetype can't lower the health to less than 1/2 SpawnHealth()
      gotoCooldown = true;
   }
   else
   {
       modifiedDamage = 0;
      gotoCooldown = false;
   }
   return Super.DamageMobj(inflictor,source,modifiedDamage,mod,flags,angle);
}

//Example for getting into Cooldown state (you could also adapt it to work via Tick()):

States
{
   Pain:
   TNT1 A 0
   {
        if(gotoCooldown)
      {
         gotoCooldown = false;
         return ResolveState("CooldownState");
      }
      return ResolveState(null);
   }
   //... normal pain frames
}

Re: RE2/RE3N inspired Hunter Enemy aspects

Fri Nov 05, 2021 6:43 am

Looking at this again, what about checking for a list of Constants that have a list of legal "to kill damage types" to deal fatal damage, and treating everything else as just "stun to cooldown when half" damage"? Such a method of using direct MODs isn't possible since I'm using damage types for all weapons and enemies, and IIRC they can only have one set damage type.