[Trigger] same variable for multiple spells

Level 7
Jun 15, 2010
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



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 29
Nov 29, 2012
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.