I don't know if that one is...
mine is the one in this thread
http://fpscrforum.thegamecreators.com/?m=forum_view&t=207644&b=2
6 posts down on first page allmightyhood posts the script
telling all that it was freely given on the forum
but he could not remember who...
the 2nd post after that is your post so I just took it that you had it...
sorry if I misunderstood... ( I knew I should't have stuck my hand up..)
I suppose this just goes to prove your first post request
to have authors put their name at the top of code
-- door_no_lock.lua
-- author : J_C
-- this script has no lock - make sure the door does not have a Use Key entry in editor
-- can open and close door
--
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Door 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
door_pressed = 0
-- player must be inside this distance to have access to door
nearDistance = 100;
-- door states
closed_locked = 0;
closed_unlocked = 1;
open_unlocked = 2;
-- door animations
door_open_anim = 0;
door_close_anim = 1;
-- want to use lock then set to 0
-- don't want to use lock set to 1
door_no_lock_Lock_not_required = 1;
function door_no_lock_main(e)
--{ start function code
-- compute the player distance from our door
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
-- is the player near our door
if PlayerDist < nearDistance then
if g_Entity[e]['activated'] == closed_locked then
-- door is closed and locked
if door_no_lock_Lock_not_required == 1 then
g_Entity[e]['activated'] = closed_unlocked;
else
if g_Entity[e]['haskey'] == 1 then
Prompt("The door is locked. Press E key to unlock door");
if g_KeyPressE == 1 and door_pressed == 0 then
Prompt("Door UNLOCKED");
g_Entity[e]['activated'] = closed_unlocked;
door_pressed = 1;
end
else
Prompt("The door is locked. Find a key to unlock door");
end
end
elseif g_Entity[e]['activated'] == closed_unlocked then
-- door is unlocked and closed
Prompt("Press E to open door");
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then
-- set the animation to door_open
SetAnimation(door_open_anim);
PlayAnimation(e);
g_Entity[e]['animating'] = 1;
g_Entity[e]['activated'] = open_unlocked;
-- play door open sound
PlaySound0(e);
CollisionOff(e);
door_pressed = 1;
end
elseif g_Entity[e]['activated'] == open_unlocked then
-- door is open
Prompt("Press E to CLOSE door");
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then
-- set the animation to door close
SetAnimation(door_close_anim);
PlayAnimation(e);
g_Entity[e]['animating'] = 1;
g_Entity[e]['activated'] = closed_unlocked;
PlaySound1(e);
CollisionOn(e);
door_pressed = 1;
end
end
-- end door state checks
end
-- end player distance test
-- state of the E key
-- if E is not being pressed then reset the door_pressed variable back to zero
if g_KeyPressE == 0 then
door_pressed = 0;
end
end
--} end function code
see I added my name