Dialogs is handled by the localization file
You will have to create a en-US.hjson file like this one: tModLoader/en-US.hjson at 1.4 · tModLoader/tModLoader
You don't need ALL that code (mostly delete almost all of it) but look at lines 124 and downwards. You'll need something like this.
Also do you know how to add unique dialogue for each liked/disliked biome and npc?Dialogs is handled by the localization file
You will have to create a en-US.hjson file like this one: tModLoader/en-US.hjson at 1.4 · tModLoader/tModLoader
You don't need ALL that code (mostly delete almost all of it) but look at lines 124 and downwards. You'll need something like this.
Also do you know how to add unique dialogue for each liked/disliked biome and npc?
public class SomeNPC : ModNPC
{
public override void SetStaticDefaults()
{
// Your code
//...
//...
// happiness
NPC.Happiness
.SetBiomeAffection<ForestBiome>(AffectionLevel.Like) // prefers the forest.
.SetBiomeAffection<SnowBiome>(AffectionLevel.Dislike) // dislikes the snow.
.SetBiomeAffection<ExampleSurfaceBiome>(AffectionLevel.Love) // likes the Example Surface Biome
.SetNPCAffection(NPCID.Dryad, AffectionLevel.Love) // Loves living near the dryad.
.SetNPCAffection(NPCID.Guide, AffectionLevel.Like) // Likes living near the guide.
.SetNPCAffection(NPCID.Merchant, AffectionLevel.Dislike) // Dislikes living near the merchant.
.SetNPCAffection(NPCID.Demolitionist, AffectionLevel.Hate); // Hates living near the demolitionist. // < Mind the semicolon!
}
Unfortunately, happiness dialogs can only be added using the method I showedView attachment 379931
I've created the .hjson file, but how would I do it with code like this?
i fixed it. now im updating their shops and adding a new npcAnd the text can be configured in the localization file, as I showed aboveC#:public class SomeNPC : ModNPC { public override void SetStaticDefaults() { // Your code //... //... // happiness NPC.Happiness .SetBiomeAffection<ForestBiome>(AffectionLevel.Like) // prefers the forest. .SetBiomeAffection<SnowBiome>(AffectionLevel.Dislike) // dislikes the snow. .SetBiomeAffection<ExampleSurfaceBiome>(AffectionLevel.Love) // likes the Example Surface Biome .SetNPCAffection(NPCID.Dryad, AffectionLevel.Love) // Loves living near the dryad. .SetNPCAffection(NPCID.Guide, AffectionLevel.Like) // Likes living near the guide. .SetNPCAffection(NPCID.Merchant, AffectionLevel.Dislike) // Dislikes living near the merchant. .SetNPCAffection(NPCID.Demolitionist, AffectionLevel.Hate); // Hates living near the demolitionist. // < Mind the semicolon! }
2.
Unfortunately, happiness dialogs can only be added using the method I showed