• 🏆 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!

[JASS] Custom Function Trouble

Status
Not open for further replies.
Level 9
Joined
Nov 4, 2007
Messages
931
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