Editing Arcane University:Scripting Best Practices

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 30: Line 30:
 
##'''Use a spell:''' Make a constant effect magic effect that sets a global to 1 on effect start and 0 on effect end. Then, make an ability that has this effect, and condition the effect using the condition function you want to use in your Papyrus script. Add the ability to the player (or to a player quest alias). Then, add this global variable as a script property. You can check if it is equal to 1 or 0 to see if your condition is met.
 
##'''Use a spell:''' Make a constant effect magic effect that sets a global to 1 on effect start and 0 on effect end. Then, make an ability that has this effect, and condition the effect using the condition function you want to use in your Papyrus script. Add the ability to the player (or to a player quest alias). Then, add this global variable as a script property. You can check if it is equal to 1 or 0 to see if your condition is met.
 
##'''Use a quest:''' Make a quest with reusable stages, then make a stage with multiple log entries. Condition the different entries using the condition function you need to check, and use quest fragments for the different entries for how you want your script to respond to the different conditions. Then, when you need to check the condition, use the SetStage command on your new quest. The quest will evaluate the conditions, and response with the appropriate fragment.
 
##'''Use a quest:''' Make a quest with reusable stages, then make a stage with multiple log entries. Condition the different entries using the condition function you need to check, and use quest fragments for the different entries for how you want your script to respond to the different conditions. Then, when you need to check the condition, use the SetStage command on your new quest. The quest will evaluate the conditions, and response with the appropriate fragment.
βˆ’
#Condition functions generally process faster than their Papyrus equivalents. For a large script, using the steps in (20) can also be a good way to lighten the load of your script.
+
#Condition functions generally process faster than their Papyrus equivalents. For a large script, using the steps in (19) can also be a good way to lighten the load of your script.
 
#More generally: Don't use Papyrus for something that can be done without papyrus.
 
#More generally: Don't use Papyrus for something that can be done without papyrus.
 
#'''COMMENT πŸ‘ YOUR πŸ‘ CODE πŸ‘'''
 
#'''COMMENT πŸ‘ YOUR πŸ‘ CODE πŸ‘'''
 
# Performance: Profile your scripts and functions to understand the time delay by your scripts and functions. You can use [https://speedscope.app speedscope] to visualize your profiles. https://www.reddit.com/r/skyrimmods/comments/i57siz/profiling_your_papyrus_scripts/
 
# Performance: Profile your scripts and functions to understand the time delay by your scripts and functions. You can use [https://speedscope.app speedscope] to visualize your profiles. https://www.reddit.com/r/skyrimmods/comments/i57siz/profiling_your_papyrus_scripts/

Please note that all contributions to Beyond Skyrim are considered to be released under the Creative Commons Attribution-ShareAlike (see Beyond Skyrim Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)

Template used on this page: