Visual triggers?

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
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Visual triggers?

Post by ::Bloodfury:: »

Hi!

How hard would this be to pull off?
Don't quite know where to start.
Something with linetrace function?

My idea is that whether a player is staring at something, be it an object or a spesific part of a wall, an event would happen.
Like monster spooking you only if it is in direct view. Furthermore could the radius be adjusted. So that the visual target only nearly
in the center of your player camera would execute the desired events.

Where would I start. I have some experience in ACS and basic understanding of coding, and just have began to learn Zscript.

Thanks in advance. :)
User avatar
SPZ1
Posts: 388
Joined: Wed Aug 02, 2017 3:01 pm
Location: Illinois
Contact:

Re: Visual triggers?

Post by SPZ1 »

A couple of the enemies in my SPZ1 game project use this ZSCRIPT to check if they're being looked at:

Code: Select all

See:
   EMPT A 6 {
      if (CheckIfInTargetLOS(125.0, 0, 0.0, 0.0)){
         // Enter this path if player is looking at the enemy
      } else {
         // Enter this path if player is not looking at the enemy
      }
   }

   Loop;
User avatar
::Bloodfury::
Posts: 332
Joined: Mon Aug 01, 2011 7:39 pm
Graphics Processor: nVidia (Modern GZDoom)
Location: Finland

Re: Visual triggers?

Post by ::Bloodfury:: »

thanks. I shall fiddle around with this. :)
Post Reply

Return to “Scripting”