Setting up the sounds (optional, you can use whatever sounds you want)
1. Download and extract the sound files from this link. (It is OSP as far as I'm aware of, check page 2)
2. Add the following line to module_sounds.py somewhere.
Setting up item triggers
1. Add the following line to your gun in module_items.py
The yellow text are the distance, feel free to adjust it yourself.
On a side note, you can change play_sound to agent_play_sound (or play_sound_at_position, but haven't tested that yet) so it plays at the player/camera's location, in case you want the sound to be clear (because most of the time I can't hear ****).
1. Download and extract the sound files from this link. (It is OSP as far as I'm aware of, check page 2)
2. Add the following line to module_sounds.py somewhere.
("gunshot_close",sf_priority_10|sf_vol_2, ["close1.ogg","close2.ogg","close3.ogg","close4.ogg","close5.ogg","close6.ogg"]), #newgunsounds
("gunshot_medium",sf_priority_9|sf_vol_2, ["med1.ogg","med2.ogg","med3.ogg","med4.ogg","med5.ogg","med6.ogg"]), #newgunsounds
("gunshot_far",sf_priority_8|sf_vol_3, ["far1.ogg","far2.ogg","far3.ogg","far4.ogg","far5.ogg","far6.ogg","far7.ogg","far8.ogg","far9.ogg","far10.ogg","far11.ogg"]), #newgunsounds
Setting up item triggers
1. Add the following line to your gun in module_items.py
so it looks something like this[(ti_on_weapon_attack,
[
(mission_cam_get_position, pos2),
(get_distance_between_positions_in_meters, ":dist", pos1, pos2),
(try_begin),
(ge, ":dist", 71),
(play_sound, "snd_gunshot_far"),
(else_try),
(is_between, ":dist", 40, 70),
(play_sound, "snd_gunshot_medium"),
(else_try),
(play_sound,"snd_gunshot_close"),
(try_end),
])]],
The red colored text is not relevant for the sounds, as its used for smoke effect.["flintlock_pistol", "Flintlock Pistol", [("flintlock_pistol",0)], itp_type_pistol |itp_merchandise|itp_primary ,itcf_shoot_pistol|itcf_reload_pistol, 230 , weight(1.5)|difficulty(0)|spd_rtng(39) | shoot_speed(200) | thrust_damage(45 ,pierce)|max_ammo(1)|accuracy(95),imodbits_none,
[(ti_on_weapon_attack,
[
(position_move_x, pos1, 27),(position_move_y, pos1, 36), #gun barrel end position
(mission_cam_get_position, pos2),
(get_distance_between_positions_in_meters, ":dist", pos1, pos2),
(try_begin),
(ge, ":dist", 71),
(play_sound, "snd_gunshot_far"),
(else_try),
(is_between, ":dist", 40, 70),
(play_sound, "snd_gunshot_medium"),
(else_try),
(play_sound,"snd_gunshot_close"),
(try_end),
(particle_system_burst, "psys_pistol_smoke", pos1, 15)
])]],
The yellow text are the distance, feel free to adjust it yourself.
On a side note, you can change play_sound to agent_play_sound (or play_sound_at_position, but haven't tested that yet) so it plays at the player/camera's location, in case you want the sound to be clear (because most of the time I can't hear ****).
Last edited: