#Removing merchants from reality
1 messages · Page 1 of 1 (latest)
So is the idea to disable NPCs only while the mod is enabled?
Pretty much
public onInitialize() { runs when its enabled right?
even during gameplay?
Once, when the mod is first initialized
NPCs being enabled or not is done via a "game option" which is retrieved while the user is playing, so you need to hook into the thing that returns the game options
?
It does not say executed repeatedly
when your mod initializes or becomes enabled, such as when your mod is enabled in the mods menu?
ah I see
You can't mess with the options of a game at that point bcuz the user can't be in a game yet at that point
so we'd use a hook like public onGameScreenVisible() { ?
that also only happens once
you could technically put it there but you'd be permanently changing the options for the game rather than making it only when your mod is enabled
ah
try putting this inside your mod class:
@Inject(Game, "getGameOptions", InjectionPosition.Post)
public onGetGameOptions(api: IInjectionApi<Game, "getGameOptions">) {
(api.executingInstance["gameOptionsCached"] as IGameOptions).npcs.merchants.allowSpawning = false;
}
okay nvm that doens't work
give me a min
Ah, alright
I would have checked the injection tab on the docs but it wasn't there so I was going to sift through example mods
Ah I see what you're doing here
yeah
might want to add npm install -g typescript to the tutorial, Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler tsc.
Couldn't compile 
aaaaaaaaa
I'm a double idiot hahaha
never worked with any of these things before
just scrapped lua together on noita and isaac
Yeah it's kinda uncommon for games to use this stuff
soo when I use ctrl+shift+b its not finding my... tsconfig.json file (I think?)
Do you have your mod folder opened in vscode or just your Mod.ts?
you should have a folder structure like this in the explorer
ah
Honestly though I haven't read everything thoroughly
Is this supposed to run without imports? I'm missing a lot of imports and I'm basically as far removed from experienced as you can get
no you need to import stuff
I'm looking at other forum posts here but ultimately I lack any understanding
you should be able to import stuff automatically, sometimes it doens't work though
If I give you code and there's red lines over some names of things, and hovering over it the tooltip says "unknown something" you might need to import it. You can try putting in the name in the search feature here and it should show up: https://waywardgame.github.io/
Documentation for Wayward Types Viewer
and then your import should be import { IGameOptions } from "game/options/IGameOptions";
sometimes you'll get ones that say "default", in that case your import should look something like this: import Register from "mod/ModRegistry";
{} in the import means you're importing any number of things from that module, and a thing outside of {} means you're importing the "default" thing in that module as the name you provide
whoops failed to upload that pic
Anyway if you can't figure out an import feel free to ask and I'll give you the right line
I'm importing from "game/utilities/class/Inject" but its saying Cannot find module 'game/utilities/class/Inject'.
ah, I should have interpreted that via this line in the scripts page here
I assume I only include it if it's defined after game again such as with igameoptions?
so anything after src/game/
yep
In our internal dev file structure everything is within src/game/
that's why it looks like this for you
game/game/game.ts
lol my head
thanks for the help its my first time with this kind of language
Alright I don't know what to do when its asking to define game
import Game from "/game" looks and feels very wrong so its not that
This??
no
er
does game still look like a word
I thought it was whatever is after src/game, wouldn't that just be /game? 😵💫
doesn't feel like a word anymore yeah lol
crap!
so obvious now
I really had to game game instead of game, and not game game game ofc
lmfao
should have known about the before ts thing from my last import
There was one time in Wayward modding where you didn't need to worry about any of this because it would automatically import anything
It was a wonderful time
And then Typescript broke it
hey so it prevents milestone unlocks, is that a toggle or just because its local and not published? (I presume incase you break something and ruin unlock data or?)
Add this to your mod.json:
"allowUnlockingMilestones": true,
And
"multiplayer": "compatible",
And
"unloadable": true,
Thanks
Is there a command to run the event to spawn a merchant? Event manager I assume?
I just want to make sure its even working lol
In the console run
for (let i = 0; i < 10000; i++) {
localIsland.runRandomEvents(localPlayer);
}
To open the console go to developer options > enable "developer mode" > click "toggle developer tools", and then in the window that opens it's the "console" tab
Oh right yeah you use the devtools
Yeah I've got the console open
wasn't sure how to browse available commands but I did get my civ score up
no merchants! :>
ah seems like you can just hook whatever, nice
found drathy's steam guide on it
How do I upload it? hahaha
click mod info button in mods menu, then there'll be a publish button

uhhhh
I have a mod.png in my mod folder, is that not how I set the thumbnail....?
literally could not find anything on the discord or example mods
I just wanna upload a mod 
Literally had the code for the mod made for me hours ago and spent all this time figuring all these basics out
It's a quick export as png from photoshop at scale 268x268, game seems to have no issue recognizing this as the thumbnail here too, but it fails...???
uhhhhhhh
restarted steam and launched wayward with admin, now its stuck publishing??
here's the file itself
I don't think it's the image making publish not working
The game is stuck saying it has a cloud error and can't sync inside my library
I've restarted steam a few times
sounds like you're having steam issues in general right now then
probably related
we don't control cloud stuff
Restarted PC and still have cloud problems
This all started when I uploaded the mod and forgot a thumbnail, deleted it on workshop, removed the added ID line in my mod.json, then tried to reupload it
I want to say there's some kind of delay on the next time you can upload stuff on the workshop but I'm struggling to locate any info online about it
and I have no idea why it would throw errors about uploading a png
Your mistake is I think that you deleted the mod, then
Doing "publish" a second time publishes an update to the mod
it sounds like it's getting confused there
Remove "publishedFileId" from your mod.json (gets automatically added when uploading a mod)
Already have
Ah
Yeah might be hitting some kind of limit then?
Not sure
Never seen anyone mention this before
Hm. When a mod is uploaded it has that yellow bar mentioning an approval period
I think there has to be some kind of limit
Yep, there's an arbitrary limit
no idea what but it just worked now
I guess it's 30 minutes if this all started at 10:00 (for me)