Martin Howe Posted May 14, 2020 I've implemented a primitive corpse-eating mechanic in ZScript. Demo map attached. Feel free to do what you want with this :) Spoiler ZScript: version "3.7" Class MyFriendlyDemon : Demon { int startHealth; Actor aCorpse; int aCorpseDeathMass; ThinkerIterator corpseFinder; void A_FindFood() { if (aCorpse) { A_Face(aCorpse); self.goal = aCorpse; return; } corpseFinder.Reinit(); Actor someBody; while (someBody = Actor(corpseFinder.Next())) { if (!someBody.bIsMonster) continue; if (someBody.health > 0) continue; if (someBody.mass <= 0) continue; console.printf("Found a %s with %d calories! Yum Yum.", someBody.GetClassName(), someBody.mass); aCorpse = someBody; aCorpseDeathMass = someBody.mass; A_Face(aCorpse); self.goal = aCorpse; return; } } void A_ConsumeFood() { if (health >= startHealth) { if (aCorpse) { aCorpse = null; aCorpseDeathMass = 0; } return; } if (!aCorpse) { return; } if (aCorpse.mass == 0) { A_StartSound("demon/eat"); aCorpse.Destroy(); aCorpse = null; aCorpseDeathMass = 0; return; } int biteSize = aCorpseDeathMass / 4; if (biteSize > aCorpse.mass) biteSize = aCorpse.mass; int healthdiff = starthealth - health; if (biteSize > healthdiff) biteSize = healthdiff; if (bitesize > 0) { A_StartSound("demon/eat"); health += biteSize; aCorpse.mass -= biteSize; } if (aCorpse.mass == 0) { aCorpse.Destroy(); aCorpse = null; aCorpseDeathMass = 0; } if (health >= startHealth) { if (aCorpse) { aCorpse = null; aCorpseDeathMass = 0; } return; } } Default { +FRIENDLY; } States { Spawn: SARG A 1; SARG A 1 { startHealth = health; aCorpse = null; aCorpseDeathMass = 0; corpseFinder = ThinkerIterator.Create("Actor", STAT_DEFAULT); } SARG A 0 A_Jump(256, "Idle"); Idle: SARG A 10 A_Look(); SARG B 10 A_Look(); SARG B 0 A_Jump(256, "Idle"); See: SARG AABBCCDD 2 fast { if (health < startHealth) { if (!aCorpse) { console.printf("Dammit I'm hungry.\nMay the biggest demon anyone ever\nsaw grant me mana to eat!\n"); } A_FindFood(); if (aCorpse) { // Based on code in ZDoom Wiki article double blockdist = radius + aCorpse.radius; if ((abs(pos.x - aCorpse.pos.x) <= blockdist ) && (abs(pos.y - aCorpse.pos.y) <= blockdist ) && (pos.z + height >= aCorpse.pos.z ) && (pos.z <= aCorpse.pos.z + aCorpse.height ) ) { return A_Jump(256, "Eat"); } } } A_Chase(); return state (null); } Loop; Eat: SARG E 1 A_JumpIf(!aCorpse || (health >= startHealth), "See"); SARG E 0 fast A_Stop(); SARG E 8 fast A_Face(aCorpse); SARG F 8 fast A_Face(aCorpse); SARG G 16 fast A_ConsumeFood(); SARG G 0 A_JumpIf(!aCorpse || (health >= startHealth), "See"); Loop; Melee: SARG E 8 fast A_FaceTarget(); SARG F 8 fast A_FaceTarget(); SARG G 8 fast A_SargAttack(); SARG G 0 A_Jump(256, "See"); Pain: SARG H 2 fast; SARG H 2 fast A_Pain(); SARG H 0 A_Jump(256, "See"); Raise: SARG N 5; SARG M 5; SARG L 5; SARG K 5; SARG J 5; SARG I 5; SARG I 0 A_Jump(256, "See"); } } SndInfo demon/eat dscrunch // from VSB Doom MapInfo DoomEdNums { 30001 = MyFriendlyDemon } consume.zip 0 Quote Share this post Link to post
Morpheus666 Posted May 14, 2020 @Martin HoweAre you okay buddy? is everything good at home? 0 Quote Share this post Link to post
Martin Howe Posted May 14, 2020 (edited) Well, kinda, what with CoviD lock down etc :) This was actually inspired originally by ideas for morphed player monsters, like the chicken in Heretic; they can't pick up health, for example. Also, it would be a cool special effect. I did this in a customised ZDoom source port years ago, and somebody even did it in DosDoom back in the 90s (long story!). Anyhow, I'd be surprised if demons didn't eat marine corpses, they do come from Hell after all :P Edited May 14, 2020 by Martin Howe 0 Quote Share this post Link to post
P41R47 Posted May 14, 2020 Now we need a proper new TC in the vein of Blood to add this special feature as the only option to regain health and i'm totally in. Love the idea of cannibalism and necrophagia! Specially in times like this! . . . :P Jokes aside, it could be added also as a demon morphin mechanic, were you devour the corpses to sustain the demon tranformation effect. 2 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.