For a change, something that's actually useful for a header you have:
E.g.:
plays the first version of the minigun primary attacking sound. The minigun has only primary fire, and two variations, so putting 2 in the third argument, or 3 in the last will result in no sound being played. There's probably no way to find out whether or not a certain sound file exists to avoid such errors, right @phobos2077?
edit: crap, missed the fact that impact sounds are contextual, updated.
edit2: well, seems I overlooked sfx_build_weapon_name, which probably does the exact same fucking thing. Well, that was some wasted effort right there...
edit3: hmm, going through that command it does strike me as my approach being a bit more versatile, but I'm not sure (e.g. there doesn't seem to be a way to use alt fire/impact sound, and you're restricted to an equiped weapon for some reason)
Code:
#define PRODATA_IT_WP_SOUND (100)
#define WEAP_SND_ATTACK "WA"
#define WEAP_SND_EMPTY "WO"
#define WEAP_SND_RELOAD "WR"
#define WEAP_SND_IMPACT_FLESH "F"
#define WEAP_SND_IMPACT_METAL "M"
#define WEAP_SND_IMPACT_MISS "S"
#define WEAP_SND_IMPACT_DUD "W"
#define WEAP_SND_IMPACT_GENERIC "X"
#define play_weapon_sound(pid, effect, type, alt) play_sfx(effect + sprintf("%c", get_proto_data(pid, PRODATA_IT_WP_SOUND)) + type + "XXX" + alt)
#define play_weapon_sound_impact(pid, type, target, alt) play_sfx("WH" + sprintf("%c", get_proto_data(pid, PRODATA_IT_WP_SOUND)) + type + target + "XX" + alt)
E.g.:
Code:
play_weapon_sound(PID_MINIGUN, WEAP_SND_ATTACK, 1, 1);
plays the first version of the minigun primary attacking sound. The minigun has only primary fire, and two variations, so putting 2 in the third argument, or 3 in the last will result in no sound being played. There's probably no way to find out whether or not a certain sound file exists to avoid such errors, right @phobos2077?
edit: crap, missed the fact that impact sounds are contextual, updated.
edit2: well, seems I overlooked sfx_build_weapon_name, which probably does the exact same fucking thing. Well, that was some wasted effort right there...
edit3: hmm, going through that command it does strike me as my approach being a bit more versatile, but I'm not sure (e.g. there doesn't seem to be a way to use alt fire/impact sound, and you're restricted to an equiped weapon for some reason)
Last edited: