• 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.

[Trigger] same variable for multiple spells

Status
Not open for further replies.
Level 7
Joined
Jun 15, 2010
Messages
218
I'm trying to make my owns spells with triggers for the first time since a long time. And i dont remember if it was possible or not to use the same variable for allot of spells, or would that cause trouble?

for example: im making a firebal, iceball and tunderball.
They all start with "
"set variable: ball_loc1 = point of caster"
"set variable: ball_loc2 = point of ability being cast"

i then save the variables in hashtables and remove location with custom script.

This shouldent give any problems right?
or should i better make a variable for each spell different
like:

fireball_loc1
fireball_loc2

iceball_loc1
iceball_loc2

tunderball_loc1
tunderball_loc2
 
You can use same location variables for your spells.

But you must pay attention here...

If you make Custom script: RemoveLocation(fireball_loc1) , the stored fireball_loc1 in hashtable will also get removed.

So you need to remove location out of hashtable when you dont need it anymore instead or right after spell casting:

Custom script: call RemoveLocation(LoadLocationHandle(Hashtable, parentKey, childKey))
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
Just to suggest way, your 2nd way would actually work better than the first which might bug up your whole spell when done.

You could also use Array for a single variable so when you use this single variable in a spell and to another one, you could use this single variable in two spells by just changing its array number.

Like, for this boolean type of variable with an array (just an example of how array works):

  • Set OptQuest_Complete[1] = True
^ I will use this for my first trigger

  • Set OptQuest_Complete[2] = True
^ Now, I will be using the same variable for my second trigger but because it is an array, we can change the value to another one so it will act like another variable of some sort. And so, it won't bug until you are using the different value for the same variable.
 
Status
Not open for further replies.
Top