I like the jump scare script but I've been trying to use it for different uses that require a longer time and not to change the object in random directions. It's also set to randomize how much time the object appears before disappearing. I managed to tweak it so it stopped turning the object in different directions and it would last for a longer time but I can't seem to remove the random time length without breaking the script. It has this line which controls if the item appears for 25% longer or shorter. I changed both these values to 1.00 but that didn't seem to work. Removing the line completely causes errors
fade_delay[e] = GetTimer(e) + math.random(fade_delay_init * 0.75,fade_delay_init * 1.25)
so what am I missing to make this work properly. I'm just trying to get the item to appear for three seconds/3000 ms and then disappear. Here's my tweaked version of the script
--DESCRIPTION:Jump-Scare by Smallg
--script by smallg
local appearances = {}
local fade_delay = {}
local hidden = {}
local fade_delay_init = 0
--set these to 0 if you dont want any movement from original location
--how far away from starting location entity can move in x axis
local movex_random = 0
--how far away from starting location entity can move in z axis
local movez_random = 0
function jumpscaretv_init(e)
--how many times entity will appear
appearances[e] = math.random(1,1)
--how long between appearances (and how long it will appear for)
--is randomed so can be 25% shorter or longer (see near end of script)
fade_delay[e] = 3000
---------------
hidden[e] = 1
CollisionOff(e)
fade_delay_init = fade_delay[e]
Hide(e)
end
function jumpscaretv_main(e)
CollisionOff(e)
if g_Entity[e]['activated'] == 1 then
if GetTimer(e) > fade_delay[e] then
if appearances[e] > 0 then
if hidden[e] == 1 then
PlaySound(e,1)
Show(e)
hidden[e] = 0
appearances[e] = appearances[e] - 1
else
Hide(e)
hidden[e] = 1
end
else
if hidden[e] == 0 then
Hide(e)
end
end
fade_delay[e] = GetTimer(e) + math.random(fade_delay_init * 0.99,fade_delay_init * 1.01)
end
end
end --main
function jumpscaretv_exit(e)
end
The author of this post has marked a post as an answer.
Go to answer