Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Create dummy objects for playing sounds
- _i = -1
- _sound_players = []
- while "_i=_i+1; _i < 3" do "_logic=""logic"" createVehicle [0,0,0]; _sound_players set [count _sound_players, _logic]"
- ; Settings
- _damage_threshold = [0.24, 0.49, 0.74]
- _intervals = [8.87, 6.295, 4.23]
- _sound_names = ["heartslow", "heartmiddle", "heartfast"]
- _max = count _damage_threshold - 1
- _current_sound = -1
- _time_to_play = 0
- #Loop
- ~0.1
- ; Find which sound to play based on player's damage
- _current = 0
- _selected = -1
- _dmg = damage player
- #FindDamage
- ? damage player > (_damage_threshold select _current) : _selected=_current
- ? _current < _max : _current=_current+1; goto "FindDamage"
- ; Play the sound
- ? _selected != _current_sound : if (_current_sound>=0) then {(_sound_players select _current_sound) setPos [0,0,0]}; _current_sound=_selected; _time_to_play=0
- ? _current_sound >= 0 && _time >= _time_to_play : (_sound_players select _current_sound) setPos getPos player; (_sound_players select _current_sound) say (_sound_names select _current_sound); _time_to_play=_time+(_intervals select _current_sound)
- goto "Loop"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement