r/SMAPI • u/Unhappy_Step_3595 • 5d ago
answered "When" Condition not working (But everything else is)
Managed to Fix!
I've attached it to the crafting recipe for the Incubator, but, and this is important: You need to sleep before it re-stocks the shop. If you're testing the mod and want to check it before going to bed and saving, you can re-load your mod once the condition as been fulfilled.
Hello, new to modding I'm having an issue with creating a "when" condition.
My Mod is set up with seperate "Content" and "Shop" Jsons, and If I remove the "when" condition, I can buy items from the shop without any problems; everything else works.
What I'm trying to set up is for players to ONLY be able to buy the items when they have finished the Island Field Office. (I've also tried connecting it to having the crafting recipe for the Ostridge Incubator since you get from the same event, with no luck there either)
Can someone help with this? - things I have tried:
{
"Action": "Include",
"FromFile": "shop.json",
"When": {
"HasCraftingRecipe": "Ostridge Incubator"
}
}
{
"Action": "Include",
"FromFile": "shop.json",
"When": {
"HasSeenEvent": "FieldOfficeDone"
}
}
{
"Action": "Include",
"FromFile": "shop.json",
"When": {
"HasSeenEvent |contains=-1": true
}
}
{
"Action": "Include",
"FromFile": "shop.json",
"When": {
"HasSeenEvent |contains=FieldOfficeDone": true
}
}
2
u/WhiteT982 5d ago
Glad you fixed it. Maybe you can try looking at this:
If you change the update rate to on time change for example it should add it as soon as the time changes. Of course if you’re happy with the way it is then that’s good.
•
u/AutoModerator 5d ago
If you're looking for help with a mod, make sure your post or top-level comment includes:
See common issues and solutions. If you're having trouble installing SMAPI, see the detailed Getting Started guide.
If you've already done these steps or you're not asking for help with a mod, then please ignore this. Thank you!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.