[Not needed] A_Chase wandering flag

Moderator: GZDoom Developers

A_Chase wandering flag

Postby Doris Blunningdad » Sun Mar 24, 2019 12:46 am

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.
Doris Blunningdad
 

Re: A_Chase wandering flag

Postby Cherno » Sun Mar 24, 2019 1:29 am

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
Cherno
 
Joined: 06 Dec 2016

Re: A_Chase wandering flag

Postby Arctangent » Sun Mar 24, 2019 2:06 am

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
Arctangent
squawky
 
Joined: 06 Nov 2014
Discord: SquawkyAtan#2371

Re: A_Chase wandering flag

Postby Graf Zahl » Sun Mar 24, 2019 3:25 am

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

Code: Select allExpand view
void A_VileWander()
{
    if (!A_CheckForResurrection()) A_Wander();
}


Simple enough for inlining even!
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: A_Chase wandering flag

Postby Rachael » Sun Mar 24, 2019 6:39 am

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.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: A_Chase wandering flag

Postby Blue Shadow » Sun Mar 24, 2019 1:09 pm

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 the function's page on the wiki, as an example.
User avatar
Blue Shadow
 
 
 
Joined: 14 Nov 2010
Operating System: Windows 10/8.1/8 64-bit
Graphics Processor: ATI/AMD (Modern GZDoom)


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest