This is a very tricky illusion to perform. I did it once before way back in the day. Here's the basic setup of how such a script could work. Be forewarned, this requires ALL of your lights to be dynamic lights.
Attach a script to your lights that does the following:
- Check to see if player is within light's range
- If player is within light's range, increment a variable
In your enemy scripts, do the following:
- Check the variable to see if it is greater than 0
- If the variable is greater than 0, then the player can be be seen because they are in a light
In a triggerzone script (simply because the script should always execute) do the following:
- Using an etimer, reset the variable to 0 after a short delay (probably 1/4 of a second)
It is best to use the timer in the triggerzone script because of the randomness of operations when the engine is executing scripts. You don't want a light to be skipped over, so we have the reset script give a short delay before resetting the variable.
[EDIT]
Also, take note that this setup will suffer from having lights "see" the player through walls... so be aware of that when setting this up.
The one and only,
Only those who sow the seeds of their desires will reap their benefits later.
However, I have seeds of my own to tend to. I don't have time to be someone else's watering can.