Hmm, try this as a mod for your script Mando
:state=0:DimVar=x_position,DimVar=y_position,DimVar=z_position,state=1
:always:setvar=x_position $PlrPosX,setvar=y_position $PlrPosy,setvar=z_position $PlrPosZ
:always:mlightx=%x_position
:always:mlighty=%y_position
:always:mlightz=%z_position
Personally I like to just direct it right at the player pos rather than a middle man variable, but either way works.
Marc, the timer in your script is to make sure holding f wont toggle faster than the user can react or even see? Try this:
;Artificial Intelligence Script
;Header
desc = Flashlight Script
;Script which activates Flashlight when "F" is pressed
;Adjust the range and light colour in the code in state 0.
;Script by Marc Steene from the Modern Warfare Script Pack
;Triggers
:state=0:dimvar=flashlight,setvar=flashlight 0,mlightrange=200,mlighttype=1,mlightid=250,mlightred=228,mlightgreen=220,mlightblue=218,state=1
:state=1,keypressed=33 1,:sound=audiobank\music\flashlight on.wav,mlighton,mlightfollowplr,state=2
:state=2,keypressed=33 0:state=3
:state=3,keypressed=33 1:sound=audiobank\music\flashlight off.wav,mlightoff,state=4
state=4,keypressed=33 0:state=1
;End of Script
Sorry if I butchered any code, havent looked at fpi in about 3 months :S
Also, if you want the flashlight to turn off when you die, add in a line that says:
:plrhealthless=1:mlightoff
I'm the exception to every rule, that rule withstanding