ok so this is the script for the door so far. but its locked as default
-- 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
function door_main(e)
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));
if PlayerDist < 100 then
if g_Entity[e]['activated'] == 0 then
if g_Entity[e]['haskey'] == 1 then
Prompt("The door is locked. Press E key to unlock door");
if g_KeyPressE == 1 then
g_Entity[e]['activated'] = 1;
end
else
Prompt("The door is locked. Find a key to unlock door");
end
else
if g_Entity[e]['activated'] == 1 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
SetAnimation(0);
PlayAnimation(e);
g_Entity[e]['animating'] = 1;
g_Entity[e]['activated'] = 2;
PlaySound0(e);
CollisionOff(e);
door_pressed = 1;
end
else
if g_Entity[e]['activated'] == 2 then
-- door is open
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then
SetAnimation(1);
PlayAnimation(e);
g_Entity[e]['animating'] = 1;
g_Entity[e]['activated'] = 1;
PlaySound1(e);
CollisionOn(e);
door_pressed = 1;
end
end
end
end
so my question is how to make it so the gate is unlocked by default?
and not needing a key?
as its not always the case with a door being locked, just closed.
this would be a great help later on im sure
have fun stay safe
hood