[DECORATE] How to check drowned corpses?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

[DECORATE] How to check drowned corpses?

Post by Void Weaver »

Since looks that I has manage to make what I want with help of A_CheckLOF, I get stuck with two another problems:
a) in my case CheckLOF don't see drowned corpses, those whose laid on the flooded floor (waterlevel>0);
б) I can't manage to correctly adjust second CheckLOF, which checks blocking of corpsechasing path, actors are always get stuck everywhere.
Here all of them get stucked and don't want "eat" drowned corpses:
_Regurgitator_Heretic_Stuck.JPG
Main check for looking corpses:

Code: Select all

A_CheckLOF ("CorpseCheck", CLOFF_FROMBASE|CLOFF_JUMPENEMY|CLOFF_JUMPFRIEND|CLOFF_JUMPNONHOSTILE|CLOFF_SKIPTARGET|CLOFF_BEYONDTARGET|CLOFF_ALLOWNULL|CLOFF_CHECKPARTIAL|CLOFF_SETTRACER, 2048, 0, user_CLOFangle, -180, 0, 0, AAPTR_NULL, 0)
Check for blocking corpsechasing path:

Code: Select all

RGWL A 0 A_FaceTracer
RGWL A 0 A_JumpIfTracerCloser (30, "CorpseRemove")
RGWL A 1 A_Recoil (-1)
RGWL A 0 A_CheckLOF ("CorpseChaseW", CLOFF_FROMBASE|/* CLOFF_JUMPENEMY|CLOFF_JUMPFRIEND|CLOFF_JUMPNONHOSTILE|*/CLOFF_JUMPOBJECT|CLOFF_MUSTBESOLID|CLOFF_JUMP_ON_MISS|CLOFF_SKIPTARGET/*|CLOFF_ALLOWNULL|CLOFF_NOAIM*/, 80, 0, 0, 0, 0, 0, AAPTR_TRACER, 0)
RGWL B 0 A_FaceTracer
RGWL B 0 A_JumpIfTracerCloser (30, "CorpseRemove")
RGWL B 1 A_Recoil (-1)
RGWL B 0 A_CheckLOF ("CorpseChaseW", CLOFF_FROMBASE|/* CLOFF_JUMPENEMY|CLOFF_JUMPFRIEND|CLOFF_JUMPNONHOSTILE|*/CLOFF_JUMPOBJECT|CLOFF_MUSTBESOLID|CLOFF_JUMP_ON_MISS|CLOFF_SKIPTARGET/*|CLOFF_ALLOWNULL|CLOFF_NOAIM*/, 80, 0, 0, 0, 0, 0, AAPTR_TRACER, 0)
... and so on...
"CorpseChaseW" - jumps to A_Wander sequence with returning to the path-blocking check sequence.

An actor itself have a next flags and properties:
Spoiler:
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: [DECORATE] How to check drowned corpses?

Post by Apeirogon »

You must use acs script which check monster health, and if its <= zero spawn on monster positions dummy actor, which must be checked in A_CheckLOF.
How make this script I dont remeber, since I used acs last time long long ago. Try to look into legendoom acs.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [DECORATE] How to check drowned corpses?

Post by Void Weaver »

Thank you for try to help, but:
a) ONLY decorate solutions is acceptable for me, because scripting is too hard for me, even ACS;
b) I know that my english is terrible, but I didn't wrote that my seek-and-eat-corpse code have any problems in general except of waterlevel check and bad adjusted second CLOF sequence for obstacles.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: [DECORATE] How to check drowned corpses?

Post by Apeirogon »

I suggest this because, I think, that monsters dont see drowned corpses because deep water in most old maps created by clipping actors through floor or other hacks to create illusion of depth.
And using new dummy actor could probably solve this problem.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [DECORATE] How to check drowned corpses?

Post by Void Weaver »

I fixed it already, and yes, your assumption seems to be right - CLOFF_FROMBASE flag doesn't allow check from actor's "feet" (as I thought before), instead of that its check from "basic" unflooded "floor". So I just did remove CLOFF_FROMBASE and set heightoffset to -25 value. Point a) was solved. :)

But I still can't manage to correct adjust CLOF for obstacles.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: [DECORATE] How to check drowned corpses?

Post by Apeirogon »

If it still important
I see you managed to store corpse actor as tracer. You can use rearrange pointers function
https://zdoom.org/wiki/A_RearrangePointers
to make target pointer equal to tracer pointer and use default a_chase. But I think that target pointer clears if target health == 0.

So again, spawn dummy actor on position of corpse and chase it instead.
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [DECORATE] How to check drowned corpses?

Post by Void Weaver »

Oh, yeah, it still important for me!
And yes, I already use a lot of A_RearrangePointers lines in my code, but seems that there is no need to use it in case of A_Chase for "dummy":
A_Chase=>
A_CheckLOF(_SETTRACER)=>
A_CheckFlag("CORPSE")=>
A_SpawnItemEx("dummy",ISTARGET)=> //Hmm, but how to place dummy-ISTARGET actor on CORPSE-_TRACER via decorate?!
A_Chase=>
A_JumpIfTargetCloser=>
{
A_Remove(_TRACER, _EVERYTHING);
A_Remove(_TARGET, _EVERYTHING, "dummy");
}

That seems very promising. But I dunno how to place dummy-ISTARGET actor on CORPSE-_TRACER via decorate. :-\
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: [DECORATE] How to check drowned corpses?

Post by Apeirogon »

Im not sure is it works, but you can try this

Code: Select all

set dead monster as target of you monster
a_givetotarget("spawn_dummy_actor")


actor spawn_dummy_actor : custominventory
{
inventory.maxamount 999999
states
{
     pickup:
     tnt1 a 0 a_spawnitemex("dummy_target")
     stop
}

} 

actor dummy_target
{
states
{
     spawn:
     tnt1 a 1
     loop
}

}
Or it must be use state insted of pickup....
User avatar
Void Weaver
Posts: 724
Joined: Thu Dec 18, 2014 7:15 am
Contact:

Re: [DECORATE] How to check drowned corpses?

Post by Void Weaver »

Oh, _givetotarget an custominventory, of course! Thank you! I'll try it and reply if I manage to do it.
Post Reply

Return to “Scripting”