• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Question about Variables

Status
Not open for further replies.
Level 7
Joined
Mar 5, 2009
Messages
254
Hello,im wondering which is the better way to make spells with variables,for example if i need to make 2 variables,1 for casting unit and 1 for target unit of ability being cast,is it better to make 1 variable for both units with array size 2 or 2 different variables without array size?
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
Depends what exactly you mean by 'better'.

I'd say use different variables as it keeps the clarity.
If you run into a situation where you need many variables you are confused if they are all in one array.
Use arrays for similar things and variables with clear names for different things.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Hello,im wondering which is the better way to make spells with variables,for example if i need to make 2 variables,1 for casting unit and 1 for target unit of ability being cast,is it better to make 1 variable for both units with array size 2 or 2 different variables without array size?

2 different variable and like was said its depend about situation, array mainly usefull when u want do something with loop

so a example the normal dot systems or mui systems where unit array used for check over all unit what currently do same action (damage over time to another unit, or all unit what example atm knocked back)

or another example when u want store all playable heroes to variable array in map init, there array better because u easily can pick any from unit array and dont must check alot variable :)

so array usefull if u need the stored things more times during game and u need work/order with data
 
Status
Not open for further replies.
Top