this one gives a randomly timed hurt to the player accompanied by a sound (bullet shot, machine gun burst or whatever) while they are in a zone. Add your own sound.
Credits: Adapted from Player Enters Hurt Zone, by Northern
add your gunshot sound to the entity sound slot 0. if you don't add a sound it just acts as a zone where you get a random hurt every now and then.
(adjust the randomness inside in the script.)
function sniperzone_init(e)
end
-- randomly hurts player with sound on hurt
function sniperzone_main(e)
if g_Entity[e]['plrinzone']==1 then
mynumRnd = math.random(1,499) --Random number delay between hurts
--
if mynumRnd==2 or mynumRnd==7 then
PlaySound(e,0)
HurtPlayer(e,1);
end
end
end
hope this is handy for someone.
Use in open areas near buildings,for example.
tip: the hurt-direction marker in your hud indicates where the "bullet" came from which is the zone's marker. so you can mess about with different shaped zones to get the marker where you want.
note: I found out that if you go into waypoint edit, you can add more star points to zones, making more complex zone shapes if you need to, rather than using several zones to cover an irregularly shaped open area.
and to accompany the above, this one just plays a sound at random intervals (ricochet perhaps) when player is in a zone. You could use this for effect when player is under cover near a sniper zone.
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- just plays a sound at random intervals when player in zone
function soundrandom_init(e)
end
function soundrandom_main(e)
if g_Entity[e]['plrinzone']==1 then
mynumRnd = math.random(1,999) --Random number adjustment here
--
if mynumRnd==2 or mynumRnd==7 then
PlaySound(e,0); -- set your sound in zone sound slot 0
end
end
end