Difference between revisions of "Cross Script Variables"

Jump to navigation Jump to search
120 bytes added ,  11:39, 23 December 2010
m
imported>Bruneauinfo
imported>Bruneauinfo
Line 134: Line 134:
== Practical Applications ==
== Practical Applications ==


So one might be wondering where functionality like this might prove useful. If you're just writing simple mods this type of functionality may seem a bit excessive. But take as an example a mod where the player will only belong to one faction (''other than the player faction of course.'') Oblivion is designed assuming the player might be a member of many factions. But what if your mod required and only allowed the player be a member of one faction? And what if the relationships between factions was critical to the playing out of your mod? In this situation you might find yourself writing scripts where you would have to do a long series of repetitive checks like these:
So one might be wondering where functionality like this might prove useful. If you're just writing simple mods this type of functionality may seem a bit excessive. But take as an example a mod where the player will only belong to one faction (''other than the player faction of course.'') Oblivion is designed assuming the player might be a member of many factions. But what if your mod only allowed the player be a member of one faction? And what if the relationships between factions was absolutely critical to the playing out of the other scripts and behaviors in your mod? In this situation you might find yourself writing scripts where you would do a long series of repetitive checks like these:


  if (player.GetInFaction ''FactionRef'' == 1)
  if (player.GetInFaction ''FactionRef'' == 1)


These checks would go through each possible faction and could start to get a little hard on the eyes and make trouble shooting scripts a bit more difficult.  
These checks would go through each possible faction and could start to get a little hard on the eyes if there were a great many factions. This would make trouble shooting your scripts a bit more difficult too.  


Using the functionality discussed in this article you could store the player's faction in a quest script and just retrieve it with a few lines of code! If the player's faction could switch you would just write code to change the value in the quest script.
Using the functionality discussed in this article you could store the player's faction in a quest script and just retrieve it with a few lines of code each time a script needed the information! If the player's faction could switch you would just write code to change the value in the quest script.


==Final Notes==
==Final Notes==
Anonymous user

Navigation menu