Can't identify problem (custom scripts)

Bird

Ultra Cool Member
Reaction score
29
The last line gives me 'expected a name' error.
Trigger:
  • Events
    • Unit - A unit Dies
    • Actions
      • Custom script: local integer r
      • For each (Integer A) from 1 to 12, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Prm_RegnBase[(Integer A)] contains (Dying unit)) Equal to True
          • Then - Actions
            • Custom script: set r = GetForLoopIndexA()
          • Else - Actions
    • Set Tmp_UG = (Units within 1440.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an ally of (Owner of (Triggering unit))) Equal to False) and ((((Matching unit) is in Prm_UG_ClckAlph) Equal to True) and (((Matching unit) is in Prm_UG_ClckSpwn)
    • Unit Group - Pick every unit in Tmp_UG and do (Actions)
      • Loop - Actions
        • Custom script: call IssuePointOrderLocBJ( GetEnumUnit(), "attack", GetRectCenter(udg_Prm_RegnJnct[r]) )
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Maybe the name is wrong? I only got that error when I type the variable name wrong.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
The [ljass]local integer r[/ljass] is local to the main actions function, and can't be accessed from within the unit group loop, because that's a separate function. You can see this if you convert the trigger to custom script.

Why are you even using a local? There aren't any waits in this trigger, so a global would be fine.
 

Bird

Ultra Cool Member
Reaction score
29
Thank you.

I had a Global Variable there, but it stopped working recently when I made some change elsewhere. It is being over-written - and I can't figure out why. This is a short-handed version of a long script, I am only showing where "local integer r" comes into place.

So do I need to pass the "r" into the unit group loop.. or...?
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Well, the only way to pass a value into a unit group loop (as done in GUI) is with a global, and there's no reason it wouldn't work unless another trigger is also using that variable and somehow interfering.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top