generic individual alert function

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

generic individual alert function

Post by Matt »

I'm imagining something like

Code: Select all

bool Alert(actor alerted, actor target, actor alertsource=null, int flags=0);
with a return for whether the actor was successfully alerted.

Would be useful for stuff like this, or other interactions where only a single monster is being alerted to a specific thing (pickpocket, touch, very narrow line-of-sight check).

Flags might include:
- forcing an already alerted monster to switch targets
- don't play the alert sound
- allow an immediate attack(?)
- allow targeting of friendlies or same-team
User avatar
MartinHowe
Posts: 2022
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom
Contact:

Re: generic individual alert function

Post by MartinHowe »

Hope necrobumping this one is OK if it gives a solution, as I was trying to do this myself and found a (partial) answer at least from within ZScript:

To make your monster's target target your monster in return:
self.target.LastHeard = self;

This works (I tried it). I have to go back to work soon so haven't got time to flesh it out, but this should get you started.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: generic individual alert function

Post by Matt »

Sweet, thanks! Does doing this play alert sounds and stuff as well?
(EDIT: yes it does!)

Doom's AI is such a total black box to me...
EDIT: This is a help
Last edited by Matt on Wed May 13, 2020 1:09 am, edited 2 times in total.
User avatar
MartinHowe
Posts: 2022
Joined: Mon Aug 11, 2003 1:50 pm
Location: Waveney, United Kingdom
Contact:

Re: generic individual alert function

Post by MartinHowe »

Well I have had to do a lot of looking through the source, both c++ and ZScript, while developing this actor, and a lot of it is still a mystery to me. I haven't worked on ZDoom since 2008 (morphing code) and even the bits that haven't been rewritten since then give me that "WTF?! Did I really write that?!" feeling :p

What I can say, experimentally, is that this is functionally equivalent to firing a pistol right next to the monster, so he gives his "Sight" sound, turns to attack, etc. Given time, and a moment of inspiration, something more elaborate could be forged.
Post Reply

Return to “Feature Suggestions [GZDoom]”