[SOLVED] Actor completely stops targeting

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
TDRR
Posts: 813
Joined: Sun Mar 11, 2018 4:15 pm
Operating System Version (Optional): Manjaro/Win 8.1
Graphics Processor: Intel (Modern GZDoom)
Location: Venezuela

[SOLVED] Actor completely stops targeting

Post by TDRR »

*removed link*

I'm using ACS+DECO to control a player to do player-y stuff. It works just fine, except that it only attacks once or twice and once it's target is dead, it will NEVER target anything else, no matter what. I tried many different things to fix it, and none of them worked.

The relevant code is contained in Source/DECOBOT.acs and acscodepointers.dec. DECORATE also has a bit of relevant code but it's not exactly critical to the rest. Type in the console "addbot" to spawn the actor that has this problem. (Does not work in any IWAD or weapons mod that is not Doom, Heretic, Hexen, Chex Quest or Strife)

The main thinking code is in DECOBOT.acs though, and acscodepointers.dec is used mostly as an interface with the actor.
Last edited by TDRR on Thu May 23, 2019 4:26 pm, edited 2 times in total.
User avatar
Dan_The_Noob
Posts: 869
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Actor completely stops targeting

Post by Dan_The_Noob »

what does the "YeahSeen" token do exactly? it's hard to follow

--edit--
I'm just trying to follow a line from spawn to attack... does the bot have infinite ammo or something?
Also, i couldn't get bots to spawn period so have no ingame reference.
User avatar
TDRR
Posts: 813
Joined: Sun Mar 11, 2018 4:15 pm
Operating System Version (Optional): Manjaro/Win 8.1
Graphics Processor: Intel (Modern GZDoom)
Location: Venezuela

Re: Actor completely stops targeting

Post by TDRR »

Dan_The_Noob wrote:what does the "YeahSeen" token do exactly? it's hard to follow

--edit--
I'm just trying to follow a line from spawn to attack... does the bot have infinite ammo or something?
Also, i couldn't get bots to spawn period so have no ingame reference.
Sorry, was in a hurry yesterday so couldn't post the full instructions.

Here's some more detail: YeahSeen is a token used for basically anything but i named it like that because it originally was for checking line of sight with the target, you will see it always immediately after some codepointer, because it's an item given by those codepointers to indicate a successful script execution/jump to another "state".

You need a bot config to spawn the bots, for instance the one posted here: viewtopic.php?f=43&t=64527
Alternatively, just loading the bots in Zandronum removes the need for any bot config.
The bot's ammo is dictated by the real weapon it's carrying, internally they work like real players, not monsters, their targeting system is still almost entirely monster-like though. Which is why you can spectate them with F12 and see them actually firing their weapon exactly like a real player, animation and everything.
User avatar
Dan_The_Noob
Posts: 869
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Actor completely stops targeting

Post by Dan_The_Noob »

TDRR wrote:
Dan_The_Noob wrote:what does the "YeahSeen" token do exactly? it's hard to follow

--edit--
I'm just trying to follow a line from spawn to attack... does the bot have infinite ammo or something?
Also, i couldn't get bots to spawn period so have no ingame reference.
Sorry, was in a hurry yesterday so couldn't post the full instructions.

Here's some more detail: YeahSeen is a token used for basically anything but i named it like that because it originally was for checking line of sight with the target, you will see it always immediately after some codepointer, because it's an item given by those codepointers to indicate a successful script execution/jump to another "state".

You need a bot config to spawn the bots, for instance the one posted here: viewtopic.php?f=43&t=64527
Alternatively, just loading the bots in Zandronum removes the need for any bot config.
The bot's ammo is dictated by the real weapon it's carrying, internally they work like real players, not monsters, their targeting system is still almost entirely monster-like though. Which is why you can spectate them with F12 and see them actually firing their weapon exactly like a real player, animation and everything.
I had a bit of a look at it yesterday... my best guess is it's out of ammo and not checking?
if it operates like a player its guns would need ammo checks, i guess?
User avatar
TDRR
Posts: 813
Joined: Sun Mar 11, 2018 4:15 pm
Operating System Version (Optional): Manjaro/Win 8.1
Graphics Processor: Intel (Modern GZDoom)
Location: Venezuela

Re: Actor completely stops targeting

Post by TDRR »

Dan_The_Noob wrote: I had a bit of a look at it yesterday... my best guess is it's out of ammo and not checking?
if it operates like a player its guns would need ammo checks, i guess?
Nope, the bot is not aware of how much ammo it has. It does, however, switch to the next best weapon with ammo, which if it happens to be the fist (or some other melee weapon), then it rushes forward to it's target and furiously punches it.

The thing is, it doesn't even target anything at all after killing the first couple targets. Doesn't face them, doesn't attempt to attack and isn't even aware of their existence. I'm stumped as to why this is.
User avatar
TXTX
Posts: 195
Joined: Thu Sep 12, 2013 5:53 pm
Location: A Hidden Location

Re: Actor completely stops targeting

Post by TXTX »

Do you use A_Chase after it stops targeting? That usually handles all targeting procedures for monsters. Hexen firedemons had a similar problem with a mod of my own. If anything you could have it call A_Cleartarget which will also clear up its currrent target, past target, and heard target. Might give you a place to look at least.
User avatar
TDRR
Posts: 813
Joined: Sun Mar 11, 2018 4:15 pm
Operating System Version (Optional): Manjaro/Win 8.1
Graphics Processor: Intel (Modern GZDoom)
Location: Venezuela

Re: Actor completely stops targeting

Post by TDRR »

TXTX wrote:Do you use A_Chase after it stops targeting? That usually handles all targeting procedures for monsters. Hexen firedemons had a similar problem with a mod of my own. If anything you could have it call A_Cleartarget which will also clear up its currrent target, past target, and heard target. Might give you a place to look at least.
Oh wow, it works! Thanks a lot mate, i can finally continue these bots the proper way!
User avatar
Dan_The_Noob
Posts: 869
Joined: Tue May 07, 2019 12:24 pm
Graphics Processor: nVidia with Vulkan support
Contact:

Re: Actor completely stops targeting

Post by Dan_The_Noob »

TDRR wrote:
TXTX wrote:Do you use A_Chase after it stops targeting? That usually handles all targeting procedures for monsters. Hexen firedemons had a similar problem with a mod of my own. If anything you could have it call A_Cleartarget which will also clear up its currrent target, past target, and heard target. Might give you a place to look at least.
Oh wow, it works! Thanks a lot mate, i can finally continue these bots the proper way!
so... it WAS token/list related?
User avatar
TDRR
Posts: 813
Joined: Sun Mar 11, 2018 4:15 pm
Operating System Version (Optional): Manjaro/Win 8.1
Graphics Processor: Intel (Modern GZDoom)
Location: Venezuela

Re: Actor completely stops targeting

Post by TDRR »

Dan_The_Noob wrote:
TDRR wrote:
TXTX wrote:Do you use A_Chase after it stops targeting? That usually handles all targeting procedures for monsters. Hexen firedemons had a similar problem with a mod of my own. If anything you could have it call A_Cleartarget which will also clear up its currrent target, past target, and heard target. Might give you a place to look at least.
Oh wow, it works! Thanks a lot mate, i can finally continue these bots the proper way!
so... it WAS token/list related?
Actually, the bug seems to be ZDoom specific, and after testing it in Zandro (which i did above) the problem dissapeared. That's unacceptable, so i just cherry-picked the best parts for the TDBots instead of rewriting it using the DecoBot AI.
Post Reply

Return to “Scripting”