Got the sci-fi light and console to work by editing the default door script as such...
Backup your originals first since these are named to overwrite the ones that came with the models.
Saved as
scificonsole.lua:
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- scificonsole 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
scificonsole_pressed = 0
function scificonsole_init(e)
end
function scificonsole_main(e)
PlayerDist = GetPlayerDistance(e)
if (PlayerDist < 100 ) 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
Prompt("The console is deactivated. Press E to activate the console")
if g_KeyPressE == 1 then
SetActivated(e,1)
end
else
Prompt("The console is deactivated. Find a key to activate the console")
end
end
end
else
if g_Entity[e]['activated'] == 1 then
-- scificonsole is unlocked and closed
if g_Entity[e]['plrvisible'] == 1 then
Prompt("Press E to activate the console")
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and scificonsole_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
scificonsole_pressed = 1
end
end
else
if g_Entity[e]['activated'] == 2 then
-- scificonsole is open
if g_Entity[e]['plrvisible'] == 1 then
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and scificonsole_pressed == 0 then
SetAnimation(1)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
SetActivated(e,1)
PlaySound(e,1)
CollisionOn(e)
scificonsole_pressed = 1
end
end
end
end
end
end
end
if g_Entity[e]['activated'] == 2 then
-- scificonsole collision off after 1 second
if GetTimer(e)>1000 then
CollisionOff(e)
end
end
if g_KeyPressE == 0 then
scificonsole_pressed = 0
end
--PromptLocal ( e, "activated=" .. g_Entity[e]['activated'] .. "PlayerDist=" .. PlayerDist .. " plrvisible=" .. g_Entity[e]['plrvisible'] .. " haskey=" .. g_Entity[e]['haskey'] )
end
Saved as
scifilight.lua:
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- scifilight 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
scifilight_pressed = 0
function scifilight_init(e)
end
function scifilight_main(e)
PlayerDist = GetPlayerDistance(e)
if (PlayerDist < 100 ) 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
Prompt("The light is deactivated. Press E to activate the light")
if g_KeyPressE == 1 then
SetActivated(e,1)
end
else
Prompt("The light is deactivated. Find a key to activate the light")
end
end
end
else
if g_Entity[e]['activated'] == 1 then
-- scifilight is unlocked and closed
if g_Entity[e]['plrvisible'] == 1 then
Prompt("Press E to activate the light")
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and scifilight_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
scifilight_pressed = 1
end
end
else
if g_Entity[e]['activated'] == 2 then
-- scifilight is open
if g_Entity[e]['plrvisible'] == 1 then
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and scifilight_pressed == 0 then
SetAnimation(1)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
SetActivated(e,1)
PlaySound(e,1)
CollisionOn(e)
scifilight_pressed = 1
end
end
end
end
end
end
end
if g_Entity[e]['activated'] == 2 then
-- scifilight collision off after 1 second
if GetTimer(e)>1000 then
CollisionOff(e)
end
end
if g_KeyPressE == 0 then
scifilight_pressed = 0
end
--PromptLocal ( e, "activated=" .. g_Entity[e]['activated'] .. "PlayerDist=" .. PlayerDist .. " plrvisible=" .. g_Entity[e]['plrvisible'] .. " haskey=" .. g_Entity[e]['haskey'] )
end
I'd imagine the same thing would work for the crates too, but I haven't had a chance to test. Thought I'd share for anyone who might be having similar troubles with the light/console