A Proposition to Modders (Related to Vendor Spawn Classes)

lyravegalyravega Posts: 338
edited May 2013 in General Modding
This is an old discussion. Please refer to this if you are interested: viewtopic.php?f=57&t=55562

Greetings everyone.

I have an idea for compatibility. Currently, I have two mods that use the same Spawn Class (MERCHANT_GENERAL_INVENTORY). I managed to make them compatible with each other, but why stop there? The way I made them compatible is simple. I created one new spawn class for each mod. Called them MOD000 (for Gem Box) and MOD001 (for Stash Scrolls) respectively. And I added the items that those mods add to their own spawn classes. Then, to test stuff out, I added these new spawn classes to the main one; MERCHANT_GENERAL_INVENTORY now contains two spawn classes, and both mods use the same file.

You may be getting confused, even if not, for the sake of clarity; ignoring all the items that the mods add,
The first mod adds MOD000 spawn class, and MERCHANT_GENERAL_INVENTORY
The second mod adds MOD001 spawn class, and MERCHANT_GENERAL_INVENTORY

Both MERCHANT_GENERAL_INVENTORY are the same; it contains MOD000 and MOD001 spawn classes in it, but
First mod doesn't have MOD001
Second mod doesn't have MOD000

So, when you build the mods, and launch the game, both of these spawn classes show up; MERCHANT_GENERAL_INVENTORY gets overwritten by another one, but since it is the same file, it still has access to MOD000 and MOD001, which belongs to different mods. In short, I can use one same "master" file, and make stuff compatible.

Here is my proposition now: Lets create master spawn class files such as MERCHANT_GENERAL_INVENTORY, which will contain a lot of spawn classes in it, called such as MOD_MGI_0XX (X represents a number, MGI representing the initial letters of Merchant General Inventory). Anytime another modder wants to add items to a vendor, he would grab this master spawn class file, add it to his mod, and just add the items to one of the spawn classes that he chooses. Then s/he would report to a forum topic (related to master spawn classes) that s/he used which custom spawn class, so that other modders would know this, and avoid using the very same custom spawn class & thus avoid the conflict.

The aim is to get rid of these spawn class conflicts, especially related to vendors. It may take a few more steps for the modder to make his/her mod, but on the long run, all mods that use this system would be conflict safe. An user that has loaded 5 mods that use the same vendor will be able to see all the added items this way.

Please tell me what you think.

edit* You shouldn't edit the "master" file via GUTS. A text editor is needed, if you try to edit it via GUTS without the other spawn classes, they won't show up. The idea is not creating/editing the master file, but rather using one that has many slots already defined in them; you just need to put the master file, along with the new spawn class that your mod uses.
43tnvr9shh4uzfxfg.jpg?size_id=7
I will be migrating to Steam Workshop soon; not to worry, I won't drop non-Steam support, I will just copy/paste stuff from workshop pages instead of writing same but different "article" three times for every mod.

Comments

  • ArkhamArkham Posts: 3,296 ✭✭✭
    lyravega wrote:
    Please tell me what you think.
    Sounds like an excellent idea to me.
    Kv2n8MF.jpg

    Mods:
    Arkham's Armory (TL2) | Lego Wizard pet (TL1)

    Check out the Torchlight fan group #The-Lure-of-Ember on dA!
  • lyravegalyravega Posts: 338
    Well, no one is interested I guess.
    I will be migrating to Steam Workshop soon; not to worry, I won't drop non-Steam support, I will just copy/paste stuff from workshop pages instead of writing same but different "article" three times for every mod.
  • KelinTorKelinTor Posts: 368
    Well most people would make a new merchant and use the merge method as described here viewtopic.php?f=47&t=52455&p=443625&hilit=merge+layout#p443625 or here by Marsh viewtopic.php?f=57&t=54369&hilit=merge+layout#p458467. It doesn't solve all problems but there is less potential conflict.
    [TEXTURE] Comic-like touch
    [ITEM] Level 100+ items V1.10
    [NPC] KelinTor's Merchant V1.38 New quests+Mercenaries scroll+Boss+Champion wave+Add 7 stashes+transfer your gold+ training dummies
    The readme contains the links to all my mods (16 total).
  • lyravegalyravega Posts: 338
    Hey KelinTor. You got the GUTS yet?

    Also, I'm trying to add an item or two. Not a merchant. I'm not working with layouts in a simple mods that'll add items. Merge is for layouts as far as I know.
    I will be migrating to Steam Workshop soon; not to worry, I won't drop non-Steam support, I will just copy/paste stuff from workshop pages instead of writing same but different "article" three times for every mod.
  • KelinTorKelinTor Posts: 368
    Yep got GUTS recently but didn't have time to pour into modding. I just finished converting some of my mods now.
    The merge method is indeed only for layouts and the merchant is only if you have many items but in my case I already have a 2nd merchant so better be prepared just in case. Of course if there are tons of new merchants in the Enclave nothing will be solved even with the merge method.
    [TEXTURE] Comic-like touch
    [ITEM] Level 100+ items V1.10
    [NPC] KelinTor's Merchant V1.38 New quests+Mercenaries scroll+Boss+Champion wave+Add 7 stashes+transfer your gold+ training dummies
    The readme contains the links to all my mods (16 total).
  • zParticlezParticle Posts: 211
    edited May 2013
    Thanks, lyravega, I'm using your exact idea now. If we don't have a master index set up yet, I'll post mine here if I publish the mod. Any reason not to just use MERCHANT_GENERAL_INVENTORY with the spawn classes as you've done for Gem Box?

    I love it when other people have already solved problems like this for me.

    [Skip to update 6 to avoid my painful thought process.]

    UPDATE 1: Okay, just tested this and MERCHANT_GENERAL_INVENTORY removes MOD000 and MOD001 if I don't include their files in my mod. At least, they're not showing up in GUTS, and I can only surmise they're being similarly discarded at compilation when I changed the .DAT file manually. Only my merchandise (MOD002) shows up in the store.

    UPDATE 2: Ah. I sort of skipped over this part, but is your proposal to create a common MOD_MGI_0XX to contain not a clone of MERCHANT_GENERAL_INVENTORY but the actual MOD000, MOD001, etc data? I can see that that would work, but wouldn't that make this more of a compilation than an open-ended compatibility method? I'll go ahead and implement this using your Gem Box spawnclasses and see how it works out.

    UPDATE 3: Even with adding GEMBOX specifically to our custom spawn class, because that item doesn't exist in my mod it gets ignored just like MOD000. You're going to have to help me out here, as I'm clearly missing something!

    UPDATE 4: Okay! I threw out the MOD_MGI_0XX thing since your mods didn't actually use that and went back and added both the reference to MOD000 in MERCHANT_GENERAL_INVENTORY *and* the MOD000 spawnclass file. Even though the latter points to a nonexistent item, the merchant properly sees all of their items and so they get spawned correctly. I think this is where you were going with this, because it actually works! It does require including all other MODxxx files in each mod to pull it off, so it does end up being a sort of compilation, but only the active mods' items show up, as intended. Whew.

    UPDATE 5: So, as long as I had everything working perfectly, I thought I'd try to break it by removing the individual MODxxx files that weren't part of this mod. To my surprise and consternation, the mod still worked perfectly. "But, but... that's where I was back at UPDATE 1!" It turns out, ALL the spawnclasses (the MOD00x files) have to be present when you first compile or any time you modify the merchant spawnclass from within GUTS (so it can properly update the .BINDAT file). They don't need to be the correct ones, though—any spawnclass file will work as a placeholder since you're going to delete it on the second compile. Crazy GUTS voodoo, man.

    UPDATE 6: Final update now that lyravega's got me straightened out. Simply don't edit the merchant spawnclass in GUTS and you'll be fine—use a text editor. Now that we've standardized a MERCHANT_GENERAL_INVENTORY.DAT file, you don't even need to edit it: just drop that file in and add your custom spawnclasses.
  • zParticlezParticle Posts: 211
    edited April 2013
    Here's the "new" MERCHANT_GENERAL_INVENTORY.DAT now with three MOD00x spawnclasses:
    [SPAWNCLASS]
    	<STRING>NAME:MERCHANT_GENERAL_INVENTORY
    	[OBJECT]
    		<STRING>UNIT:IDENTIFY SCROLL
    		<INTEGER>WEIGHT:-1
    		<INTEGER>RARITY_OVERRIDE:1
    	[/OBJECT]
    	[OBJECT]
    		<STRING>UNIT:WAYPOINT PORTAL SCROLL
    		<INTEGER>WEIGHT:-1
    		<INTEGER>RARITY_OVERRIDE:1
    	[/OBJECT]
    	[OBJECT]
    		<STRING>UNITTYPE:MANAPOTION
    		<INTEGER>WEIGHT:-1
    		<INTEGER>MINCOUNT:9
    		<INTEGER>MAXCOUNT:9
    		<INTEGER>LEVEL_BONUS:-9
    	[/OBJECT]
    	[OBJECT]
    		<STRING>UNITTYPE:MANAPOTION
    		<INTEGER>WEIGHT:-1
    		<INTEGER>MINCOUNT:9
    		<INTEGER>MAXCOUNT:9
    	[/OBJECT]
    	[OBJECT]
    		<STRING>UNITTYPE:MANAPOTION
    		<INTEGER>WEIGHT:-1
    		<INTEGER>MINCOUNT:9
    		<INTEGER>MAXCOUNT:9
    		<INTEGER>LEVEL_BONUS:9
    	[/OBJECT]
    	[OBJECT]
    		<STRING>UNITTYPE:HEALTHPOTION
    		<INTEGER>WEIGHT:-1
    		<INTEGER>MINCOUNT:9
    		<INTEGER>MAXCOUNT:9
    		<INTEGER>LEVEL_BONUS:-9
    	[/OBJECT]
    	[OBJECT]
    		<STRING>UNITTYPE:HEALTHPOTION
    		<INTEGER>WEIGHT:-1
    		<INTEGER>MINCOUNT:9
    		<INTEGER>MAXCOUNT:9
    	[/OBJECT]
    	[OBJECT]
    		<STRING>UNITTYPE:HEALTHPOTION
    		<INTEGER>WEIGHT:-1
    		<INTEGER>MINCOUNT:9
    		<INTEGER>MAXCOUNT:9
    		<INTEGER>LEVEL_BONUS:9
    	[/OBJECT]
    	[OBJECT]
    		<STRING>UNIT:DYNAMITE
    		<INTEGER>WEIGHT:-1
    	[/OBJECT]
    	[OBJECT]
    		<STRING>SPAWNCLASS:MOD000
    		<INTEGER>WEIGHT:-1
    		<INTEGER>RARITY_OVERRIDE:1
    		<BOOL>NO_MAGIC_ITEMS:1
    		<BOOL>NO_UNIQUE_ITEMS:1
    	[/OBJECT]
    	[OBJECT]
    		<STRING>SPAWNCLASS:MOD001
    		<INTEGER>WEIGHT:-1
    		<INTEGER>RARITY_OVERRIDE:1
    		<BOOL>NO_MAGIC_ITEMS:1
    		<BOOL>NO_UNIQUE_ITEMS:1
    	[/OBJECT]
    	[OBJECT]
    		<STRING>SPAWNCLASS:MOD002
    		<INTEGER>WEIGHT:-1
    		<INTEGER>RARITY_OVERRIDE:1
    	[/OBJECT]
    [/SPAWNCLASS]
    
    MOD index:
    MOD000 gem box
    MOD001 stash scrolls
    MOD002 the goldfish exchange

    I suppose others can just update this and repost so we can update our mods for compatibility with any new ones.
  • lyravegalyravega Posts: 338
    You shouldn't edit the "master" file via GUTS. A text editor is needed, if you try to edit it via GUTS without the other spawn classes, they won't show up. The idea is not creating/editing the master file, but rather using one that has many slots already defined in them; you just need to put the master file, along with the new spawn class that your mod uses.
    43tnvr9shh4uzfxfg.jpg?size_id=7
    I will be migrating to Steam Workshop soon; not to worry, I won't drop non-Steam support, I will just copy/paste stuff from workshop pages instead of writing same but different "article" three times for every mod.
  • zParticlezParticle Posts: 211
    edited April 2013
    Holy infographic, Batman! This makes perfect sense. If we create 20 generic mod slots, anyone can use them, and all they have to do is "claim" a specific slot so they don't get reused.

    So can the flags your mods used in the merchant file:
    <BOOL>NO_MAGIC_ITEMS:1
    <BOOL>NO_UNIQUE_ITEMS:1be moved down to the individual MOD0xx instead to keep things generic? If so, this sounds like an elegant solution.

    Here's an updated MERCHANT_GENERAL_INVENTORY.DAT with 20 generic slots for custom merchandise [updated MOD0xx to MOD_MGI_0xx]:
    &#91;SPAWNCLASS&#93;
       &lt;STRING&gt;NAME:MERCHANT_GENERAL_INVENTORY
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNIT:IDENTIFY SCROLL
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNIT:WAYPOINT PORTAL SCROLL
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNITTYPE:MANAPOTION
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;MINCOUNT:9
          &lt;INTEGER&gt;MAXCOUNT:9
          &lt;INTEGER&gt;LEVEL_BONUS:-9
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNITTYPE:MANAPOTION
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;MINCOUNT:9
          &lt;INTEGER&gt;MAXCOUNT:9
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNITTYPE:MANAPOTION
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;MINCOUNT:9
          &lt;INTEGER&gt;MAXCOUNT:9
          &lt;INTEGER&gt;LEVEL_BONUS:9
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNITTYPE:HEALTHPOTION
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;MINCOUNT:9
          &lt;INTEGER&gt;MAXCOUNT:9
          &lt;INTEGER&gt;LEVEL_BONUS:-9
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNITTYPE:HEALTHPOTION
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;MINCOUNT:9
          &lt;INTEGER&gt;MAXCOUNT:9
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNITTYPE:HEALTHPOTION
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;MINCOUNT:9
          &lt;INTEGER&gt;MAXCOUNT:9
          &lt;INTEGER&gt;LEVEL_BONUS:9
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;UNIT:DYNAMITE
          &lt;INTEGER&gt;WEIGHT:-1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_000
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_001
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_002
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_003
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_004
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_005
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_006
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_007
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_008
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_009
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_010
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_011
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_012
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_013
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_014
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_015
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_016
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_017
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_018
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
       &#91;OBJECT&#93;
          &lt;STRING&gt;SPAWNCLASS:MOD_MGI_019
          &lt;INTEGER&gt;WEIGHT:-1
          &lt;INTEGER&gt;RARITY_OVERRIDE:1
       &#91;/OBJECT&#93;
    &#91;/SPAWNCLASS&#93;
    
  • lyravegalyravega Posts: 338
    Exactly. The mod numbers, MOD000 can also change to something like MOD_MGI_00X, to allow additions to the other vendors without a conflict, too.
    I will be migrating to Steam Workshop soon; not to worry, I won't drop non-Steam support, I will just copy/paste stuff from workshop pages instead of writing same but different "article" three times for every mod.
  • zParticlezParticle Posts: 211
    Okay, I've updated the goldfish exchange as MOD_MGI_002 to be fully compliant with this standard. (I kept the old MOD0xx references in place for downward compatibility; those can be removed once no longer needed.)

    Ran into one minor issue when I tried reusing the code I posted here earlier. This forum's [code] designator doesn't preserve the tabs, and converts them to a nonstandard 3 spaces. So I had to clean this up before GUTS would take it—be careful if you use that.

    Anyway, thanks again, and let me know when you get a chance to update the other mods.
  • thebbanditthebbandit Posts: 41
    I will update my Combine Them All pack to comply to the standard as well. Ill use 003 slot.
  • zParticlezParticle Posts: 211
    Jake is using MOD_MGI_004 for the Gem Merchants mod.
  • lyravegalyravega Posts: 338
    Project is now live at viewtopic.php?f=57&t=55562
    I will be migrating to Steam Workshop soon; not to worry, I won't drop non-Steam support, I will just copy/paste stuff from workshop pages instead of writing same but different "article" three times for every mod.
Sign In or Register to comment.