-- LUA Script - precede every function and global member with lowercase name of script + '_main' -- ms2 Prompts 'Closed' can be opened with entity collected specified by 'USE KEY' -- By Dvader function ms2edit_init(e) ms_shutdown={} SetAnimationFrame(e,4) -- fix first frame to match new animation range (fixes glitches) end function ms2edit_main(e) if ms_shutdown[e]==nill then ms_shutdown[e]=0 end PlayerDist = GetPlayerDistance(e) GetEntityPlayerVisibility(e) if (PlayerDist <200 ) and g_PlayerHealth > 0 and g_Entity[e]['plrvisible'] == 1 then if g_Entity[e]['haskey'] == 1 or g_Entity[e]['haskey'] == -1 then Prompt("Press E to deploy Mech Station") else Prompt("This Mech Station is locked") end if g_Entity[e]['haskey'] == 1 or g_Entity[e]['haskey'] == -1 then if g_KeyPressE == 1 and ms_shutdown[e]==0 then SetAnimationFrames(4,51) PlaySound(e,0) PlayAnimation(e) ms_shutdown[e]=1 end if g_KeyPressE == 1 and ms_shutdown[e]==2 then SetAnimationFrames(52,96) PlaySound(e,0) PlayAnimation(e) ms_shutdown[e]=3 end if ms_shutdown[e] == 1 and GetAnimationFrame(e)==51 and g_KeyPressE == 0 then ms_shutdown[e]=2 end if ms_shutdown[e] == 3 and GetAnimationFrame(e)==96 and g_KeyPressE == 0 then ms_shutdown[e]=0 end end end --PromptLocal(e,ms_shutdown[1].." "..GetAnimationFrame(e).." "..g_Entity[e]['haskey']) end