Inteligent chasing

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
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Inteligent chasing

Post by Apeirogon »

As everyone dont knows, because I dont say to anyone, I try make more smart chase function for monsters. Yes, Zscript.
So I forced every monster spawn warping child actor at its target. And I want to stop its warping if it master and target dont have direct line of sight. How make it?
Meaning is if player hide from that monster it start aproaching to this dummy actor, last place where monster see him target. This is more logical and realistic than "I smell you through all walls and >9000 unit of map units, n'wah"
RaveYard
Posts: 186
Joined: Fri Apr 12, 2013 10:51 am

Re: Inteligent chasing

Post by RaveYard »

The child's target or the master's target?

Regardless, use CheckSight in the child:

Code: Select all

if(master.CheckSight(master.target, SF_IGNOREVISIBILITY))
{
 //Perform warp
}
SF_IGNOREVISIBILITY ignores if the actor is +INVISIBLE or renderstyle none and such.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Inteligent chasing

Post by Apeirogon »

That works, thanks.

Now, about some hit from 90.
If monster chose target and it is behind map "table", or other obstacle through he can see it target but cant walk like grid, it start spin round and round try find way to target. What I say...everyone already knows how monster lost betwen three barrel.
How make monster choose right direction where walk to bypass an obstacle and face it target?
I already have some ideas, like if monster stuck in the way to its target it start spam above the floor harmless hitscan attack, puff from which start spam same hitscan attack and iterate it until some hitscan attack hit curently monster target. But I imagine how much processor time that will take for one monster. And monster in doom wad rarely walk alone.

I heard that Zscript have function BlockLinesIterator, but at wiki and known to me Zscript mod its not represented. So I dont know how it work, how work with this and even dont know is that the function what I needed.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Inteligent chasing

Post by Apeirogon »

How make flying monsters fly directly to its target, not "change a little X-Y coordinate, then little change Z coordinate, repeat" like they walk/fly invisible air stairs, which looks jerky?
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Inteligent chasing

Post by Apeirogon »

Come on guys, killing blind kitten, who are the enemies now, dont grants great fame.
Post Reply

Return to “Scripting”