Variable question

brc

New Member
Reaction score
1
If i made a variable for one spell eg. "UnitGroup_1" can i use this same variable for a different spell? If i do this and both spells are cast at the same time does something happen?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
As long as your spell doesn't involve Periodic Events and/or Waits, you can use the group in another spell.
If both spells are cast, there's no problem since the first spell will run through and complete, then the second will complete itself.
 

istar

New Member
Reaction score
31
if the variable is global, as in you create in WE variable tab
then it may have some weird interaction with another instance of the spell
it may clash(esp if there is waits), it depends on how the spell is like, sometimes the possibility of clashing is too freaking small to matter
you can convert it to custom script and add a simple local variable though
 

WolfieeifloW

WEHZ Helper
Reaction score
372
if the variable is global, as in you create in WE variable tab
then it may have some weird interaction with another instance of the spell
it may clash(esp if there is waits), it depends on how the spell is like, sometimes the possibility of clashing is too freaking small to matter
you can convert it to custom script and add a simple local variable though
If he knew JASS, he wouldn't be using GUI in the first place :p .
Also, it doesn't "clash" with the other spell as long as there's no Periodic Events and/or Waits associated with either spell, like I said.
 

brc

New Member
Reaction score
1
lol ok thanks and how do i make local variables? is it like eg. "blizzard_caster and stormbolt_caster" rather than using "caster" for both?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Don't worry about local variables;
It's for JASS stuff.
Just use the Varible Editor (the yellow "X") .
 

brc

New Member
Reaction score
1
k but when i have 2 triggered spells for example blizzard and stormbolt and i use variables for both of them. Should i used separate variables or share the same one. "blizzard_caster" and "stormbolt_caster" or just "caster" for both?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
You can use "whateverCaster" for both, yes, as long as you're not using "Casting unit" as this can get lost in spells.
If you're using "Triggering unit" that's fine.
Or you can go ahead and make two variables.

Try to name your variables like;
  • The first word uncapitalized, while the rest of the words have a capital.
  • You don't need the "_".
Examples:
stormboltCaster
blizzardCaster
brcKnowsHowToNameVariablesNow
:p ;) !

Of course you don't have to name them like that, it just makes it easier for you, and the rest of us when you need help!
 

brc

New Member
Reaction score
1
oh and plus rep to everyone lol. and thanks for teaching me how to name my variables. LOL
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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