Modding:Adding Code at Startup: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Modding Info}}
{{Modding Info}}{{Modding Topic Prerequisites | Modding:C Sharp Scripting}}
 
{{ambox
|type=This article presupposes some knowledge of [[Modding/C Sharp Scripting|C# scripting]].
|format=tiny}}
 
==Overview==
==Overview==


Line 34: Line 29:
* After player is created for a New Game
* After player is created for a New Game
|| Code runs only once when a New Game starts, after the player object is first created. Is never called again. Useful if you want your code to run only once per save file. For example, you might add a custom part to the player that holds your code. For more information about this method, refer to [[Modding:Adding Code to the Player]].
|| Code runs only once when a New Game starts, after the player object is first created. Is never called again. Useful if you want your code to run only once per save file. For example, you might add a custom part to the player that holds your code. For more information about this method, refer to [[Modding:Adding Code to the Player]].
|-
| '''AfterGameLoaded Hook''' ||
* After a save game is loaded and the Player object exists
|| Code runs immediately after a save game is loaded, and when the Player object exists. Useful if your code needs to modify the player object after a save game load (similar to PlayerMutator for new games). For more information about this method, refer to [[Modding:Adding Code to the Player]].
|-
|-
| '''Harmony Injection''' ||
| '''Harmony Injection''' ||
* ''At any time in the code flow''
* ''At any time in the code flow''
|| {{betamoddingcontent}}
|| This is the most flexible method by far, because you can inject your code anywhere in the code flow. However, it is also the most difficult and technical of the options. Most mods do not need this and it is not recommended for modders who are new to C# scripting. For more information about this method, refer to [[Modding:Harmony]].
This is the most flexible method by far, because you can inject your code anywhere in the code flow. However, it is also the most difficult and technical of the options. Most mods do not need this and it is not recommended for modders who are new to C# scripting. For more information about this method, refer to [[Modding:Harmony Injection]].
|}
|}


Line 169: Line 167:
{{Modding Navbox}}
{{Modding Navbox}}


[[Category:Modding]][[Category:Guides]]
[[Category:Script Modding]]
2,158

edits

Navigation menu