Scripts / flashlight on or off

Author
Message
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 14th Apr 2016 08:55
Can you currently read if the flashlight is on or off in lua, i know you can set the key enable on or off, but i need to know if you can check wheter the flashlight is on or off, any ideas ?
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, AMD HD7870 gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit.
TazMan
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 20th Jan 2011
Location: Worldwide Web
Posted: 14th Apr 2016 11:54 Edited at: 14th Apr 2016 12:07
The Global g_PlayerFlashlight Returns true if the player flashlight is active, I have not tested this yet but it should work.


EDIT:

Sorry I have just tested it and It does not work at the moment, maybe it has been put there for future use.
HP Pavilion Laptop, AMD A8-4555M APU with Radeon(tm) Graphics HD Graphics 1.6GHz, 8GB Memory, 64 Bit Operating System (Windows 10), 1 TB Hard Drive.

I've got something to say - It's better to burn out than fade away.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 14th Apr 2016 13:26
Anyway you can declare a global let's say "flashlightIsOn", iniciate as false, so each time the flashlight is on, so flashlightIsOn>0.
In another words, each time you press "F" key, then flashlightIsOn>0.

pseudocode...


hth
3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 14th Apr 2016 18:18
It works ok for me Taz, tried this real simple script to check:



When the flashlight is off g_PlayerFlashlight = 0, when on it's g_PlayerFlashlight = 1 and when holding the 'F' key down it's all over the place, but settles on 1 or 0 when key is released

TazMan
GameGuru TGC Backer
13
Years of Service
User Offline
Joined: 20th Jan 2011
Location: Worldwide Web
Posted: 15th Apr 2016 10:47
@cybernescence

There is no wonder it did not work for me I also wrote a simple script:



Mine looked for a true / false value because the description said that was what it gave. I should have known that this was incorrect. Yep I just changed the true / false to 1 / 0 and it works perfectly.

Thanks for that
HP Pavilion Laptop, AMD A8-4555M APU with Radeon(tm) Graphics HD Graphics 1.6GHz, 8GB Memory, 64 Bit Operating System (Windows 10), 1 TB Hard Drive.

I've got something to say - It's better to burn out than fade away.

Login to post a reply

Server time is: 2024-12-22 15:52:12
Your offset time is: 2024-12-22 15:52:12