This is a basic script to get what you want.
Another thing is to get a 3d sound or lower / increase the volume when the player approaches the generator or moves away from it, etc; But this is another different matter.
attach script below to every part. (Remember they should be dynamics
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player Collects Items
function collect_genparts_init(e)
collecting = 5 --qty of parts -- type engine parts quantity here
end
function collect_genparts_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 80 then
collecting = collecting - 1
PromptDuration(collecting.. " objects still need to be collected",3000)
PlaySound(e,0)
Collected(e)
Destroy(e)
if collecting == 0 then starting_generator = 1 end
end
end
And this other to the generator
starting_generator = 0
function start_generator_init(e)
end
function start_generator_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 180 then
if starting_generator == 1 then
PlaySound(e,0)
PromptDuration("Engine started",3000)
end
end
end
Note: this code is a easiest version, so you can understand how it works (the concept), also you can try to modify it to fit new goals, etc.
hth
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