Hi
I have been struggling for a couple of days now but cannot seem to get this to work
I have a modified door script 'E' to open as usual but then I have set a timer to 10 seconds so the door closes automatically but no sounds play, even with using a standard door script there is no sound, soundzones work as can be heard in the video but no door sounds.
in the door fpe I have 'soundset = audiobank\scifi\Blast_Door_Open.wav (using stock sound to rule out my sound file)
my lua:
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- maindoor Prompts 'Closed' can be opened with entity collected specified by 'USE KEY'
-- state to ensure user must release E key before can open/close again
maindoor_pressed = 0
function maindoor_init(e)
end
function maindoor_main(e)
PlayerDist = GetPlayerDistance(e)
if (PlayerDist < 300 ) and g_PlayerHealth > 0 then
GetEntityPlayerVisibility(e)
if 1 then
if g_Entity[e]['activated'] == 0 then
if g_Entity[e]['haskey'] == -1 then
SetActivated(e,1)
else
if g_Entity[e]['plrvisible'] == 1 then
if g_Entity[e]['haskey'] == 1 then
if GetGamePlayerStateXBOX() == 1 then
Prompt("Main Door is locked down. Press Y button to unlock Main Door")
else
Prompt("Main Door is locked down. Press E key to access Main Door")
end
if g_KeyPressE == 1 then
SetActivated(e,1)
end
else
Prompt("Main Door is locked down. Find a terminal to override")
end
end
end
else
if g_Entity[e]['activated'] == 1 then
-- maindoor is unlocked and closed
if g_Entity[e]['plrvisible'] == 1 then
if GetGamePlayerStateXBOX() == 1 then
Prompt("Press Y button to open maindoor")
else
Prompt("Press E to access Main Door")
end
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and maindoor_pressed == 0 then
SetAnimation(0)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
SetActivated(e,2)
ActivateIfUsed(e)
PlaySound(e,0)
StartTimer(e)
g_Entity[e]['timer'] = g_Time
maindoor_pressed = 1
end
end
else
if g_Entity[e]['activated'] == 2 then
-- maindoor is open
if g_Entity[e]['plrvisible'] == 1 then
if GetTimer(e)>10000 then
SetAnimation(1)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
SetActivated(e,1)
PlaySound(e,1)
CollisionOn(e)
maindoor_pressed = 1
end
end
end
end
end
end
end
if g_Entity[e]['activated'] == 2 then
-- maindoor collision off after 1 second
if GetTimer(e)>1000 then
CollisionOff(e)
end
end
if g_KeyPressE == 0 then
maindoor_pressed = 0
end
end
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Laptop - Helios 300 Predator - i7 7700HQ - 32GB - Nvidia GTX1060 6GB - 525GB M2 - 500 SSD - 17.3" IPS LED Panel - Windows 10 Pro x64
Various Tutorials by me
The author of this post has marked a post as an answer.
Go to answer