How to calculate percent of progress?

I want to make an automation rule or script of scriptrunner. Ultimately, I want to calculate the progress percent and display from the Gantt chart.

condition 1 : linked issue type id = 10511, 10612, 10603

condition 2 : linked id = 10309, 10703

condition 3 : linked issue status = completion

calculation and update custom field : (number of condition1 & condition2 & condition3) / (total number of condition1) x 100

How can I do that?

I think this is the similar solution : https://community.atlassian.com/t5/Jira-questions/Calculate-sum-of-Story-Points-in-all-linked-issues-except-the/qaq-p/2205697