Hello. I'm trying to build a monster that does different things depending on whether it is in the player's 90 FOV, or outside a 180 FOV (behind the player's back), and etc.
While the idea is not new, i haven't found anybody having problems with this function, and the wiki implies that it should work.
I'm using "A_JumpIfInTargetLOS", but it works as i imagine "A_JumpIfTargetInLOS" should instead. Actually, the monster's behavior doesn't change if i use either of those functions.
So say the guy is supposed to die if the player sees him (well not always, but from a certain state loop which is reached by other means), but when the guy enters the state in which he should die upon being seen, he instead dies if the player gets in front of him.
Every aspect of the monster's behavior works perfectly otherwise, so i highly doubt it's a problem of my decorate code.
I apologize if this problem is known, i couldn't find any answers before posting this.
[2.5.0] Should A_JumpIfInTargetLOS work?
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Re: [2.5.0] Should A_JumpIfInTargetLOS work?
I'm guessing the issue here is that the monster does not actually acquire the player as a target until it sees the player. (The aim of A_Look is to find targets after all.) So when the player gets in front of the monster, the monster acquires a target, and the check for being in the target's line of sight can now work.
Try a setup with the monster spawned behind the player, so that it can acquire a target immediately.
Try a setup with the monster spawned behind the player, so that it can acquire a target immediately.
Re: [2.5.0] Should A_JumpIfInTargetLOS work?
Nope, the monster acquires a target with no error.
After some consideration, i decided to post his code. I don't know if it is horrible or ok, since i'm not very experienced with decorate yet (i've done a few things that may be considered complicated, but then again, maybe they'd be complicated only for myself).
How it works now:
He runs up to the player, stops when he's close (128-close), does the D pose.
Now if you go away he resumes chasing you, and if you get behind his back he does the G pose.
After that you can again run away to make him move, or get in front of his face to kill him.
How i intended it to work:
(bear in mind that the poses are for testing purposes, the finished guy should just be invisible until it dies - it's sort of a screamer thing)
He runs up to the player and stops when close, and enters loop 3 when he's behind the player's back. So when he's in loop3 and the player turns around and sees him, he dies.
It's supposed to be just a thing to scare you sometimes when you turn around. Also, he probably should check if he's uncomfortably close to the player (like, inside) and not appear then, but that comes later. Now the issue is with the FOV function.
After some consideration, i decided to post his code. I don't know if it is horrible or ok, since i'm not very experienced with decorate yet (i've done a few things that may be considered complicated, but then again, maybe they'd be complicated only for myself).
Code: Select all
health 5000
speed 10
DeathSound "*death"
+ISMONSTER
+NOTARGETSWITCH
+NOTARGET
+LOOKALLAROUND
states
{
Spawn:
PLAY A 0
PLAY A 1 A_Look
loop
See:
PLAY A 2
goto LOOP1
LOOP1:
PLAY A 1 A_Chase
PLAY A 1 A_JumpIfCloser (128, "LOOP2")
loop
LOOP2:
PLAY D 3 A_JumpIfCloser (256, 1)
goto LOOP1
PLAY D 3 A_JumpIfInTargetLOS (1, 180)
goto LOOP3
PLAY D 3 A_Chase
loop
LOOP3:
PLAY G 2 A_JumpIfCloser (256, 1)
goto LOOP1
PLAY G 2 A_JumpIfInTargetLOS (1, 90)
loop
PLAY G 2 A_FaceTarget
goto Death
Death:
PLAY H 10
PLAY I 10 A_Scream
PLAY J 10 A_NoBlocking
PLAY KLM 10
PLAY N -1
StopHe runs up to the player, stops when he's close (128-close), does the D pose.
Now if you go away he resumes chasing you, and if you get behind his back he does the G pose.
After that you can again run away to make him move, or get in front of his face to kill him.
How i intended it to work:
(bear in mind that the poses are for testing purposes, the finished guy should just be invisible until it dies - it's sort of a screamer thing)
He runs up to the player and stops when close, and enters loop 3 when he's behind the player's back. So when he's in loop3 and the player turns around and sees him, he dies.
It's supposed to be just a thing to scare you sometimes when you turn around. Also, he probably should check if he's uncomfortably close to the player (like, inside) and not appear then, but that comes later. Now the issue is with the FOV function.
Re: [2.5.0] Should A_JumpIfInTargetLOS work?
Apologies for not logging in, i'm the author of the topic. Woops.
- Siggi
- Posts: 3288
- Joined: Sun Oct 03, 2004 8:57 am
- Preferred Pronouns: They/Them
- Location: South Africa
Re: [2.5.0] Should A_JumpIfInTargetLOS work?
Fixed that for you.Antroid wrote:Apologies for not logging in, i'm the author of the topic. Woops.
Re: [2.5.0] Should A_JumpIfInTargetLOS work?
Thanks!
Now if only somebody could help me with the gosh-darn function. Everything seems to imply it works, but i can't get it to work properly. Maybe there's actually something wrong with the rest of the monster's code? I only left out spawnID, the name and the brackets, otherwise it's the complete decorate entry.
Re: [2.5.0] Should A_JumpIfInTargetLOS work?
Fixed, I assume. Since the example is not runnable as-is, I haven't bothered to actually check. But it looks like it should be fixed now.
