Quite pleased but can't seem to get the 'rock falling' sound to stop once on ground. All ideas gratefully received!
https://youtu.be/[video=youtube]
[/video]
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Default script - does nothing.
function fallingrock_init(e)
strike = 0
rocksound = 0
sounded = 0
bam = 0
end
function fallingrock_main(e)
if GetPlayerDistance(e) < 1800 and g_Entity[e]['health'] > 0 then
bam = 1
Spawn(e)
SetRotation(e,0,0,0)
else
strike = 0
rocksound = 0
sounded = 0
bam = 0
--rocksound = 0
end
if g_Entity[e]['y'] > (tPlayerDY + 170) and GetPlayerDistance(e) < 1000 and bam == 1 and sounded == 0 then
rocksound = 1
--PlaySoundIfSilent(e,0)
else
--StopSound(e,0)
end
if rocksound == 1 and sounded == 0 and bam == 1 then
PlaySoundIfSilent(e,0)
--SetRotation(e,0,0,0)
sounded = 1
--rocksound = 0
else
--StopSound(e,0)
end
if sounded == 1 then
-- SetRotation(e,0,0,0)
end
--if sounded == 1 then if g_Entity[e]['y'] < 700 then StopSound(e,0) sounded = 0 end end
if GetPlayerDistance(e) < 300 and g_Entity[e]['health'] > 0 and strike == 0 and g_PlayerHealth > 0 then
strike = 1
end
if strike == 1 then
HurtPlayer(e,3)
--SetEntityHealth(e,0)
end
if g_PlayerHealth < 10 then
SetEntityHealth(e,0)
strike = 0
end
end
Julian