Scripts / Flashlight Question

Author
Message
Timba
9
Years of Service
User Offline
Joined: 22nd Apr 2015
Location: Florida
Posted: 21st May 2015 15:57
3 questions-

1- Is there a way to make the flashlight blink, or lower it's intensity as it runs out of battery and turns off?
2- is there a way to make the flashlight turned on with an item lets say a battery.
3- Can a trigger point not disappear after you step on it so that if you trigger it every time you pass by it?

I have seen this done over and over in the unity engine so i figured that maybe it can also be done here?
ASUS MAXIMUS VII HERO | Intel Core i7 4790k | 16 GB RAM | EVGA GTX 980 SC | 120GB SSD(OS) | 512GB SSD(Programs) | 1TB WD Black(Backups) | EVGA SuperNova 1000W G1
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 21st May 2015 16:19
1 - no
2 - no

1 and 2 are hard coded, I hope they implement this soon

3 - yes this is possible

put the script below in a trigger zone. Change the text or command you need in the right place.

save this script as trigger1.lua, if you edit it save as a different filename that is the same as the init and main lines at the top of the script
_____________

function trigger1_init(e)
-- set distance to object before it triggers
dist_to_obj_toff = 80
end

function trigger1_main(e)
PlayerDist = GetPlayerDistance(e)

if PlayerDist <= dist_to_obj_toff then
GetEntityPlayerVisibility(e)

-- did user just enter the area?
if g_Entity[e]['activated'] == 0 then
PlaySound(e,0)
SetActivated(e,1)
ActivateIfUsed(e)
-- The below line can be changed
PromptDuration("I have walked into a trigger zone.",2000)
-- The above line(s) can be changed
end
end

-- is object activated and user moves away?
if PlayerDist > dist_to_obj_toff then
if g_Entity[e]['activated'] == 1 then
SetActivated(e,0)
end
end

end -- function

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.
Timba
9
Years of Service
User Offline
Joined: 22nd Apr 2015
Location: Florida
Posted: 21st May 2015 16:32
for 1 and 2
for 3 - i'll try it out when i get home
ASUS MAXIMUS VII HERO | Intel Core i7 4790k | 16 GB RAM | EVGA GTX 980 SC | 120GB SSD(OS) | 512GB SSD(Programs) | 1TB WD Black(Backups) | EVGA SuperNova 1000W G1
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 21st May 2015 17:05
it should work, I use it in trigger zone to display descriptive text for atmosphere building, or information, "This door is jammed." etc
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.
Teabone
Forum Support
17
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 21st May 2015 19:00
The flashlight functionality is still hardcoded? wow... disappointing. Wonder how long a wait till we can start customizing it.
i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce 420 GT
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 21st May 2015 19:37
yes, I hope they do like a collectable battery that charges the flashlight, and slowly discharges until you find another battery, also add some sort of lens effect on the light beam so it looks like a real flashlight.
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.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 22nd May 2015 19:33
Quote: "also add some sort of lens effect on the light beam so it looks like a real flashlight"

cant do much about the lens but a simple picture can add a lot...

*only works with no weapon held on purpose, looks kinda odd if you have three hands *


just add your image to scriptbank\images\flashlight (remember to name it 000.png)
also includes a sound effect at slot 0 for clicking on and off
flashlight.lua
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 22nd May 2015 22:12
Thank you smallg
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

Login to post a reply

Server time is: 2024-05-07 23:09:39
Your offset time is: 2024-05-07 23:09:39