A_Chase wandering flag

Moderator: GZDoom Developers

Post Reply
Guest

A_Chase wandering flag

Post by Guest »

As far as I know, it's impossible to have an actor both wander aimlessly and resurrect corpses like the Archvile does. If possible, a flag for A_Chase which causes the calling actor to aimlessly wander (like A_Wander) instead of actively chasing foes would be useful.

If it actually is possible to do this already, I'd like to know how.
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: A_Chase wandering flag

Post by Cherno »

Quite possible via zScript. Call A_Wander, and in Tick(), get the nearest corpse and if it's within a certain distance (radius, for example), resurrect.
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: A_Chase wandering flag

Post by Arctangent »

Cherno wrote:Quite possible via zScript. Call A_Wander, and in Tick(), get the nearest corpse and if it's within a certain distance (radius, for example), resurrect.
Using Tick() is not only completely unlike how the Archvile's resurrection works, but it also means the actor would interrupt its other states to raise a monster - including its own Death state - if proper checks aren't put into place.

It would make far more sense to write up, say, a A_VileWander for the actor, which does the corpse detection, then calls A_Wander if it doesn't find anything.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_Chase wandering flag

Post by Graf Zahl »

A_CheckForResurrection has already been exported for ZScript so the entire thing can be implemented as a one-liner in user code:

Code: Select all

void A_VileWander()
{
    if (!A_CheckForResurrection()) A_Wander();
}
Simple enough for inlining even!
User avatar
Rachael
Posts: 13532
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: A_Chase wandering flag

Post by Rachael »

This should be posted/stickied somewhere. As simple as that function is, it likely will be extremely useful to some folks who might not be able to come up with that on their own.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: A_Chase wandering flag

Post by Blue Shadow »

Rachael wrote:This should be posted/stickied somewhere. As simple as that function is, it likely will be extremely useful to some folks who might not be able to come up with that on their own.
It could be added to [wiki=A_CheckForResurrection]the function's page on the wiki[/wiki], as an example.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”