Make monster hate other monsters OR player; whichever first

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Nash
 
 
Posts: 17484
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Make monster hate other monsters OR player; whichever first

Post by Nash »

I want one monster to start attacking other monsters (except its own kind), OR players, whichever gets into his line of sight first. My DECORATE-fu isn't really that good so I was hoping anyone could toss some ideas around on how I would achieve this? Thanks.
User avatar
zrrion the insect
Posts: 2432
Joined: Thu Jun 25, 2009 1:58 pm
Location: Time Station 1: Moon of Glendale

Re: Make monster hate other monsters OR player; whichever fi

Post by zrrion the insect »

I imagine you would have a_changeflag set the monster to friendly, call a_look, unset friendliness, call a_look, and repeat for the spawn state. This would get any monster though, including other monsters of this type.
User avatar
Nash
 
 
Posts: 17484
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Make monster hate other monsters OR player; whichever fi

Post by Nash »

Ah, that makes sense... perhaps I could throw in a CallACS somewhere that checks if the current target == its own species, clear its target and stop chasing, then go back to the Spawn loop to start looking for eligible targets again?!

Hmm or maybe it's easier to just use A_CheckSpecies and skip the CallACS.

Next question:

If the monster is woken up (in most cases, via "hearing" the player) it will put the player in his target and attempt to chase the player. But, while chasing, I want the monster to also have the ability to instead just chase and attack whatever other monsters that he could see, if he doesn't get to the player first.

BASICALLY, I'm trying to create a monster that just wants to kill every living thing in the level, player or other monster alike. So, on his way to chase the player, he will also attempt to chase and kill every other monster that stands in his path. How do?

Would hacking this by making invisible, no-damage radiuses to constantly trigger infighting be a viable option or is that just clunky/hacky?
User avatar
Captain Ventris
Posts: 4608
Joined: Mon Jul 31, 2006 4:25 pm
Location: San Antonio, TX

Re: Make monster hate other monsters OR player; whichever fi

Post by Captain Ventris »

Nash wrote:Would hacking this by making invisible, no-damage radiuses to constantly trigger infighting be a viable option or is that just clunky/hacky?
Well you have to make the monster responsible immune to splash damage because I have something that does exactly this and they desperately (but futiley) would try to murder each other the moment it started for whatever reason. Though the end result is really not that the monster tries to kill everything else, but that everything else tries to kill the monster. So it'll usually initially try to kill the player, but a nearby monster will get bugged and hit it, thus attracting its attention. End result is that it will get in a brawl with whatever is nearby.
User avatar
.+:icytux:+.
Posts: 2661
Joined: Thu May 17, 2007 1:53 am
Location: Finland

Re: Make monster hate other monsters OR player; whichever fi

Post by .+:icytux:+. »

Not possible for me to test atm but.

How would you set the monster changing targets? by distance?

In that case (this is tedious)
Make a custom state the monster always jumps to after all the other states
and start with:

Code: Select all

Look:
TNT1 A 0 A_changeflag() friendly (or the other way around, whatever you want it to prioritize)
TNT1 A 0 A_LookEx with a short distance
TNT1 A 0 A_changeflag() unfriendly
TNT1 A 0 A_LookEx with a short distance
TNT1 A 0 A_changeflag() friendly
TNT1 A 0 A_LookEx with a slightly longer distance
TNT1 A 0 A_changeflag() unfriendly
TNT1 A 0 A_LookEx with a slightly longer distance

ETC

POSS ABCD A_Wander
loop
You get the idea. You might want to have the "Don't play see sound" flag checked in the A_LookEX :P (aswell as perhaps the deaf flag, not sure how a monster hears another monster, and on the last A_LookEX, you make it hear again)
And if it fails to aquire a target, i guess you have it A_Wander around.

The see state would then be

Code: Select all

POSS ABCDABCDABCDABCDABCD 4 A_Chase
Goto Look
And the rest of the states would end the same way with a "goto look" or whatever (except death duh. Perhaps pain goes to see so it chases the one that hurts him)

I don't remeber if you need to somehow clear the last target, but I remeber that it is doable.

[EDIT]
http://zdoom.org/wiki/A_CheckSightOrRange
http://zdoom.org/wiki/A_ClearTarget
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: Make monster hate other monsters OR player; whichever fi

Post by Matt »

I remember reading something a while back about how friendly monsters have to check LOS with every other monster on the level and how this could seriously affect performance in ways that normal monsters never would. How many of these guys are you planning to have running around at a time?
User avatar
kodi
 
 
Posts: 1355
Joined: Mon May 06, 2013 8:02 am

Re: Make monster hate other monsters OR player; whichever fi

Post by kodi »

I wonder if it'd work in multiplayer mode by assigning the monsters to a team of their own.
Locked

Return to “Editing (Archive)”