Local Variables

Fatmankev

Chef, Writer, and Midnight Toker
Reaction score
240
Is there a way to use local variables for units without using custom code?
 

Seannny

Why GUI when you can Jass?
Reaction score
46
Unfortunetly no, The wonders of jass seem to keep this from us Gui'ers
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
Not fully. You can do this, however.

Create a unit variable. I'll call mine SomeUnit.

Then, in your trigger, use this custom script as your first line:

Custom script: local unit udg_SomeUnit

Then use your unit like normal, but it will be local.

WARNING: This will not work in unit group loops, If conditions, or basically anything that creates another function when it's parsed into JASS.
 

oorosco

New Member
Reaction score
23
You just referance the global variable cause in that function after you declare a global into a local it's just considered that- at least to my knowledge
 

Kenny

Back for now.
Reaction score
202
No, not that i know of, GUI only uses global variables. But i may be wrong, i started on JASS and kinda skipped the whole GUI part.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
I'm fairly certain this works. I think I tried it at some point.
It will be treated local assuming you don't try to use it outside the function in which it was declared.
 

Fatmankev

Chef, Writer, and Midnight Toker
Reaction score
240
Alright, I'll give that a shot when I get around to it. Thanks, Ghan.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top