NewGen makes simple function declaration, complicated. Help me!

Evoroth

New Member
Reaction score
11
Alright. I recently started using NewGen, wrote this trigger and got two errors:



JASS:
function Trig_Flytta_Torn_Conditions takes nothing returns boolean
    return ( GetUnitTypeId(GetOrderedUnit()) == 'emtg' )
endfunction

function Trig_Flytta_Torn_Actions takes nothing returns nothing
    local rect r
    local location l = GetOrderPointLoc()
    
    set r = InWhichRegion(l)  ERROR: Undeclared function InWhichRegion
    call IssuePointOrderLoc(GetOrderedUnit(), "move", GetRectCenter(r)) 
    
endfunction

//===========================================================================
function InitTrig_Flytta_Torn takes nothing returns nothing
    set gg_trg_Flytta_Torn = CreateTrigger(  ) ERROR: Undeclared variable gg_trg_Flytta_Torn
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Flytta_Torn, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition( gg_trg_Flytta_Torn, Condition( function Trig_Flytta_Torn_Conditions ) )
    call TriggerAddAction( gg_trg_Flytta_Torn, function Trig_Flytta_Torn_Actions )
endfunction


The function InWhichRegion is the Custom Script Code section, and it has no errors in itself.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
I'm not sure how this "InWhichRegion()" thing works ... are you sure it returns a region and not a region array? What, if the location is part of multiple regions overlapping each other?

Also, did you check wether the function InWhichRegion is public? If yes: Try moving the trigger that contains the InWhichRegion function above your actual one.
 

Evoroth

New Member
Reaction score
11
InWhichRegion() returns a region, yes. And it is in the Custom Script Code, so shouldn't it be above all other functions?
 

Vexorian

Why no custom sig?
Reaction score
187
InWhichRegion() returns a region, yes. And it is in the Custom Script Code, so shouldn't it be above all other functions?
No. The custom script section is a lame hack by blizzard that is deprecated in vjass.

Libraries are added before the custom script section, you may have a library in the custom script section, but your new library will have to explicitly require it.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top