• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Custom Script error

Status
Not open for further replies.
Level 10
Joined
Dec 17, 2011
Messages
355
Hi!

Whats wrong with this? Wc3 cannot run with this script.
Plz help!

Oh and the variable name is fine.

  • Item Sold
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • Set Sold_Item = (Sold Item)
      • Set BuyerPlayer = (Owner of Sold_Item)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of Sold_Item) Equal to |c00FFD84FAnub'Rekhan's Legacy|r
              • (Item-type of Sold_Item) Equal to |c00FFFF00Horn of Winter|r
              • (Item-type of Sold_Item) Equal to |c00FFD84FClaw of the Sandreaver|r
              • (Item-type of Sold_Item) Equal to |c00FFD84FGoblin Rocket Louncher|r
        • Then - Actions
          • Custom script: if GetLocalPlayer() == udg_BuyerPlayer then
          • Custom script: call PlaySound(udg_PutDownSmallMEtal , true)
          • Custom script: call endif
        • Else - Actions
          • -------- Some other things here --------
 
Level 20
Joined
Jul 14, 2011
Messages
877
PlaySound takes just one argument.
JASS:
function PlaySound takes string soundName returns nothing
    local sound soundHandle = CreateSound(soundName, false, false, true, 12700, 12700, "")
    call StartSound(soundHandle)
    call KillSoundWhenDone(soundHandle)
endfunction

udg_PutDownSmallMEtal should be a string, in your case.

PlaySoundBJ takes a variable. If PutDownSmallMEtal is a variable (from the sound editor) you should use gg_snd_<Sound Name Here>.
StartSound is the same as the above, but it doesnt check if the variable is nulled.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
You are using...
JASS:
function PlaySound takes string soundName returns nothing
    local sound soundHandle = CreateSound(soundName, false, false, true, 12700, 12700, "")
    call StartSound(soundHandle)
    call KillSoundWhenDone(soundHandle)
endfunction

So...

JASS:
if GetLocalPlayer() == udg_BuyerPlayer then // Perfect
call PlaySound(udg_PutDownSmallMEtal , true) // No such function definition, the function with that name expects exactly 1 argument of type string.
call endif // endif is a key word so cannot be a function definition, functions also need arguments even if they are no arguments "()", you probably meant just "endif".
 
Status
Not open for further replies.
Top