• 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.

[JASS] Custom Function Trouble

Status
Not open for further replies.
Level 9
Joined
Nov 4, 2007
Messages
933
I've been learning and trying to create custom functions so that I could call them like you could any action, the function and the parameters created were correct with no errors and placed in the trigger 'myfunc', however when I attempt to use that function from a different trigger via "call Meteor(etc, etc, etc)" the built in sntax checker of wc3 says that it "Expected a function name". My trigger that holds the function is basically this:

function Meteor takes real x, real y, unit u returns nothing
...(actions)
endfunction
//===========================================================================
function InitTrig_myfunc takes nothing returns nothing
endfunction


Is there something I need to do to make the function able to be called in different triggers?
 
Level 11
Joined
Feb 22, 2006
Messages
752
The order of the triggers on the tree doesn't determine in which order the code gets compiled. The only way to ensure that your function is compiled before that Meteor trigger is to put it in the custom script section. You can access that section by clicking on the file name of your map at the top of the trigger tree. Everything you place in there is compiled before any triggers.
 
Status
Not open for further replies.
Top