generic individual alert function

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

Moderator: GZDoom Developers

generic individual alert function

Postby Matt » Tue Sep 17, 2019 5:28 pm

I'm imagining something like
Code: Select allExpand view
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
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: generic individual alert function

Postby MartinHowe » Tue May 12, 2020 6:23 am

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
MartinHowe
In space, no-one can hear you KILL an ALIEN
 
Joined: 11 Aug 2003
Location: Waveney, United Kingdom

Re: generic individual alert function

Postby Matt » Tue May 12, 2020 12:51 pm

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
Matt
Putting the XD into *xdeath since 2007
 
Joined: 04 Jan 2004
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: generic individual alert function

Postby MartinHowe » Tue May 12, 2020 3:17 pm

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.
User avatar
MartinHowe
In space, no-one can hear you KILL an ALIEN
 
Joined: 11 Aug 2003
Location: Waveney, United Kingdom


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests