[Trigger] Function in Custom script

3an

3an

Level 1
Joined
Jan 25, 2018
Messages
3
Hello , i would like to ask if its possible to have "Jass" functions defined in custom scripts? i got triggers like this :

  • int changes init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: endfunction
      • Custom script: function addblood takes integer pid, integer kolik returns nothing
      • Custom script: set udg_player_blood[pid] = udg_player_blood[pid] + kolik
      • Custom script: endfunction
      • Custom script: function lowerblood takes integer pid, integer kolik returns nothing
      • Custom script: set udg_player_blood[pid] = udg_player_blood[pid] - kolik
      • Custom script: endfunction
      • Custom script: function addhunger takes integer pid, integer kolik returns nothing
      • Custom script: set udg_hunger[pid] = udg_hunger[pid] + kolik
      • Custom script: endfunction
      • Custom script: function lowerhunger takes integer pid, integer kolik returns nothing
      • Custom script: set udg_hunger[pid] = udg_hunger[pid] - kolik

But whenever i call one of those functions outside the trigger like this :

  • Blood add
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to |cff80ff80 Meat
        • Then - Actions
          • Custom script: call BJDebugMsg("meat")
          • Custom script: call addblood(1,2)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to |cff80ff80 Chips
            • Then - Actions
              • Custom script: call BJDebugMsg("chips")
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item being manipulated)) Equal to |cff80ff80 Apple
                • Then - Actions
                  • Custom script: call BJDebugMsg("apple")
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-type of (Item being manipulated)) Equal to BloodBag
                    • Then - Actions
                      • Custom script: call BJDebugMsg("bloodbag")
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Item-type of (Item being manipulated)) Equal to Canned fish
                        • Then - Actions
                          • Custom script: call BJDebugMsg("cANNED FISH")
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Item-type of (Item being manipulated)) Equal to Rasputin Beer
                            • Then - Actions
                              • Custom script: call BJDebugMsg("BEER")
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Item-type of (Item being manipulated)) Equal to Baked Beans
                                • Then - Actions
                                  • Custom script: call BJDebugMsg("beans")
                                • Else - Actions
It throws me a compile error that functions is not declared

LzWI.png


Any suggestions ? thanks in advance
 

3an

3an

Level 1
Joined
Jan 25, 2018
Messages
3
it's just i cant use jass scripts those whom will need to be compiled , thats the problem :p but thanks , gon' try your solution guys
 

3an

3an

Level 1
Joined
Jan 25, 2018
Messages
3
Actualy, KILLCIDE's solution worked , didnt tested if the function works as it should have to , but it compiles now even if usin' the funciton outside the trigger , so im okay for now :) thanks guys
 
Top