Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: How to attach sound to spawned animal classname

  1. #11
    Master Sergeant CaptainBravo's Avatar
    Join Date
    Nov 24 2005
    Location
    USA-UK
    Posts
    730
    Author of the Thread
    Thanks Rav Raven.

    It works well except when the dogs die, the sound is still there. It is almost like having ghosts of dogs running around

    Anyway of disabling/stopping sound once the dogs are dead?
    Captain Bravo
    One of the serious problems in planning the fight against American doctrine, is that the Americans do not read their manuals, nor do they feel any obligation to follow their doctrine"
    From a Russian General's Notebook

    Join Bravo Company
    A highly trained unit run by an ex cook, a hooker and an old pensioner, so expect the best!
    http://forums.bistudio.com/showthread.php?t=80906

  2. #12
    Just add these 2 lines (color red) of code after creating the sound and link it to the dog.
    Code:
    _soundOn = createSoundSource ["Sound_Dog", position _perro, [], 0];
    
    _soundOn attachto [_perro, [0,1,0.5]];
    
    _perro setvariable ["soundDog", _soundOn];
    
    _EHkilledIdx = _perro addEventHandler ["killed", {deletevehicle ((_this select 0) getvariable "soundDog")}];
    The variable that refers to the sound of the dog is stored (SetVariable) in the memory space corresponding to the unit (dog) and when the dog dies activates the eventhandler that read this variable (GetVariable) and uses it to eliminate the sound (deletevehicle).
    Greetings.

  3. #13
    Master Sergeant CaptainBravo's Avatar
    Join Date
    Nov 24 2005
    Location
    USA-UK
    Posts
    730
    Author of the Thread
    It works great, thanks Rav Raven

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •