• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Sound

Status
Not open for further replies.
Level 11
Joined
Mar 27, 2011
Messages
293
I want to create a trigger that, when it is not available for use, appearing on a sound and error message. But my concern now is not with the message, but with the sound.
I'll explain: suppose that can not trigger the spell from a distance, then an error sound appearing on, but when it should appear again, he does not appear.
See my triggers:


  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Spell_Ability
    • Actions
      • -------- --------
      • Set Spell_Caster = (Triggering unit)
      • Custom script: set udg_Spell_Handle = udg_Spell_Caster
      • Set Spell_Charge_X = (Load 1 of (Key Spell_Handle) from Spell_Hash)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Spell_Charge_X Not equal to Spell_Charge_Max
        • Then - Actions
          • -------- --------
          • Hashtable - Save 0.00 as 0 of (Key Spell_Handle) in Spell_Hash
          • Hashtable - Save (Spell_Charge_X + 1) as 1 of (Key Spell_Handle) in Spell_Hash
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Spell_Caster is in Spell_Group) Equal to True
            • Then - Actions
            • Else - Actions
              • Set Spell_Group_Count = (Spell_Group_Count + 1)
              • Unit Group - Add Spell_Caster to Spell_Group
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Spell Loop <gen> is on) Equal to True
                • Then - Actions
                • Else - Actions
                  • Trigger - Turn on Spell Loop <gen>
          • -------- --------
        • Else - Actions
          • -------- --------
          • Set Spell_Level = (Level of Spell_Ability for Spell_Caster)
          • -------- --------
          • Unit - Remove Spell_Ability from Spell_Caster
          • Unit - Add Spell_Ability to Spell_Caster
          • Unit - Set level of Spell_Ability for Spell_Caster to Spell_Level
          • -------- --------
          • Custom script: if udg_Spell_Sound == null then
          • Custom script: set udg_Spell_Sound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
          • Custom script: call StartSound(udg_Spell_Sound)
          • Custom script: endif
          • -------- --------
      • -------- --------


Thank you for attention, and if you can, leave your contribution!

:fp: :thumbs_up:
 
Level 12
Joined
Oct 16, 2010
Messages
680
  • Custom script: if udg_Spell_Sound == null then

this will only pass once since you doesn't killed and nulled the sound so it won't be null anymore

use
  • Custom script: call KillSoundWhenDone(udg_Spell_Sound)
  • Custom script: set udg_Spell_Sound = null
or move the StartSound under the ITE block but still use the killsound function
 
Level 11
Joined
Mar 27, 2011
Messages
293

this will only pass once since you doesn't killed and nulled the sound so it won't be null anymore

use
  • Custom script: call KillSoundWhenDone(udg_Spell_Sound)
  • Custom script: set udg_Spell_Sound = null
or move the StartSound under the ITE block but still use the killsound function


Thank you. Helped and solved my problem. I used the custom scripts.
 
Status
Not open for further replies.
Top