@ Zero_HP
Quote: "Is it possible to have a door script on another entity like a bookcase? "
If you want the bookcase sliding like a door, you'll neeed animated bookcase, GG has MoveUp, MoveForward and MoveBackward, but does not MoveRight/MoveLeft lua command afaik.
So you has to take a workaround to get it.
Notice in the vid I'm using a cabinet as reference, you has to place something like that on your map, so let¡s say bookcase is the point A and the cabinet is the point B.
Attach this script to the bookcase.
tDistX = 0
tDistZ = 0
isOpen = 0
function slide_door_init(e)
end
function slide_door_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 then
if isOpen == 0 then Prompt("Press E to open door") end
if g_KeyPressE == 1 then
tDistX = GetEntityPositionX ( 9 )
tDistY = GetEntityPositionY ( e )
tDistZ = GetEntityPositionZ ( e )
CollisionOff(e)
new_y = math.rad(g_Entity[e]['angley'])
dest_x = tDistX + (math.sin(new_y)) + 110
dest_z = tDistZ + (math.cos(new_y))
SetPosition(e,dest_x,tDistY,dest_z)
isOpen = 1
end
end --PlayerDist
end --main
hth
3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz
OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4