Difference between revisions of "Papyrus FAQs"
m
Fixed indentation on script elements
imported>Digitalparanoid |
imported>Kicoax m (Fixed indentation on script elements) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 16: | Line 16: | ||
=== To whom do I send fan/hate mail about Papyrus? === | === To whom do I send fan/hate mail about Papyrus? === | ||
[https://community.bethesda.net/people/SmkViper SmkViper] created Papyrus and actively helps scripters in the official Fallout 4 Creation Kit forum. | [https://community.bethesda.net/people/SmkViper SmkViper] created Papyrus and actively helps scripters in the [https://community.bethesda.net/community/fallout/fallout-4/creation-kit-beta official Fallout 4 Creation Kit forum.] | ||
== First Steps == | == First Steps == | ||
Line 167: | Line 167: | ||
<PapyrusProject xmlns="PapyrusProject.xsd" Flags="Institute_Papyrus_Flags.flg" Output="D:\Steam\steamapps\common\Fallout 4\Data\Scripts" Optimize="true" Release="true" Final="true"> | <PapyrusProject xmlns="PapyrusProject.xsd" Flags="Institute_Papyrus_Flags.flg" Output="D:\Steam\steamapps\common\Fallout 4\Data\Scripts" Optimize="true" Release="true" Final="true"> | ||
<Imports> | <Imports> | ||
<Import>D:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User</Import> | <Import>D:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\User</Import> | ||
<Import>D:\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\Base</Import> | |||
</Imports> | </Imports> | ||
<Scripts> | <Scripts> | ||
<Script>AutoLoot\Fragments\Terminals\TERM_dubhAutoLootMenuAdvance_0100272C.psc</Script> | |||
... | |||
</Scripts> | </Scripts> | ||
</PapyrusProject> | </PapyrusProject> | ||
Line 285: | Line 285: | ||
=== Are arrays limited to 128 elements? === | === Are arrays limited to 128 elements? === | ||
* Arrays that are created by scripts via the <code>New</code> operation or <code>Add()</code> function '''are''' limited to 128 elements. | |||
< | * Arrays returned by native functions, and editor-filled array properties, are '''not''' limited to 128 elements. | ||
=== How do I create a dynamic array? === | === How do I create a dynamic array? === | ||
Dynamic arrays grow to fit the number of elements. | |||
To create an empty dynamic array, pass <code>0</code> as the size. | |||
<code> | |||
ObjectReference[] dynamicArray = new ObjectReference[0] | |||
</code> | |||
Also: | |||
* You can pass in a variable or calculation for the array size. | |||
* You can call <code>Add()</code> and <code>Remove()</code> on the array to add and remove items. | |||
call | |||
=== How do I create key-value pairs? === | === How do I create key-value pairs? === | ||
Line 345: | Line 348: | ||
=== Can CallFunction() be used for reflection? === | === Can CallFunction() be used for reflection? === | ||
According to SmkViper: | |||
<pre> | <pre> | ||
Line 357: | Line 362: | ||
=== How do I use custom events instead of CallFunction()? === | === How do I use custom events instead of CallFunction()? === | ||
According to SmkViper: | |||
<pre> | <pre> | ||
Line 362: | Line 369: | ||
a function on your script in return to give the value back. The big advantage of custom | a function on your script in return to give the value back. The big advantage of custom | ||
events is they can dispatch in parallel, greatly speeding up processing. | events is they can dispatch in parallel, greatly speeding up processing. | ||
</pre> | |||
== Troubleshooting == | |||
=== What happens when Papyrus is "overloaded"? === | |||
According to SmkViper: | |||
<pre> | |||
The only thing "overloading" the script system will ever do will be to slow down all | |||
script processing. You could theoretically run your system out of memory at some point | |||
but the game would be unplayable long before then. | |||
</pre> | |||
=== Does Papyrus affect framerate? Or "drop" function calls? Or "lose" entire scripts? === | |||
No. According to SmkViper: | |||
<pre> | |||
Papyrus never affects framerate, nor does it "drop" function calls. It doesn't "drop | |||
scripts" either, whatever the heck that would mean) You wouldn't have an "overload" | |||
problem if it did, because then it would just throw things out instead of slow down, | |||
but that way lies madness - randomly not running function calls is just silly. | |||
</pre> | </pre> |