Difference between revisions of "Cross Script Variables"
Jump to navigation
Jump to search
m
→Practical Applications
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 | 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 | 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== |