[ACS] Alternative to Thing_Hate to make monster target specific things?

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Alternative to Thing_Hate to make monster target specific things?

#1

Post by FranckyFox2468 » Tue Nov 07, 2017 9:03 pm

Cause i would like to make monsters that specifically target certain type of actors (like some sort of sentry buster or medic killer for instance) but my problem is, Thing_Hate takes only specific TIDs and cannot look for named thing.

So i started by checking ThingCountNameSector which was perfect for what i wanted to do since that script would simply look if that type of actor is present within a sector so i can give my game the greenlight to spawn that type of monster if, let's say a sentry, is present in this sector so he can try to go destroy it.

Problem is, said actor i want to spawn, or players in question are usually accompanied by a TID + player's number and i want said monster that is mean't to kill them to be able to look for the overall thing and not just specific TIDs because i am not even sure how the ever loving hell am i gonna start with this without something that might end up looping and lagging heavily, and i feel like this might make the monster spaz out and heavily confused if their target change randomnly and constantly, because if i make a script that goes "look for the first player number" i feel like whoever is gonna be the target in question will feel like the game e-fin hates them. I want the monster to be able to go for the nearest one as if it would target on its own.

So an alternative i thought was giving turrets inventory item upon spawning that serves as a "i am a turret", so monster would mainly focus on characters with this item. Problem is, it ends up with a monster that sorely focuses on people with this item instead of moving on to the non-thing its suppose to focus afterwards, and if there is many thing in is way, i feel like said monster will start spazzing cause its constantly looking at the same 5 target that doesn't have the inventory and just starts running around in circles doing nothing.

So im not exactly sure how to proceed on this matter.

User avatar
Mr. Repo
 
Posts: 82
Joined: Mon Jun 04, 2012 9:00 pm
Location: Los Angeles
Contact:

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#2

Post by Mr. Repo » Tue Nov 07, 2017 11:29 pm

Let me start by saying AI on this engine is very frustrating and inflexible. It's probably the aspect I hate dealing with the most when it comes to Doom modding and it feels like it's one of the engine's biggest limitations.

I just spent a while trying to explain/make sample code without any basis at all and every single time it just felt confusing and needlessly complicated. Would you mind pasting the code you made for the turret targeting monster that runs around in circles?

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#3

Post by FranckyFox2468 » Tue Nov 07, 2017 11:51 pm

I don't exactly have a code, i just feel like concidering how the doom ai works (your statement is pretty accurate on that regard), its the most likely case scenario that will happen because i don't exactly see why it wouldn't do that. I am mainly double checking, based on what could've already been known, if it is something that would be indeed possible instead of wasting hours on testing something im not even sure will work because of... well, how weird the AI can be.

Concidering the ammount of hidden stuff and mechanics i was never aware of on doom and was never informed on wikis and such, if monsters automatically does a thing where they stop looking for a specific target permanently if they don't have xy thing, i wouldn't even know.

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#4

Post by jdagenet » Wed Nov 08, 2017 12:52 am

If I’m understanding this correct, just perform a radial check from the turret. If it returns any monsters inside the radius then have those monsters hate the turret.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#5

Post by FranckyFox2468 » Wed Nov 08, 2017 3:12 pm

jdagenet wrote:
Wed Nov 08, 2017 12:52 am
If I’m understanding this correct, just perform a radial check from the turret. If it returns any monsters inside the radius then have those monsters hate the turret.
No no no, i want only CERTAIN type of monsters to specifically hate turrets (and not just ONE type of turret as there might be multiple of em depending on the player class) and focus on em if there are any active within its radius, but is otherwise able to behave like any monster if there isn't any active.

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#6

Post by Empyre » Wed Nov 08, 2017 6:19 pm

FranckyFox2468 wrote:
Wed Nov 08, 2017 3:12 pm
jdagenet wrote:
Wed Nov 08, 2017 12:52 am
If I’m understanding this correct, just perform a radial check from the turret. If it returns any monsters inside the radius then have those monsters hate the turret.
No no no, i want only CERTAIN type of monsters to specifically hate turrets (and not just ONE type of turret as there might be multiple of em depending on the player class) and focus on em if there are any active within its radius, but is otherwise able to behave like any monster if there isn't any active.
Jdagenet's idea is what you want, then. Instead of having the monsters look for turrets to hate, have the turrets (each type of them) look for monsters to hate them. If a turret finds a monster in its radius, and if the monster is the right type (or one of the right types), make the monster hate the turret. If you are worried about the overhead, have the turret do that search every 5 tics, which would still be 7 times every second, or every 7 tics, which would be 5 times a second.
"For the world is hollow, and I have touched the sky."

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#7

Post by FranckyFox2468 » Wed Nov 08, 2017 7:04 pm

I have a couple of questions:

So i suppose that if the turret finds a monster with X inventory it makes it execute an ACS that makes it focus it? (by executing an ACS that sets the target as activator of the hate) but then wouldn't doing something like a_radiusgive that gives an item that checks if said inventory item is present in the monsters inventory be more effective? Then again, im not sure if inventory items could be tied to a TID so the monster starts looking for the specific turret... Unless that can be done?

Cause otherwise, if there is a horde of monsters in front of said anti-turret monster, won't it take a while till the turret actually starts targeting said monster and make it execute the ACS if we take your procedure?

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#8

Post by jdagenet » Wed Nov 08, 2017 9:49 pm

FranckyFox2468 wrote:
Wed Nov 08, 2017 7:04 pm
Then again, im not sure if inventory items could be tied to a TID so the monster starts looking for the specific turret... Unless that can be done?
TID's can be represented by the amount of inventory in the actor at the time. For example, if something has a TID of 207, then give 207 of a dummy inventory item to link the TID. In your monster code you could check the turret's inventory, which in turn is actually checking the TID.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#9

Post by FranckyFox2468 » Thu Nov 09, 2017 7:13 pm

Hm, that's actually a really good idea. And to avoid spazzing, i could make some sort of cooldown so the monster is forced to be focused on a certain turret for atleast 5-10 seconds to avoid spazzing. But problem is, what if he receives two inventory at once from two different turrets simultanously? Won't that mess things up? Then again i suppose if the code does not find a turret of this non existant huge inventory he could just cancel the thing and re-try but i still fear some shit might happen...

Lollipop
Zandrone
Posts: 1123
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#10

Post by Lollipop » Thu Nov 09, 2017 7:55 pm

It is also possible to flip the FRIENDLY flag of the turret, check for targets, flip the flag again, and once again check for targets. This should all be done with 0 duration states. To determine if the target is an eligible target for targeting, the actors that should be attacked should have a specific inventory item to identify them. There are also other ways, where AOW turrets come to mind, which you could also look at.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#11

Post by FranckyFox2468 » Wed Jan 03, 2018 5:01 am

jdagenet wrote:
Wed Nov 08, 2017 9:49 pm
FranckyFox2468 wrote:
Wed Nov 08, 2017 7:04 pm
Then again, im not sure if inventory items could be tied to a TID so the monster starts looking for the specific turret... Unless that can be done?
TID's can be represented by the amount of inventory in the actor at the time. For example, if something has a TID of 207, then give 207 of a dummy inventory item to link the TID. In your monster code you could check the turret's inventory, which in turn is actually checking the TID.
Okay but now i've been thinking, what happens if two things gives TIDs at once, and once something has a TID, how do i make sure the inventory is cleared afterwards before he gets an over abundance of that dummy inventory? Cause if there is 5 turrets at once all built by different players i feel like this is where shit is gonna get tricky.

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

[ACS] Re: Alternative to Thing_Hate to make monster target specific things?

#12

Post by Empyre » Wed Jan 03, 2018 7:57 am

If two things give TIDs in the same tic, there is no telling which one will be processed first, but they will definitely be processed one at a time, so they will never accidentally assign the same TID..
"For the world is hollow, and I have touched the sky."

Post Reply