Changes

Jump to navigation Jump to search
20 bytes removed ,  19:22, 29 July 2023
no edit summary
Line 119: Line 119:  
Adding new NPCs involves editing a number of files:
 
Adding new NPCs involves editing a number of files:
   −
* New file: [[Modding:Dialogue|Characters\Dialogue\<name>.json]] (See also [[Modding:Event_data]])
+
* New file: [[Modding:Dialogue|Characters\Dialogue\<name>.json]] (See also [[Modding:Event data]])
* New file: [[Modding:Schedule_data|Characters\schedules\<name>.json]] (Note that the "s" in the "schedules" folder is lowercase!)
+
* New file: [[Modding:Schedule data|Characters\schedules\<name>.json]] (Note that the "s" in the "schedules" folder is lowercase!)
* New file: [[Modding:NPC_data#Portraits|Portraits\<name>.png]]
+
* New file: [[Modding:NPC data#Portraits|Portraits\<name>.png]]
* New file: [[Modding:NPC_data#Overworld_sprites|Characters\<name>.png]]
+
* New file: [[Modding:NPC data#Overworld sprites|Characters\<name>.png]]
* Add entries [[Modding:Dialogue#Engagement_dialogue|Data\EngagementDialogue]] for NPCs that are marriable
+
* Add entries [[Modding:Dialogue#Engagement dialogue|Data\EngagementDialogue]] for NPCs that are marriable
* Add entry to [[Modding:NPC_data#Basic_info|Data\NPCDispositions]]
+
* Add entry to [[Modding:NPC data#Basic info|Data\NPCDispositions]]
* Add entry to [[Modding:Gift_taste_data|Data\NPCGiftTastes]]
+
* Add entry to [[Modding:Gift taste data|Data\NPCGiftTastes]]
* Add entries to [[Modding:Dialogue#Rain_dialogue|Characters\Dialogue\rainy]]
+
* Add entries to [[Modding:Dialogue#Rain dialogue|Characters\Dialogue\rainy]]
* Add entries to [[Modding:Schedule_data#Schedule_points|Data\animationDescriptions]] (if you want custom animations in their schedule)
+
* Add entries to [[Modding:Schedule data#Schedule points|Data\animationDescriptions]] (if you want custom animations in their schedule)
    
All of the above can be done with an AssetRequested event or Content Patcher. If you did all of this correctly, the game will spawn the NPC in for you. (If you didn't, it swallows the error)
 
All of the above can be done with an AssetRequested event or Content Patcher. If you did all of this correctly, the game will spawn the NPC in for you. (If you didn't, it swallows the error)
Line 154: Line 154:     
Types available:
 
Types available:
*1 - Achievement (HUDMessage.achievement_type)
+
#Achievement (HUDMessage.achievement_type)
*2 - New Quest (HUDMessage.newQuest_type)
+
#New Quest (HUDMessage.newQuest_type)
*3 - Error (HUDMessage.error_type)
+
#Error (HUDMessage.error_type)
*4 - Stamina (HUDMessage.stamina_type)
+
#Stamina (HUDMessage.stamina_type)
*5 - Health (HUDMessage.health_type)
+
#Health (HUDMessage.health_type)
      Line 214: Line 214:     
===DialogueBox===
 
===DialogueBox===
[[File:DialogueBox_NoChoices_Example.jpg|200px|thumb|right|Example of DialogueBox without choices.]]A '''DialogueBox''' is a text box with a slightly larger, slightly boldfaced text, with "typewriter-like" effect.
+
[[File:DialogueBox NoChoices Example.jpg|200px|thumb|right|Example of DialogueBox without choices.]]A '''DialogueBox''' is a text box with a slightly larger, slightly boldfaced text, with "typewriter-like" effect.
    
There are several variants, including ones with a dialogue/conversation choices.
 
There are several variants, including ones with a dialogue/conversation choices.
Line 400: Line 400:  
You will notice that there is really very little difference in the code used for static mail and dynamic mail.  The class that supports dynamic mail has a private dictionary collection for holding on to any mail content waiting to be injected.  It could have been made public to allow mail to be added directly into the collection, but that is not good practice.  Instead a public Add method was provided so that mail could be sent, so to speak, to the collection.  This code is for a specific MOD, not a robust framework, so it isn't overly concerned with error handling. You can improve that based on your needs.
 
You will notice that there is really very little difference in the code used for static mail and dynamic mail.  The class that supports dynamic mail has a private dictionary collection for holding on to any mail content waiting to be injected.  It could have been made public to allow mail to be added directly into the collection, but that is not good practice.  Instead a public Add method was provided so that mail could be sent, so to speak, to the collection.  This code is for a specific MOD, not a robust framework, so it isn't overly concerned with error handling. You can improve that based on your needs.
   −
Notice the additional code in the Edit method, where any mail in the dynamicMail collection is injected into Stardew Valley's content.  There will be no mail in the dynamicMail collection when the MOD is loaded (in this case) the first time.  If you add mail after the original load, then the content will have to be reloaded by invalidating the cache.  Refer to [[Modding:Modder_Guide/APIs/Content#Cache invalidation|Cache invalidation]] for more details.
+
Notice the additional code in the Edit method, where any mail in the dynamicMail collection is injected into Stardew Valley's content.  There will be no mail in the dynamicMail collection when the MOD is loaded (in this case) the first time.  If you add mail after the original load, then the content will have to be reloaded by invalidating the cache.  Refer to [[Modding:Modder Guide/APIs/Content#Cache invalidation|Cache invalidation]] for more details.
    
===Send a letter (using dynamic content)===
 
===Send a letter (using dynamic content)===
106,694

edits

Navigation menu