I would like to preface by saying that while this post is rather long, please do not be deterred. I have organized it by importance and broadness at the top, and it gets more specific toward the end, so you can bail anytime you feel you've lost interest, but give it a shot. If you think I am a more experienced modder than you, read on the first part, and you may learn something from me, but I am just beginning my computer science major, and my to begin, I am requesting anyone to correct me where I am wrong:
If it can be done without papyrus, do it without papyrus.
I asked a few questions about this to Egocarib, who essentially taught me the above philosophy, and I've gathered some ideas: the engine was build to optimize these condition checks based on relevance, and thus could blow through them rather quickly; meanwhile papyrus scripts are assembled in the broadest most universally compatible ways possible. At the same time, papyrus appears to be hastily designed to be as accessible to modders as possible, and bethesda assumes that a modder prioritizes their own scripts functions highest.
In short, I theorize that papyrus calls to the engine essentially come in bluntly screaming to top priority, devoid of the fundamental agility that similar engine calls have, bogging down all performance.
Example: Adding a spell to the playerWith papyrus, you can just use the following function in one of your scripts: game.getPlayer().addspell(exampleSpell) - OR -In the creation kit, you could make a quest with a referenceAlias for the player to which you include the spell.The latter is much easier to throw together, whereas the quest is an extra object to add, as well as consideration like how/when to begin the quest, but it's more efficient.
So okay, knowing that the CK is better for doing the exact same things you try to do with papyrus is great, but there's a very important consideration of how much better, for which I am essentially begging understanding/education. Papyrus is really tempting because it can more directly get at the things you want to do and is way less tedious. Sometimes the gap between how much more is involved to accomplish the same things with CK assets begs the question of "is it better to just go at this with papyrus?"
Example: responding to the player dropping low in stamina, by checking its percent value every second. With papyrus:Event onUpdate() if game.getPlayer().getActorValuePercentage("Magicka") <= 0.1 myImportantFunction() endif RegisterForSingleUpdate(1.0)EndEvent or again, more efficiently in the Creation KitCreate an ability spell and attach a custom magic effect with the conditions getCombatState != 0 run on Subject and getActorValuePercent Stamina <= 9 run on Subject, and then attach the following script to the magic effect:Event onInit() myImportantFunction()EndEvent
So now I get to the things I don't know for certain. Say I want to monitor the %health of an enemy in combat. I could do the following
while enemyActor.getCombatState() currentHealth = enemyActor.getActorValuePercentage("health") utility.wait(1.0)endwhile
That can give me precise amount every second, but I get the impression it's rather taxing on the system. I can track it just as precisely by making 100 unique magic effects, with 100 unique corresponding scripts like:
_permanantScript property otherScript auto hidden event onInit() otherScript.currentHealth = 9 endevent
But not only wow is that a lot of work to put together, that makes for the game checking 100 conditions every second in that spell. Is that still more efficient than the single papyrus function? If it's a spectrum, then it could be brought down to relevant ranges of health, so maybe only 10 effects, but I'm still want to know:
What is this spectrum?!
So, I'll give just one more example of the rising complexity I'm dealing with my mod, though the following can be answered with a comprehensive understanding of the above question. Assuming that CK value checking is the way to go, I'd still strive to optimize that design for further efficiency, because if I'm trying to track not just health of a single enemy, but all sorts of information about multiple enemies, I wouldn't want to bog down the system checking on information that isn't going to be used. I can imagine limiting these condition checks in two ways: after identifying the enemy and therefore what information is relevant, I can change the values of globalvariables that are the first "AND" condition checks of each effect, and I presume should it fail, the system gives up checking the values of all other conditions for that effect. Secondly, I could have multiple spells with different loadouts of magiceffects, and swap to the appropriate one. So instead of having a single universal monitor spell checking over a 100 conditions every second every enemy, I could have different spells for each enemy, each checking roughly 10 conditions every second. Both of these options still involve papyrus, though. For the former option, I need to change the values of global variables, and for the latter, I need to be removing and adding spells. So, now I need to know how taxing that is, and how much, to know how much of each of these options I want to be utilizing (as they are not mutually exclusive).
I think I've written enough for a single post. I am going to elaborate more on what I'm doing specifically in the second post.