Silly problem, just missing something stupid Im sure..
I need to turn a light on when an NPC enters an area and off again when they leave. (It could affect the player too if possible)
I made a trigger area, and put object visibility - visible action on it... targeted the light
disabled the light.. didnt work..
thought, maybe It has to to have been disabled BY AC .. so I turn light on and as first action in OnStart cutscene I use object visibility - invisible
still doesn't work...
What am I doing wrong?
...and when I get it working I presume Ill need 2 actions one for walking INTO the trig and one for walking out (to turn the light out)
M
Comments
add script Lightswitch to your component and by Trigger enter/exit call object sendMessage turnOff/turnOn.
yes i would use 2 Trigger for in/out and store the sate in a var.
Object: Send message Action to call its TurnOn andTurnOff functions to enable and disable it respectively. Similarly, the LightSwitch script can be used to enable and disable Light sources.
Everytime I think that theres something forgoton in Adventure Creator, I discover.. ITS BUILT IN!!!
The above worked great... for switching the light on... but to turn the light off... I need BOTH on enter AND on ext.
As a hack I surrounded my trigger with other triggers that turn the light off, but its not ideal...
Well, i would do probably the same.
var_IsLightOn = false (default)
Position on enter room:
tr_SetLightOn (onEnter) - if NOT var_IsLightOn then SendMessage.TurnOn and var_IsLightOn = true
Position on Exit room:
tr_SetLightOff (onEnter) - If var_IsLightOn then SendMessage.TurnOff and var_IsLightOn = false
What I need is to detect, IS THERE SOMTHING IN THE TRIGGER AREA AT ALL, OF ANY TYPE, if so.. keep the light on, untill there is nothing there.
So basically I need the ONE single trigger area to do both the detecting of enter AND exiting.
Which it doesnt, although, Im intrigued what the "continuous" option means really.
Rather than having a Continous Trigger, try having two in the same place - one On Exit, the other On Enter. Use an integer variable to keep count of the number of characters within it (use the Variable: Set Action to increase/decrease the variable as appropriate). You can then just check
if the number >0 at the end of each Trigger's ActionList to
determine whether or not the light should be on.