Custom Script that doesn't work

Zanderist

New Member
Reaction score
5
Why doesn't this work?

JASS:
function Trig_Move_to_Here_Func003A takes nothing returns nothing
    call GroupPointOrderLocBJ( udg_Zombies, "attack", GetRectCenter(udg_Move_to_Here) )
endfunction

function Trig_Move_to_Here_Actions takes nothing returns nothing
    set udg_Zombies = GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(3))
    set udg_Move_to_Here = gg_rct_The_Town
    call ForGroupBJ( udg_Zombies, function Trig_Move_to_Here_Func003A )
    call DestroyGroup ( udg_Zombies )
    call RemoveLocation ( udg_Move_to_Here )
endfunction


Problem line is

JASS:
call DestroyGroup ( udg_Zombies )
    call RemoveLocation ( udg_Move_to_Here )
 

Emu.Man00

New Member
Reaction score
41
JASS:
set udg_move_to_here = gg_rct_The_Town
...
call RemoveLocation(udg_Move_to_Here)


You're either trying to set a location variable to a rect, or remove a rect as if it were a location

try this

JASS:
function Trig_Move_to_Here_Func003A takes nothing returns nothing
    call GroupPointOrderLocBJ( udg_Zombies, "attack", udg_Move_to_Here)
endfunction

function Trig_Move_to_Here_Actions takes nothing returns nothing
    set udg_Zombies = GetUnitsInRectOfPlayer(GetPlayableMapRect(), Player(3))
    set udg_Move_to_Here = GetRectCenter(gg_rct_The_Town)
    call ForGroupBJ( udg_Zombies, function Trig_Move_to_Here_Func003A )
    call DestroyGroup ( udg_Zombies )
    call RemoveLocation ( udg_Move_to_Here )
endfunction


You can also clean it up a little by removing BJs, and using X/Y instead of points.

I've always used NewGen so I never know what works in the vanilla editor, but try this:

JASS:
function Trig_Move_to_Here_Func003A takes nothing returns nothing
    local real x = GetRectCenterX(gg_rct_The_Town)
    local real y = GetRectCenterY(gg_rct_The_Town)
    call IssuePointOrder(GetEnumUnit(), "attack", x, y) //If nothing happens change GetEnumUnit() to GetFilterUnit(); I can't recall which is which :]
endfunction

function Trig_Move_to_Here_Actions takes nothing returns nothing
    call GroupEnumUnitsOfPlayer(udg_Zombies, Player(3), null)
    //set udg_Move_to_Here = GetRectCenter(gg_rct_The_Town)
    call ForGroup( udg_Zombies, function Trig_Move_to_Here_Func003A )
    call DestroyGroup ( udg_Zombies )
    call RemoveLocation ( udg_Move_to_Here )
endfunction


You can remove the commented line if you were only using the variable for that trigger, otherwise uncomment it.
 

Zanderist

New Member
Reaction score
5
I've copied and pasted what you wrote and it's still telling me

Invalid Argument

Expected a code statement

I did this with the GUI command custom script by the way.

Just those two I mentioned in the GUI.
 

Zanderist

New Member
Reaction score
5
It wouldn't matter what I've converted it, all that matters is that it works.

Trigger:
  • Events
    • Time-Every 10 seconds of the game
    • Conditions
    • Actions
      • Set Zombies= (units in (playablemap area)owned by player 4 (purple))
      • Set Move_to_here = The Town <gen>
      • Unit Group - Pick every unit in Zombies and do (actions)
        • Loop-Actions
          • Unit Group - Order Zombies to Attack-Move to (Center Of Move_to_Here)
        • Custom script: call DestoryGroup ( udg_Zombies )
        • Custom script: call RemoveLocation ( udg_Move_to_Here )
 

cleeezzz

The Undead Ranger.
Reaction score
268
well i dont know how well you copied your GUI but

# Custom script: Call DestoryGroup ( udg_Zombies )
# Custom script: Call RemoveLocation ( udg_Move_to_Here )

those calls should be lower case
 

Shura

New Member
Reaction score
45
Well there's not a whole lot of expanding that can be done on that statement. Move_To_Here should be a point variable. Then you set Move_To_Here to the center of the region and order the units to move to Move_To_Here. Then your custom scripts will work.
 

SwedishChef

New Member
Reaction score
32
Next time just copy the trigger by right clicking on the trigger name in the small window where you see the trigger and use the gui tags, it makes it so much easier.
 
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