Thoughts on shops & .mob files

Discussion in 'General Modification' started by Morpheus, Mar 19, 2005.

Remove all ads!
  1. Morpheus

    Morpheus Mindflayer Veteran

    Joined:
    Nov 11, 2003
    Messages:
    539
    Likes Received:
    1
    Previous modders have found out that editing the inventory of shops is very, very tricky. (See this thread, for example: http://www.co8.org/forum/showthread.php?t=207&page=2&pp=30.)

    Editing InvenSource.mes doesn't seem to work in a lot of cases. Some stores refresh their inventory (using InvenSource.mes) when you sell something to the shopkeeper and then wait for a certain amount of time (like, 30 days). Brother Smythe's shop is one of those. For some, that doesn't work at all. Their inventory just doesn't refresh, no matter how long you wait.

    I did some research on this and found that all the items in a shop are separate .mob files in the map's directory. I guess that there must be a list somewhere (in the shopkeeper's .mob file?) that connects these .mob files with the store inventory.

    Adding an item to a shop inventory with create_item_in_inventory doesn't work, because the item is created in the shopkeeper's inventory and only shows up when you kill and loot him.

    I tried spawning a "fresh" shopkeeper via a .py script, using Brother Smythe's proto id, but when you barter with him, you only get his character inventory, not his shop's.

    *bangs head against wall*

    I guess until someone figures out how to edit .mob files, the only way to add new buyable items is a) through dialogue or b) using one of the shops that has a refreshable inventory (like Brother Smythe's). Method a) isn't very pretty, and method b) has the disadvantage that you need to sell something to the shopkeeper and then come back later for the new items to show up.
     
  2. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hey, Morpheus,

    It's good to hear that you were trying to make some research on this, 'cause I also tried to do that in the past. :)

    Well, what I have found out so far is that *.mob files are really, really tricky stuff. I tried to break the format down in the past and it seems that almost every type of a *.mob has its own format, sort of. Anyway, that's not the point.

    The point is that you are exactly right about the inventory. The objects are created through separate *.mob files, and then their GUIDs are linked in a mob file. The truth is, the flag that makes the inventory restackable might be (and probably is) in the *.mob files as well.

    I can't do the *.mob file format breakdown myself, due to heavy lack of time to experiment with every byte in the files... That'd be great if you or someone else could join up, maybe we could find out some more information about the format or something like that?

    I also tried installing Arcanum to see how all this stuff works. Turns out that Arcanum also uses *.mob files which are very, very similar to the ToEE ones. I tried placing a mob, modifying some stuff in the worlded, and seeing what effects it has on the mob files. However, the results are kinda frustrating because, as I said, it only reinforced my point of view that every type of mob file has its own format (moreover, the file size is not fixed - you can add and remove item entries, link them to other mob files, etc., and a lot of data seems to change with every modification to hazard a guess about the overall structure of the format).

    What's known to me is that first few bytes (I don't remember the offsets - just take a look in my "Spawning creatures..." thread) contain the X/Y offsets of the mob. Also, the offset for the proto ID is known. Also, it's known that mob files contain their own monstrous GUIDs inside (you can find out easily by viewing them in a hex editor :)

    Anyway, could someone recommend me an ubercool hex editor which could support data structures better than Hex Workshop? I mean, maybe there's a program that I don't know of that can assign certain bytes to structures so there's no need to consult my hand-written table of offsets every time? If someone could do that, maybe I could go on breaking down a mob format faster?

    Any ideas, guys?
    Thanks in advance.
    - Agetian
     
    Last edited: Mar 20, 2005
Our Host!